--- old/src/share/classes/javax/swing/table/DefaultTableModel.java 2014-08-07 16:01:56.000000000 -0700 +++ new/src/share/classes/javax/swing/table/DefaultTableModel.java 2014-08-07 16:01:56.000000000 -0700 @@ -70,10 +70,18 @@ * 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 @@ * @see #setDataVector * @see #setValueAt */ - public DefaultTableModel(Vector columnNames, int rowCount) { + public DefaultTableModel(Vector columnNames, int rowCount) { setDataVector(newVector(rowCount), columnNames); } @@ -156,7 +164,7 @@ * @see #getDataVector * @see #setDataVector */ - public DefaultTableModel(Vector> data, Vector columnNames) { + public DefaultTableModel(Vector> data, Vector columnNames) { setDataVector(data, columnNames); } @@ -191,7 +199,8 @@ * @see #newRowsAdded * @see #setDataVector */ - public Vector> getDataVector() { + @SuppressWarnings("rawtypes") + public Vector getDataVector() { return dataVector; } @@ -219,9 +228,10 @@ * @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)((Vector)dataVector)); this.columnIdentifiers = nonNullVector(columnIdentifiers); justifyRows(0, getRowCount()); fireTableStructureChanged(); @@ -267,7 +277,7 @@ if (dataVector.elementAt(i) == null) { dataVector.setElementAt(new Vector<>(), i); } - ((Vector)dataVector.elementAt(i)).setSize(getColumnCount()); + dataVector.elementAt(i).setSize(getColumnCount()); } } @@ -374,7 +384,7 @@ * @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,8 +494,8 @@ * to zero columns * @see #setNumRows */ - public void setColumnIdentifiers(Vector columnIdentifiers) { - setDataVector(dataVector, columnIdentifiers); + public void setColumnIdentifiers(Vector columnIdentifiers) { + setDataVector((Vector>)dataVector, columnIdentifiers); } /** @@ -550,6 +560,7 @@ * @param columnName the identifier of the column being added * @param columnData optional data of the column being added */ + @SuppressWarnings("unchecked") // Adding element to raw columnIdentifiers public void addColumn(Object columnName, Vector columnData) { columnIdentifiers.addElement(columnName); if (columnData != null) { @@ -652,8 +663,7 @@ * column was given */ public Object getValueAt(int row, int column) { - Vector rowVector = dataVector.elementAt(row); - return rowVector.elementAt(column); + return dataVector.elementAt(row).elementAt(column); } /** @@ -667,9 +677,9 @@ * @exception ArrayIndexOutOfBoundsException if an invalid row or * column was given */ + @SuppressWarnings("unchecked") public void setValueAt(Object aValue, int row, int column) { - Vector rowVector = dataVector.elementAt(row); - rowVector.setElementAt(aValue, column); + dataVector.elementAt(row).setElementAt(aValue, column); fireTableCellUpdated(row, column); } @@ -700,11 +710,13 @@ * @return the new vector of vectors; if anArray is * null, returns null */ + @SuppressWarnings("rawtypes") protected static Vector> convertToVector(Object[][] anArray) { if (anArray == null) { return null; } - Vector> v = new Vector<>(anArray.length); + @SuppressWarnings("rawtypes") + Vector v = new Vector<>(anArray.length); for (Object[] o : anArray) { v.addElement(convertToVector(o)); }