diff --git a/jdk/src/share/classes/javax/swing/JSlider.java b/jdk/src/share/classes/javax/swing/JSlider.java index 39e960f9a75..675fb8552ab 100644 --- a/jdk/src/share/classes/javax/swing/JSlider.java +++ b/jdk/src/share/classes/javax/swing/JSlider.java @@ -138,7 +138,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { /** * {@code Dictionary} of what labels to draw at which values */ - private Dictionary labelTable; + private Dictionary labelTable; /** @@ -773,7 +773,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { } // Check that there is a label with such image - Enumeration elements = labelTable.elements(); + Enumeration elements = labelTable.elements(); while (elements.hasMoreElements()) { JComponent component = elements.nextElement(); @@ -797,7 +797,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @return the Dictionary containing labels and * where to draw them */ - public Dictionary getLabelTable() { + public Dictionary getLabelTable() { /* if ( labelTable == null && getMajorTickSpacing() > 0 ) { setLabelTable( createStandardLabels( getMajorTickSpacing() ) ); @@ -830,8 +830,8 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * attribute: visualUpdate true * description: Specifies what labels will be drawn for any given value. */ - public void setLabelTable( Dictionary labels ) { - Dictionary oldTable = labelTable; + public void setLabelTable( Dictionary labels ) { + Dictionary oldTable = labelTable; labelTable = labels; updateLabelUIs(); firePropertyChange("labelTable", oldTable, labelTable ); @@ -852,7 +852,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @see JComponent#updateUI */ protected void updateLabelUIs() { - Dictionary labelTable = getLabelTable(); + Dictionary labelTable = getLabelTable(); if (labelTable == null) { return; @@ -866,9 +866,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { } private void updateLabelSizes() { - Dictionary labelTable = getLabelTable(); + Dictionary labelTable = getLabelTable(); if (labelTable != null) { - Enumeration labels = labelTable.elements(); + Enumeration labels = labelTable.elements(); while (labels.hasMoreElements()) { JComponent component = labels.nextElement(); component.setSize(component.getPreferredSize()); @@ -1017,7 +1017,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { SmartHashtable table = new SmartHashtable( increment, start ); - Dictionary labelTable = getLabelTable(); + Dictionary labelTable = getLabelTable(); if (labelTable != null && (labelTable instanceof PropertyChangeListener)) { removePropertyChangeListener((PropertyChangeListener) labelTable); diff --git a/jdk/src/share/classes/javax/swing/JTable.java b/jdk/src/share/classes/javax/swing/JTable.java index d88dbed9985..5e2d595403e 100644 --- a/jdk/src/share/classes/javax/swing/JTable.java +++ b/jdk/src/share/classes/javax/swing/JTable.java @@ -670,7 +670,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param rowData the data for the new table * @param columnNames names of each column */ - public JTable(Vector> rowData, Vector columnNames) { + @SuppressWarnings("rawtypes") + public JTable(Vector rowData, Vector columnNames) { this(new DefaultTableModel(rowData, columnNames)); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java index bfd4e768ab1..898329d1d4e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java @@ -397,10 +397,10 @@ public class BasicSliderUI extends SliderUI{ protected boolean labelsHaveSameBaselines() { if (!checkedLabelBaselines) { checkedLabelBaselines = true; - Dictionary dictionary = slider.getLabelTable(); + Dictionary dictionary = slider.getLabelTable(); if (dictionary != null) { sameLabelBaselines = true; - Enumeration elements = dictionary.elements(); + Enumeration elements = dictionary.elements(); int baseline = -1; while (elements.hasMoreElements()) { JComponent label = elements.nextElement(); @@ -758,7 +758,7 @@ public class BasicSliderUI extends SliderUI{ } protected int getWidthOfWidestLabel() { - Dictionary dictionary = slider.getLabelTable(); + Dictionary dictionary = slider.getLabelTable(); int widest = 0; if ( dictionary != null ) { Enumeration keys = dictionary.keys(); @@ -771,7 +771,7 @@ public class BasicSliderUI extends SliderUI{ } protected int getHeightOfTallestLabel() { - Dictionary dictionary = slider.getLabelTable(); + Dictionary dictionary = slider.getLabelTable(); int tallest = 0; if ( dictionary != null ) { Enumeration keys = dictionary.keys(); @@ -876,7 +876,7 @@ public class BasicSliderUI extends SliderUI{ * @since 1.6 */ protected Integer getLowestValue() { - Dictionary dictionary = slider.getLabelTable(); + Dictionary dictionary = slider.getLabelTable(); if (dictionary == null) { return null; @@ -1134,7 +1134,7 @@ public class BasicSliderUI extends SliderUI{ public void paintLabels( Graphics g ) { Rectangle labelBounds = labelRect; - Dictionary dictionary = slider.getLabelTable(); + Dictionary dictionary = slider.getLabelTable(); if ( dictionary != null ) { Enumeration keys = dictionary.keys(); int minValue = slider.getMinimum(); diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java index 0cc5b0ed831..a346c715812 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java @@ -392,7 +392,7 @@ public class SynthSliderUI extends BasicSliderUI trackRect.x = insetCache.left; trackRect.width = contentRect.width; - Dictionary dictionary = slider.getLabelTable(); + Dictionary dictionary = slider.getLabelTable(); if (dictionary != null) { int minValue = slider.getMinimum(); int maxValue = slider.getMaximum(); diff --git a/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java b/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java index 4b9cc197575..2d34384693b 100644 --- a/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java +++ b/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java @@ -70,10 +70,18 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * The Vector of Vectors of * Object values. */ - protected Vector> dataVector; + @SuppressWarnings("rawtypes") + protected Vector dataVector; /** The Vector of column identifiers. */ - protected Vector columnIdentifiers; + @SuppressWarnings("rawtypes") + protected Vector columnIdentifiers; + // Unfortunately, for greater source compatibility the inner-most + // Vector in the two fields above is being left raw. The Vector is + // read as well as written so using Vector is not suitable and + // using Vector (without adding copying of input Vectors), + // would disallow existing code that used, say, a Vector + // as an input parameter. // // Constructors @@ -121,7 +129,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @see #setDataVector * @see #setValueAt */ - public DefaultTableModel(Vector columnNames, int rowCount) { + public DefaultTableModel(Vector columnNames, int rowCount) { setDataVector(newVector(rowCount), columnNames); } @@ -156,7 +164,8 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @see #getDataVector * @see #setDataVector */ - public DefaultTableModel(Vector> data, Vector columnNames) { + @SuppressWarnings("rawtypes") + public DefaultTableModel(Vector data, Vector columnNames) { setDataVector(data, columnNames); } @@ -191,7 +200,8 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @see #newRowsAdded * @see #setDataVector */ - public Vector> getDataVector() { + @SuppressWarnings("rawtypes") + public Vector getDataVector() { return dataVector; } @@ -219,9 +229,10 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @param columnIdentifiers the names of the columns * @see #getDataVector */ - public void setDataVector(Vector> dataVector, - Vector columnIdentifiers) { - this.dataVector = nonNullVector(dataVector); + @SuppressWarnings({"rawtypes", "unchecked"}) + public void setDataVector(Vector dataVector, + Vector columnIdentifiers) { + this.dataVector = nonNullVector((Vector)dataVector); this.columnIdentifiers = nonNullVector(columnIdentifiers); justifyRows(0, getRowCount()); fireTableStructureChanged(); @@ -267,7 +278,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl if (dataVector.elementAt(i) == null) { dataVector.setElementAt(new Vector<>(), i); } - ((Vector)dataVector.elementAt(i)).setSize(getColumnCount()); + dataVector.elementAt(i).setSize(getColumnCount()); } } @@ -350,7 +361,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * * @param rowData optional data of the row being added */ - public void addRow(Vector rowData) { + public void addRow(Vector rowData) { insertRow(getRowCount(), rowData); } @@ -374,7 +385,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @param rowData optional data of the row being added * @exception ArrayIndexOutOfBoundsException if the row was invalid */ - public void insertRow(int row, Vector rowData) { + public void insertRow(int row, Vector rowData) { dataVector.insertElementAt(rowData, row); justifyRows(row, row+1); fireTableRowsInserted(row, row); @@ -484,7 +495,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * to zero columns * @see #setNumRows */ - public void setColumnIdentifiers(Vector columnIdentifiers) { + public void setColumnIdentifiers(Vector columnIdentifiers) { setDataVector(dataVector, columnIdentifiers); } @@ -550,7 +561,8 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @param columnName the identifier of the column being added * @param columnData optional data of the column being added */ - public void addColumn(Object columnName, Vector columnData) { + @SuppressWarnings("unchecked") // Adding element to raw columnIdentifiers + public void addColumn(Object columnName, Vector columnData) { columnIdentifiers.addElement(columnName); if (columnData != null) { int columnSize = columnData.size(); @@ -652,6 +664,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * column was given */ public Object getValueAt(int row, int column) { + @SuppressWarnings("unchecked") Vector rowVector = dataVector.elementAt(row); return rowVector.elementAt(column); } @@ -668,6 +681,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * column was given */ public void setValueAt(Object aValue, int row, int column) { + @SuppressWarnings("unchecked") Vector rowVector = dataVector.elementAt(row); rowVector.setElementAt(aValue, column); fireTableCellUpdated(row, column); diff --git a/jdk/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java b/jdk/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java index 54f899268a8..83aa19839f8 100644 --- a/jdk/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java +++ b/jdk/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java @@ -1317,7 +1317,7 @@ public class DefaultMutableTreeNode implements Cloneable, } private final class PreorderEnumeration implements Enumeration { - private final Stack> stack = new Stack<>(); + private final Stack> stack = new Stack<>(); public PreorderEnumeration(TreeNode rootNode) { super(); @@ -1331,10 +1331,9 @@ public class DefaultMutableTreeNode implements Cloneable, } public TreeNode nextElement() { - Enumeration enumer = stack.peek(); + Enumeration enumer = stack.peek(); TreeNode node = enumer.nextElement(); - @SuppressWarnings("unchecked") - Enumeration children = node.children(); + Enumeration children = node.children(); if (!enumer.hasMoreElements()) { stack.pop(); @@ -1351,7 +1350,7 @@ public class DefaultMutableTreeNode implements Cloneable, final class PostorderEnumeration implements Enumeration { protected TreeNode root; - protected Enumeration children; + protected Enumeration children; protected Enumeration subtree; public PostorderEnumeration(TreeNode rootNode) { diff --git a/jdk/src/share/classes/javax/swing/tree/TreeNode.java b/jdk/src/share/classes/javax/swing/tree/TreeNode.java index be669c6568b..ce918415c25 100644 --- a/jdk/src/share/classes/javax/swing/tree/TreeNode.java +++ b/jdk/src/share/classes/javax/swing/tree/TreeNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -99,5 +99,5 @@ public interface TreeNode * * @return the children of the receiver as an {@code Enumeration} */ - Enumeration children(); + Enumeration children(); } diff --git a/jdk/src/share/classes/sun/tools/jconsole/inspector/TableSorter.java b/jdk/src/share/classes/sun/tools/jconsole/inspector/TableSorter.java index 1263bd50fa9..d4aa7a853b4 100644 --- a/jdk/src/share/classes/sun/tools/jconsole/inspector/TableSorter.java +++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/TableSorter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2014, 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 @@ -146,7 +146,7 @@ public class TableSorter extends DefaultTableModel implements MouseListener { // update row heights in XMBeanAttributes (required by expandable cells) if (attrs != null) { for (int i = 0; i < getRowCount(); i++) { - Vector data = (Vector) dataVector.elementAt(i); + Vector data = dataVector.elementAt(i); attrs.updateRowHeight(data.elementAt(1), i); } } @@ -217,17 +217,17 @@ public class TableSorter extends DefaultTableModel implements MouseListener { } } - private Vector getRow(int row) { + private Vector getRow(int row) { return dataVector.elementAt(row); } @SuppressWarnings("unchecked") - private void setRow(Vector data, int row) { + private void setRow(Vector data, int row) { dataVector.setElementAt(data,row); } private void swap(int i, int j, int column) { - Vector data = getRow(i); + Vector data = getRow(i); setRow(getRow(j),i); setRow(data,j);