Skip to content

Commit

Permalink
8343476: Remove unnecessary @SuppressWarnings annotations (client)
Browse files Browse the repository at this point in the history
Reviewed-by: prr
  • Loading branch information
archiecobbs committed Nov 20, 2024
1 parent 4ddd3de commit 8a1f9f0
Show file tree
Hide file tree
Showing 107 changed files with 95 additions and 252 deletions.
3 changes: 1 addition & 2 deletions src/demo/share/jfc/SampleTree/SampleTree.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -142,7 +142,6 @@ public SampleTree() {

/** Constructs a JPanel containing check boxes for the different
* options that tree supports. */
@SuppressWarnings("serial")
private JPanel constructOptionsPanel() {
JCheckBox aCheckbox;
JPanel retPanel = new JPanel(false);
Expand Down
3 changes: 1 addition & 2 deletions src/demo/share/jfc/TableExample/TableExample3.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -97,7 +97,6 @@ public void windowClosing(WindowEvent e) {
};

// Create a model of the data.
@SuppressWarnings("serial")
TableModel dataModel = new AbstractTableModel() {
// These methods always need to be implemented.

Expand Down
4 changes: 1 addition & 3 deletions src/demo/share/jfc/TableExample/TableExample4.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -99,7 +99,6 @@ public void windowClosing(WindowEvent e) {
};

// Create a model of the data.
@SuppressWarnings("serial")
TableModel dataModel = new AbstractTableModel() {
// These methods always need to be implemented.

Expand Down Expand Up @@ -180,7 +179,6 @@ public void setValueAt(Object aValue, int row, int column) {

// Show the values in the "Favorite Number" column in different colors.
TableColumn numbersColumn = tableView.getColumn("Favorite Number");
@SuppressWarnings("serial")
DefaultTableCellRenderer numberColumnRenderer
= new DefaultTableCellRenderer() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -63,7 +63,6 @@ class AquaComboBoxButton extends JButton {
boolean isPopDown;
boolean isSquare;

@SuppressWarnings("serial") // anonymous class
protected AquaComboBoxButton(final AquaComboBoxUI ui,
final JComboBox<Object> comboBox,
final CellRendererPane rendererPane,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -161,7 +161,6 @@ public void show() {
}

@Override
@SuppressWarnings("serial") // anonymous class
protected JList<Object> createList() {
return new JList<Object>(comboBox.getModel()) {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -230,7 +230,6 @@ private void editorTextChanged() {

@SuppressWarnings("serial") // Superclass is not serializable across versions
class AquaCustomComboTextField extends JTextField {
@SuppressWarnings("serial") // anonymous class
public AquaCustomComboTextField() {
final InputMap inputMap = getInputMap();
inputMap.put(KeyStroke.getKeyStroke("DOWN"), highlightNextAction);
Expand Down Expand Up @@ -350,7 +349,6 @@ public void actionPerformed(final ActionEvent e) {
/**
* Highlight _but do not select_ the next item in the list.
*/
@SuppressWarnings("serial") // anonymous class
private Action highlightNextAction = new ComboBoxAction() {
@Override
public void performComboBoxAction(AquaComboBoxUI ui) {
Expand All @@ -367,7 +365,6 @@ public void performComboBoxAction(AquaComboBoxUI ui) {
/**
* Highlight _but do not select_ the previous item in the list.
*/
@SuppressWarnings("serial") // anonymous class
private Action highlightPreviousAction = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
Expand All @@ -380,7 +377,6 @@ void performComboBoxAction(final AquaComboBoxUI ui) {
}
};

@SuppressWarnings("serial") // anonymous class
private Action highlightFirstAction = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
Expand All @@ -389,7 +385,6 @@ void performComboBoxAction(final AquaComboBoxUI ui) {
}
};

@SuppressWarnings("serial") // anonymous class
private Action highlightLastAction = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
Expand All @@ -399,7 +394,6 @@ void performComboBoxAction(final AquaComboBoxUI ui) {
}
};

@SuppressWarnings("serial") // anonymous class
private Action highlightPageUpAction = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
Expand All @@ -420,7 +414,6 @@ void performComboBoxAction(final AquaComboBoxUI ui) {
}
};

@SuppressWarnings("serial") // anonymous class
private Action highlightPageDownAction = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
Expand Down Expand Up @@ -560,7 +553,6 @@ protected static void triggerSelectionEvent(final JComboBox<?> comboBox, final A

// This is somewhat messy. The difference here from BasicComboBoxUI.EnterAction is that
// arrow up or down does not automatically select the
@SuppressWarnings("serial") // anonymous class
private final Action triggerSelectionAction = new AbstractAction() {
public void actionPerformed(final ActionEvent e) {
triggerSelectionEvent((JComboBox)e.getSource(), e);
Expand All @@ -572,7 +564,6 @@ public boolean isEnabled() {
}
};

@SuppressWarnings("serial") // anonymous class
private static final Action toggleSelectionAction = new AbstractAction() {
public void actionPerformed(final ActionEvent e) {
final JComboBox<?> comboBox = (JComboBox<?>) e.getSource();
Expand All @@ -591,7 +582,6 @@ public void actionPerformed(final ActionEvent e) {
}
};

@SuppressWarnings("serial") // anonymous class
private final Action hideAction = new AbstractAction() {
@Override
public void actionPerformed(final ActionEvent e) {
Expand All @@ -606,7 +596,6 @@ public boolean isEnabled() {
}
};

@SuppressWarnings("serial") // anonymous class
private final Action openPopupOrHighlightLast = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
Expand All @@ -617,7 +606,6 @@ void performComboBoxAction(final AquaComboBoxUI ui) {
}
};

@SuppressWarnings("serial") // anonymous class
private final Action openPopupOrHighlightFirst = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1240,7 +1240,6 @@ public Dimension getMaximumSize(final JComponent c) {
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}

@SuppressWarnings("serial") // anonymous class
protected ListCellRenderer<File> createDirectoryComboBoxRenderer(final JFileChooser fc) {
return new AquaComboBoxRendererInternal<File>(directoryComboBox) {
public Component getListCellRendererComponent(final JList<? extends File> list,
Expand Down Expand Up @@ -1356,7 +1355,6 @@ public File getElementAt(final int index) {
//
// Renderer for Types ComboBox
//
@SuppressWarnings("serial") // anonymous class
protected ListCellRenderer<FileFilter> createFilterComboBoxRenderer() {
return new AquaComboBoxRendererInternal<FileFilter>(filterComboBox) {
public Component getListCellRendererComponent(final JList<? extends FileFilter> list,
Expand Down Expand Up @@ -1611,7 +1609,6 @@ public void installComponents(final JFileChooser fc) {

tPanel.add(labelArea);
// separator line
@SuppressWarnings("serial") // anonymous class
final JSeparator sep = new JSeparator(){
public Dimension getPreferredSize() {
return new Dimension(((JComponent)getParent()).getWidth(), 3);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -39,7 +39,6 @@

import static java.nio.charset.StandardCharsets.UTF_8;

@SuppressWarnings("serial") // JDK implementation class
class AquaFileView extends FileView {
private static final boolean DEBUG = false;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1020,7 +1020,6 @@ JMenuItem createMenuItem(final int i) {
if (component == null) {
menuItem = new JMenuItem(tabPane.getTitleAt(i), tabPane.getIconAt(i));
} else {
@SuppressWarnings("serial") // anonymous class
JMenuItem tmp = new JMenuItem() {
public void paintComponent(final Graphics g) {
super.paintComponent(g);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -249,7 +249,6 @@ static void updatePromptLabelOnEDT(final JLabel label, final JTextComponent text
label.setText(promptText);
}

@SuppressWarnings("serial") // anonymous class inside
protected static JButton getCancelButton(final JTextComponent c) {
final JButton b = createButton(c, getCancelIcon());
b.setName("cancel");
Expand Down Expand Up @@ -326,7 +325,6 @@ public Insets getBorderInsets(final Component c) {
}

protected boolean doingLayout;
@SuppressWarnings("serial") // anonymous class inside
protected LayoutManager getCustomLayout() {
// unfortunately, the default behavior of BorderLayout, which accommodates for margins
// is not what we want, so we "turn off margins" for layout for layout out our buttons
Expand Down
3 changes: 1 addition & 2 deletions src/java.desktop/macosx/classes/sun/lwawt/LWListPeer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -254,7 +254,6 @@ public void setSkipStateChangedEvent(boolean skipStateChangedEvent) {
}

@Override
@SuppressWarnings("unchecked")
public void valueChanged(final ListSelectionEvent e) {
if (!e.getValueIsAdjusting() && !isSkipStateChangedEvent()) {
final JList<?> source = (JList<?>) e.getSource();
Expand Down
3 changes: 1 addition & 2 deletions src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1353,7 +1353,6 @@ public void emulateActivation(boolean activate) {
changeFocusedWindow(activate, null);
}

@SuppressWarnings("deprecation")
private boolean isOneOfOwnersOf(LWWindowPeer peer) {
Window owner = (peer != null ? peer.getTarget().getOwner() : null);
while (owner != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ public void applyProperty(final CPlatformWindow c, final Object value) {
}
}
}) {
@SuppressWarnings("deprecation")
public CPlatformWindow convertJComponentToTarget(final JRootPane p) {
Component root = SwingUtilities.getRoot(p);
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -610,7 +610,6 @@ public void decodeRaw(byte[] b,
JPEGReader.read(0, JPEGParam);
}

@SuppressWarnings("removal")
protected void finalize() throws Throwable {
super.finalize();
JPEGReader.dispose();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -281,7 +281,6 @@ public void installComponents(JFileChooser fc) {
fc.setLayout(new BorderLayout(10, 10));
fc.setAlignmentX(JComponent.CENTER_ALIGNMENT);

@SuppressWarnings("serial") // anonymous class
JPanel interior = new JPanel() {
public Insets getInsets() {
return insets;
Expand All @@ -305,7 +304,6 @@ public Insets getInsets() {
curDirName = currentDirectory.getPath();
}

@SuppressWarnings("serial") // anonymous class
JTextField tmp1 = new JTextField(curDirName, 35) {
public Dimension getMaximumSize() {
Dimension d = super.getMaximumSize();
Expand Down Expand Up @@ -341,7 +339,6 @@ public Dimension getMaximumSize() {
align(l);
leftPanel.add(l);

@SuppressWarnings("serial") // anonymous class
JComboBox<FileFilter> tmp2 = new JComboBox<FileFilter>() {
public Dimension getMaximumSize() {
Dimension d = super.getMaximumSize();
Expand Down Expand Up @@ -419,7 +416,6 @@ public Dimension getMaximumSize() {
align(fileNameLabel);
interior.add(fileNameLabel);

@SuppressWarnings("serial") // anonymous class
JTextField tmp3 = new JTextField(35) {
public Dimension getMaximumSize() {
Dimension d = super.getMaximumSize();
Expand All @@ -444,7 +440,6 @@ public Dimension getMaximumSize() {
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
buttonPanel.add(Box.createGlue());

@SuppressWarnings("serial") // anonymous class
JButton tmp4 = new JButton(getApproveButtonText(fc)) {
public Dimension getMaximumSize() {
return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
Expand All @@ -460,7 +455,6 @@ public Dimension getMaximumSize() {
buttonPanel.add(approveButton);
buttonPanel.add(Box.createGlue());

@SuppressWarnings("serial") // anonymous class
JButton updateButton = new JButton(updateButtonText) {
public Dimension getMaximumSize() {
return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
Expand All @@ -475,7 +469,6 @@ public Dimension getMaximumSize() {
buttonPanel.add(updateButton);
buttonPanel.add(Box.createGlue());

@SuppressWarnings("serial") // anonymous class
JButton cancelButton = new JButton(cancelButtonText) {
public Dimension getMaximumSize() {
return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
Expand All @@ -490,7 +483,6 @@ public Dimension getMaximumSize() {
buttonPanel.add(cancelButton);
buttonPanel.add(Box.createGlue());

@SuppressWarnings("serial") // anonymous class
JButton helpButton = new JButton(helpButtonText) {
public Dimension getMaximumSize() {
return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
Expand Down
Loading

0 comments on commit 8a1f9f0

Please sign in to comment.