diff -r 3fb50df97199 -r 4050cc242edf jdk/src/share/classes/javax/swing/table/DefaultTableModel.java --- a/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java Fri Aug 15 13:02:46 2014 +0400 +++ b/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java Fri Aug 15 11:33:13 2014 -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,8 @@ * @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 @@ * @see #newRowsAdded * @see #setDataVector */ - public Vector> getDataVector() { + @SuppressWarnings("rawtypes") + public Vector getDataVector() { return dataVector; } @@ -219,9 +229,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)dataVector); this.columnIdentifiers = nonNullVector(columnIdentifiers); justifyRows(0, getRowCount()); fireTableStructureChanged(); @@ -267,7 +278,7 @@ 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 @@ * * @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 @@ * @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 @@ * to zero columns * @see #setNumRows */ - public void setColumnIdentifiers(Vector columnIdentifiers) { + public void setColumnIdentifiers(Vector columnIdentifiers) { setDataVector(dataVector, columnIdentifiers); } @@ -550,7 +561,8 @@ * @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 @@ * 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 @@ * 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);