Uploaded image for project: 'CCC Migration Project'
  1. CCC Migration Project
  2. CCC-8043550

Fix raw and unchecked lint warnings in javax.swing.*

XMLWordPrintable

    • source
    • low
    • Usual source compatibility issues when generifying long-existing types.
    • Java API
    • SE

      Summary

      Update portions of the javax.swing API to use generics.

      Problem

      Various types in javax.swing have not been generified and the API thus has various rawtypes and unchecked warnings that should be fixed.

      Solution

      Generify the API.

      Specification

      See the webrev at http://cr.openjdk.java.net/~darcy/8043550.1/

      UPDATE: In response to bug JDK-8058326, this ccc is being amended to include three changes that were left out of the initial request:

      javax.swing.tree.TreeNode:
      method: Enumeration children()
      is changed to: Enumeration<TreeNode> children()
      
      javax.swing.text.AbstractDocument$AbstractElement:
      method: Enumeration<?> children()
      is changed to: Enumeration<TreeNode> children()
      
      javax.swing.text.AbstractDocument$BranchElement:
      method: Enumeration<AbstractElement> children()
      is changed to: Enumeration<TreeNode> children()
      
      javax.swing.text.AbstractDocument$LeafElement:
      method: Enumeration<?> children()
      is changed to: Enumeration<TreeNode> children()
      
      
      --- old/src/share/classes/javax/swing/AbstractButton.java       2014-07-02 23:34:58.000000000 -0700
      +++ new/src/share/classes/javax/swing/AbstractButton.java       2014-07-02 23:34:58.000000000 -0700
      @@ -1123,7 +1123,7 @@
               }
           }
       
      -    private boolean isListener(Class c, ActionListener a) {
      +    private boolean isListener(Class<?> c, ActionListener a) {
               boolean isListener = false;
               Object[] listeners = listenerList.getListenerList();
               for (int i = listeners.length-2; i>=0; i-=2) {
      --- old/src/share/classes/javax/swing/ArrayTable.java   2014-07-02 23:34:59.000000000 -0700
      +++ new/src/share/classes/javax/swing/ArrayTable.java   2014-07-02 23:34:59.000000000 -0700
      @@ -133,7 +133,9 @@
                       if ((size==ARRAY_BOUNDARY) && isArray()) {
                           grow();
                       }
      -                ((Hashtable<Object,Object>)table).put(key, value);
      +                @SuppressWarnings("unchecked")
      +                Hashtable<Object,Object> tmp = (Hashtable<Object,Object>)table;
      +                tmp.put(key, value);
                   }
               }
           }
      --- old/src/share/classes/javax/swing/DebugGraphics.java        2014-07-02 23:35:00.000000000 -0700
      +++ new/src/share/classes/javax/swing/DebugGraphics.java        2014-07-02 23:35:00.000000000 -0700
      @@ -1463,7 +1463,5 @@
               }
               return debugGraphicsInfo;
           }
      -    private static final Class debugGraphicsInfoKey = DebugGraphicsInfo.class;
      -
      -
      +    private static final Class<DebugGraphicsInfo> debugGraphicsInfoKey = DebugGraphicsInfo.class;
       }
      --- old/src/share/classes/javax/swing/DefaultCellEditor.java    2014-07-02 23:35:00.000000000 -0700
      +++ new/src/share/classes/javax/swing/DefaultCellEditor.java    2014-07-02 23:35:00.000000000 -0700
      @@ -131,7 +131,7 @@
            *
            * @param comboBox  a <code>JComboBox</code> object
            */
      -    public DefaultCellEditor(final JComboBox comboBox) {
      +    public DefaultCellEditor(final JComboBox<?> comboBox) {
               editorComponent = comboBox;
               comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
               delegate = new EditorDelegate() {
      --- old/src/share/classes/javax/swing/DefaultRowSorter.java     2014-07-02 23:35:01.000000000 -0700
      +++ new/src/share/classes/javax/swing/DefaultRowSorter.java     2014-07-02 23:35:01.000000000 -0700
      @@ -128,7 +128,7 @@
           /**
            * Comparators specified by column.
            */
      -    private Comparator[] comparators;
      +    private Comparator<?>[] comparators;        /**       * Whether or not the specified column is sortable, by column. @@ -143,7 +143,7 @@      /**       * Cached comparators for the current sort       */ -    private Comparator[] sortComparators;
      +    private Comparator<?>[] sortComparators;        /**       * Developer supplied Filter. @@ -695,7 +695,7 @@       */      private void cacheSortKeys(List<? extends SortKey> keys) {          int keySize = keys.size(); -        sortComparators = new Comparator[keySize]; +        sortComparators = new Comparator<?>[keySize];          for (int i = 0; i < keySize; i++) {              sortComparators[i] = getComparator0(keys.get(i).getColumn());          } @@ -760,7 +760,7 @@      public void setComparator(int column, Comparator<?> comparator) {          checkColumn(column);          if (comparators == null) { -            comparators = new Comparator[getModelWrapper().getColumnCount()]; +            comparators = new Comparator<?>[getModelWrapper().getColumnCount()];          }          comparators[column] = comparator;      } @@ -786,8 +786,8 @@        // Returns the Comparator to use during sorting.  Where as      // getComparator() may return null, this will never return null. -    private Comparator getComparator0(int column) { -        Comparator comparator = getComparator(column); +    private Comparator<?> getComparator0(int column) { +        Comparator<?> comparator = getComparator(column);          if (comparator != null) {              return comparator;          } @@ -965,7 +965,9 @@                  } else if (v2 == null) {                      result = 1;                  } else { -                    result = sortComparators[counter].compare(v1, v2); +                    Comparator<Object> c = +                        (Comparator<Object>)sortComparators[counter]; +                    result = c.compare(v1, v2);                  }                  if (sortOrder == SortOrder.DESCENDING) {                      result *= -1; @@ -1364,10 +1366,10 @@       */      // NOTE: this class is static so that it can be placed in an array      private static class Row implements Comparable<Row> { -        private DefaultRowSorter sorter; +        private DefaultRowSorter<?, ?> sorter;          int modelIndex;   -        public Row(DefaultRowSorter sorter, int index) { +        public Row(DefaultRowSorter<?, ?> sorter, int index) {              this.sorter = sorter;              modelIndex = index;          } --- old/src/share/classes/javax/swing/JComponent.java   2014-07-02 23:35:02.000000000 -0700 +++ new/src/share/classes/javax/swing/JComponent.java   2014-07-02 23:35:01.000000000 -0700 @@ -2111,6 +2111,7 @@      private void registerWithKeyboardManager(boolean onlyIfNew) {          InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW, false);          KeyStroke[] strokes; +        @SuppressWarnings("unchecked")          Hashtable<KeyStroke, KeyStroke> registered =                  (Hashtable<KeyStroke, KeyStroke>)getClientProperty                                  (WHEN_IN_FOCUSED_WINDOW_BINDINGS); @@ -2164,6 +2165,7 @@       * <code>WHEN_IN_FOCUSED_WINDOW</code> <code>KeyStroke</code> bindings.       */      private void unregisterWithKeyboardManager() { +        @SuppressWarnings("unchecked")          Hashtable<KeyStroke, KeyStroke> registered =                  (Hashtable<KeyStroke, KeyStroke>)getClientProperty                                  (WHEN_IN_FOCUSED_WINDOW_BINDINGS); @@ -4126,16 +4128,20 @@                  setFlag(AUTOSCROLLS_SET, false);              }          } else if (propertyName == "focusTraversalKeysForward") { +            @SuppressWarnings("unchecked") +            Set<AWTKeyStroke> strokeSet = (Set<AWTKeyStroke>) value;              if (!getFlag(FOCUS_TRAVERSAL_KEYS_FORWARD_SET)) {                  super.setFocusTraversalKeys(KeyboardFocusManager.                                              FORWARD_TRAVERSAL_KEYS, -                                            (Set<AWTKeyStroke>)value); +                                            strokeSet);              }          } else if (propertyName == "focusTraversalKeysBackward") { +            @SuppressWarnings("unchecked") +            Set<AWTKeyStroke> strokeSet = (Set<AWTKeyStroke>) value;              if (!getFlag(FOCUS_TRAVERSAL_KEYS_BACKWARD_SET)) {                  super.setFocusTraversalKeys(KeyboardFocusManager.                                              BACKWARD_TRAVERSAL_KEYS, -                                            (Set<AWTKeyStroke>)value); +                                            strokeSet);              }          } else {              throw new IllegalArgumentException("property \""+ @@ -4713,6 +4719,7 @@       * @see #getVetoableChangeListeners       * @see #getAncestorListeners       */ +    @SuppressWarnings("unchecked") // Casts to (T[])
           public <T extends EventListener> T[] getListeners(Class<T> listenerType) {          T[] result;          if (listenerType == AncestorListener.class) { --- old/src/share/classes/javax/swing/JEditorPane.java  2014-07-02 23:35:02.000000000 -0700 +++ new/src/share/classes/javax/swing/JEditorPane.java  2014-07-02 23:35:02.000000000 -0700 @@ -1191,7 +1191,7 @@              String classname = getKitTypeRegistry().get(type);              ClassLoader loader = getKitLoaderRegistry().get(type);              try { -                Class c; +                Class<?> c;                  if (loader != null) {                      c = loader.loadClass(classname);                  } else { @@ -1264,18 +1264,26 @@        private static Hashtable<String, String> getKitTypeRegistry() {          loadDefaultKitsIfNecessary(); -        return (Hashtable)SwingUtilities.appContextGet(kitTypeRegistryKey); +        @SuppressWarnings("unchecked") +        Hashtable<String, String> tmp = +            (Hashtable)SwingUtilities.appContextGet(kitTypeRegistryKey); +        return tmp;      }        private static Hashtable<String, ClassLoader> getKitLoaderRegistry() {          loadDefaultKitsIfNecessary(); -        return (Hashtable)SwingUtilities.appContextGet(kitLoaderRegistryKey); +        @SuppressWarnings("unchecked") +        Hashtable<String, ClassLoader> tmp = +            (Hashtable)SwingUtilities.appContextGet(kitLoaderRegistryKey); +        return tmp;      }        private static Hashtable<String, EditorKit> getKitRegisty() { -        Hashtable ht = (Hashtable)SwingUtilities.appContextGet(kitRegistryKey); +        @SuppressWarnings("unchecked") +        Hashtable<String, EditorKit> ht = +            (Hashtable)SwingUtilities.appContextGet(kitRegistryKey);          if (ht == null) { -            ht = new Hashtable(3); +            ht = new Hashtable<>(3);              SwingUtilities.appContextPut(kitRegistryKey, ht);          }          return ht; @@ -1301,9 +1309,9 @@                                              "javax.swing.text.rtf.RTFEditorKit");                  }              } -            Hashtable ht = new Hashtable(); +            Hashtable<Object, Object> ht = new Hashtable<>();              SwingUtilities.appContextPut(kitTypeRegistryKey, ht); -            ht = new Hashtable(); +            ht = new Hashtable<>();              SwingUtilities.appContextPut(kitLoaderRegistryKey, ht);              for (String key : defaultEditorKitMap.keySet()) {                  registerEditorKitForContentType(key,defaultEditorKitMap.get(key)); --- old/src/share/classes/javax/swing/JLayer.java       2014-07-02 23:35:03.000000000 -0700 +++ new/src/share/classes/javax/swing/JLayer.java       2014-07-02 23:35:03.000000000 -0700 @@ -721,7 +721,7 @@                          AWTEvent.HIERARCHY_EVENT_MASK |                          AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK;   -        @SuppressWarnings("unchecked") +        @SuppressWarnings({"unchecked", "rawtypes"})          public void eventDispatched(AWTEvent event) {              Object source = event.getSource();              if (source instanceof Component) { @@ -729,7 +729,7 @@                  while (component != null) {                      if (component instanceof JLayer) {                          JLayer l = (JLayer) component; -                        LayerUI ui = l.getUI(); +                        LayerUI<?> ui = l.getUI();                          if (ui != null &&                                  isEventEnabled(l.getLayerEventMask(), event.getID()) &&                                  (!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) { --- old/src/share/classes/javax/swing/JOptionPane.java  2014-07-02 23:35:03.000000000 -0700 +++ new/src/share/classes/javax/swing/JOptionPane.java  2014-07-02 23:35:03.000000000 -0700 @@ -2387,7 +2387,7 @@          throws IOException, ClassNotFoundException {          s.defaultReadObject();   -        Vector          values = (Vector)s.readObject(); +        Vector<?>       values = (Vector)s.readObject();          int             indexCounter = 0;          int             maxCounter = values.size();   --- old/src/share/classes/javax/swing/JSpinner.java     2014-07-02 23:35:04.000000000 -0700 +++ new/src/share/classes/javax/swing/JSpinner.java     2014-07-02 23:35:04.000000000 -0700 @@ -907,7 +907,7 @@        /**       * This subclass of javax.swing.DateFormatter maps the minimum/maximum -     * properties to te start/end properties of a SpinnerDateModel. +     * properties to the start/end properties of a SpinnerDateModel.       */      private static class DateEditorFormatter extends DateFormatter {          private final SpinnerDateModel model; @@ -917,19 +917,25 @@              this.model = model;          }   -        public void setMinimum(Comparable min) { -            model.setStart(min); +        @Override +        @SuppressWarnings("unchecked") +        public void setMinimum(Comparable<?> min) { +            model.setStart((Comparable<Date>)min);          }   -        public Comparable getMinimum() { +        @Override +        public Comparable<Date> getMinimum() {              return  model.getStart();          }   -        public void setMaximum(Comparable max) { -            model.setEnd(max); +        @Override +        @SuppressWarnings("unchecked") +        public void setMaximum(Comparable<?> max) { +            model.setEnd((Comparable<Date>)max);          }   -        public Comparable getMaximum() { +        @Override +        public Comparable<Date> getMaximum() {              return model.getEnd();          }      } @@ -1095,19 +1101,23 @@              setValueClass(model.getValue().getClass());          }   -        public void setMinimum(Comparable min) { +        @Override +        public void setMinimum(Comparable<?> min) {              model.setMinimum(min);          }   -        public Comparable getMinimum() { +        @Override +        public Comparable<?> getMinimum() {              return  model.getMinimum();          }   -        public void setMaximum(Comparable max) { +        @Override +        public void setMaximum(Comparable<?> max) {              model.setMaximum(max);          }   -        public Comparable getMaximum() { +        @Override +        public Comparable<?> getMaximum() {              return model.getMaximum();          }      } --- old/src/share/classes/javax/swing/JTable.java       2014-07-02 23:35:05.000000000 -0700 +++ new/src/share/classes/javax/swing/JTable.java       2014-07-02 23:35:05.000000000 -0700 @@ -354,19 +354,23 @@      /** Identifies the row of the cell being edited. */      transient protected int             editingRow;   -    /** +   /**       * A table of objects that display the contents of a cell,       * indexed by class as declared in <code>getColumnClass</code>       * in the <code>TableModel</code> interface.       */ -    transient protected Hashtable defaultRenderersByColumnClass; +    transient protected Hashtable<Object, Object> defaultRenderersByColumnClass; +    // Logicaly, the above is a Hashtable<Class<?>, TableCellRenderer>. +    // It is declared otherwise to accomodate using UIDefaults.        /**       * A table of objects that display and edit the contents of a cell,       * indexed by class as declared in <code>getColumnClass</code>       * in the <code>TableModel</code> interface.       */ -    transient protected Hashtable defaultEditorsByColumnClass; +    transient protected Hashtable<Object, Object> defaultEditorsByColumnClass; +    // Logicaly, the above is a Hashtable<Class<?>, TableCellEditor>. +    // It is declared otherwise to accomodate using UIDefaults.        /** The foreground color of selected cells. */      protected Color selectionForeground; @@ -665,7 +669,7 @@       * @param rowData           the data for the new table       * @param columnNames       names of each column       */ -    public JTable(Vector rowData, Vector columnNames) { +    public JTable(Vector<Vector<Object>> rowData, Vector<Object> columnNames) {          this(new DefaultTableModel(rowData, columnNames));      }   @@ -1336,7 +1340,7 @@                  return (TableCellRenderer)renderer;              }              else { -                Class c = columnClass.getSuperclass(); +                Class<?> c = columnClass.getSuperclass();                  if (c == null && columnClass != Object.class) {                      c = Object.class;                  } @@ -2617,7 +2621,7 @@       * @since 1.6       */      public int convertRowIndexToView(int modelRowIndex) { -        RowSorter sorter = getRowSorter(); +        RowSorter<?> sorter = getRowSorter();          if (sorter != null) {              return sorter.convertRowIndexToView(modelRowIndex);          } @@ -2639,7 +2643,7 @@       * @since 1.6       */      public int convertRowIndexToModel(int viewRowIndex) { -        RowSorter sorter = getRowSorter(); +        RowSorter<?> sorter = getRowSorter();          if (sorter != null) {              return sorter.convertRowIndexToModel(viewRowIndex);          } @@ -2657,7 +2661,7 @@       * @see #getColumnCount       */      public int getRowCount() { -        RowSorter sorter = getRowSorter(); +        RowSorter<?> sorter = getRowSorter();          if (sorter != null) {              return sorter.getViewRowCount();          } @@ -3625,13 +3629,13 @@          }            // Update the UIs of all the default renderers. -        Enumeration defaultRenderers = defaultRenderersByColumnClass.elements(); +        Enumeration<?> defaultRenderers = defaultRenderersByColumnClass.elements();          while (defaultRenderers.hasMoreElements()) {              SwingUtilities.updateRendererOrEditorUI(defaultRenderers.nextElement());          }            // Update the UIs of all the default editors. -        Enumeration defaultEditors = defaultEditorsByColumnClass.elements(); +        Enumeration<?> defaultEditors = defaultEditorsByColumnClass.elements();          while (defaultEditors.hasMoreElements()) {              SwingUtilities.updateRendererOrEditorUI(defaultEditors.nextElement());          } @@ -5445,8 +5449,8 @@       */      static class GenericEditor extends DefaultCellEditor {   -        Class[] argTypes = new Class[]{String.class}; -        java.lang.reflect.Constructor constructor; +        Class<?>[] argTypes = new Class<?>[]{String.class}; +        java.lang.reflect.Constructor<?> constructor;          Object value;            public GenericEditor() { --- old/src/share/classes/javax/swing/JTextField.java   2014-07-02 23:35:06.000000000 -0700 +++ new/src/share/classes/javax/swing/JTextField.java   2014-07-02 23:35:05.000000000 -0700 @@ -587,7 +587,7 @@          }      }   -    private boolean isListener(Class c, ActionListener a) { +    private boolean isListener(Class<?> c, ActionListener a) {          boolean isListener = false;          Object[] listeners = listenerList.getListenerList();          for (int i = listeners.length-2; i>=0; i-=2) { --- old/src/share/classes/javax/swing/JTree.java        2014-07-02 23:35:06.000000000 -0700 +++ new/src/share/classes/javax/swing/JTree.java        2014-07-02 23:35:06.000000000 -0700 @@ -4032,7 +4032,7 @@          /**           * Subclassed to load the children, if necessary.           */ -        public Enumeration children() { +        public Enumeration<TreeNode> children() {              if(!loadedChildren)                  loadChildren();              return super.children(); --- old/src/share/classes/javax/swing/KeyboardManager.java      2014-07-02 23:35:09.000000000 -0700 +++ new/src/share/classes/javax/swing/KeyboardManager.java      2014-07-02 23:35:09.000000000 -0700 @@ -68,13 +68,13 @@      /**        * maps top-level containers to a sub-hashtable full of keystrokes        */ -    Hashtable<Container, Hashtable> containerMap = new Hashtable<Container, Hashtable>(); +    Hashtable<Container, Hashtable<Object, Object>> containerMap = new Hashtable<>();        /**        * Maps component/keystroke pairs to a topLevel container        * This is mainly used for fast unregister operations        */ -    Hashtable<ComponentKeyStrokePair, Container> componentKeyStrokeMap = new Hashtable<ComponentKeyStrokePair, Container>(); +    Hashtable<ComponentKeyStrokePair, Container> componentKeyStrokeMap = new Hashtable<>();        public static KeyboardManager getCurrentManager() {          return currentManager; @@ -95,7 +95,7 @@           if (topContainer == null) {               return;           } -         Hashtable keyMap = containerMap.get(topContainer); +         Hashtable<Object, Object> keyMap = containerMap.get(topContainer);             if (keyMap ==  null) {  // lazy evaluate one               keyMap = registerNewTopContainer(topContainer); @@ -105,7 +105,8 @@           if (tmp == null) {               keyMap.put(k,c);           } else if (tmp instanceof Vector) {  // if there's a Vector there then add to it. -             Vector v = (Vector)tmp; +             @SuppressWarnings("unchecked") +             Vector<Object> v = (Vector)tmp;               if (!v.contains(c)) {  // only add if this keystroke isn't registered for this component                   v.addElement(c);               } @@ -114,7 +115,7 @@             // Then add the old compoennt and the new compoent to the vector             // then insert the vector in the table             if (tmp != c) {  // this means this is already registered for this component, no need to dup -               Vector<JComponent> v = new Vector<JComponent>(); +               Vector<JComponent> v = new Vector<>();                 v.addElement((JComponent) tmp);                 v.addElement(c);                 keyMap.put(k, v); @@ -160,7 +161,7 @@               return;           }   -         Hashtable keyMap = containerMap.get(topContainer); +         Hashtable<Object, Object> keyMap = containerMap.get(topContainer);           if  (keyMap == null) { // this should never happen, but I'm being safe               Thread.dumpStack();               return; @@ -176,7 +177,7 @@               keyMap.remove(ks);  // remove the KeyStroke from the Map               //System.out.println("removed a stroke" + ks);           } else if (tmp instanceof Vector ) {  // this means there is more than one component reg for this key -             Vector v = (Vector)tmp; +             Vector<?> v = (Vector)tmp;               v.removeElement(c);               if ( v.isEmpty() ) {                   keyMap.remove(ks);  // remove the KeyStroke from the Map @@ -227,7 +228,7 @@                 ks=KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers(), !pressed);           }   -         Hashtable keyMap = containerMap.get(topAncestor); +         Hashtable<Object, Object> keyMap = containerMap.get(topAncestor);           if (keyMap != null) { // this container isn't registered, so bail                 Object tmp = null; @@ -250,7 +251,7 @@                       fireBinding(c, ks, e, pressed);                   }               } else if ( tmp instanceof Vector) { //more than one comp registered for this -                 Vector v = (Vector)tmp; +                 Vector<?> v = (Vector)tmp;                   // There is no well defined order for WHEN_IN_FOCUSED_WINDOW                   // bindings, but we give precedence to those bindings just                   // added. This is done so that JMenus WHEN_IN_FOCUSED_WINDOW @@ -279,11 +280,12 @@           // The're handled differently.  The key is to let any JMenuBars           // process the event           if ( keyMap != null) { -             Vector v = (Vector)keyMap.get(JMenuBar.class); +             @SuppressWarnings("unchecked") +             Vector<JMenuBar> v = (Vector)keyMap.get(JMenuBar.class);               if (v != null) { -                 Enumeration iter = v.elements(); +                 Enumeration<JMenuBar> iter = v.elements();                   while (iter.hasMoreElements()) { -                     JMenuBar mb = (JMenuBar)iter.nextElement(); +                     JMenuBar mb = iter.nextElement();                       if ( mb.isShowing() && mb.isEnabled() ) { // don't want to give these out                           boolean extended = (ksE != null) && !ksE.equals(ks);                           if (extended) { @@ -315,17 +317,18 @@          if (top == null) {              return;          } -        Hashtable keyMap = containerMap.get(top); +        Hashtable<Object, Object> keyMap = containerMap.get(top);            if (keyMap ==  null) {  // lazy evaluate one               keyMap = registerNewTopContainer(top);          }          // use the menubar class as the key -        Vector menuBars = (Vector)keyMap.get(JMenuBar.class); +        @SuppressWarnings("unchecked") +        Vector<Object> menuBars = (Vector)keyMap.get(JMenuBar.class);            if (menuBars == null) {  // if we don't have a list of menubars,                                   // then make one. -            menuBars = new Vector(); +            menuBars = new Vector<>();              keyMap.put(JMenuBar.class, menuBars);          }   @@ -340,9 +343,9 @@          if (topContainer == null) {              return;          } -        Hashtable keyMap = containerMap.get(topContainer); +        Hashtable<Object, Object> keyMap = containerMap.get(topContainer);          if (keyMap!=null) { -            Vector v = (Vector)keyMap.get(JMenuBar.class); +            Vector<?> v = (Vector)keyMap.get(JMenuBar.class);              if (v != null) {                  v.removeElement(mb);                  if (v.isEmpty()) { @@ -355,8 +358,8 @@              }          }      } -    protected Hashtable registerNewTopContainer(Container topContainer) { -             Hashtable keyMap = new Hashtable(); +    protected Hashtable<Object, Object> registerNewTopContainer(Container topContainer) { +             Hashtable<Object, Object> keyMap = new Hashtable<>();               containerMap.put(topContainer, keyMap);               return keyMap;      } --- old/src/share/classes/javax/swing/LayoutFocusTraversalPolicy.java   2014-07-02 23:35:10.000000000 -0700 +++ new/src/share/classes/javax/swing/LayoutFocusTraversalPolicy.java   2014-07-02 23:35:10.000000000 -0700 @@ -98,7 +98,7 @@          if (aContainer == null || aComponent == null) {              throw new IllegalArgumentException("aContainer and aComponent cannot be null");          } -        Comparator comparator = getComparator(); +        Comparator<? super Component> comparator = getComparator();          if (comparator instanceof LayoutComparator) {              ((LayoutComparator)comparator).                  setComponentOrientation(aContainer. @@ -134,7 +134,7 @@          if (aContainer == null || aComponent == null) {              throw new IllegalArgumentException("aContainer and aComponent cannot be null");          } -        Comparator comparator = getComparator(); +        Comparator<? super Component> comparator = getComparator();          if (comparator instanceof LayoutComparator) {              ((LayoutComparator)comparator).                  setComponentOrientation(aContainer. @@ -158,7 +158,7 @@          if (aContainer == null) {              throw new IllegalArgumentException("aContainer cannot be null");          } -        Comparator comparator = getComparator(); +        Comparator<? super Component> comparator = getComparator();          if (comparator instanceof LayoutComparator) {              ((LayoutComparator)comparator).                  setComponentOrientation(aContainer. @@ -182,7 +182,7 @@          if (aContainer == null) {              throw new IllegalArgumentException("aContainer cannot be null");          } -        Comparator comparator = getComparator(); +        Comparator<? super Component> comparator = getComparator();          if (comparator instanceof LayoutComparator) {              ((LayoutComparator)comparator).                  setComponentOrientation(aContainer. @@ -233,7 +233,7 @@              // to be focusable by returning true here.              return true;          } else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JComboBox")) { -            JComboBox box = (JComboBox)aComponent; +            JComboBox<?> box = (JComboBox)aComponent;              return box.getUI().isFocusTraversable(box);          } else if (aComponent instanceof JComponent) {              JComponent jComponent = (JComponent)aComponent; @@ -256,10 +256,11 @@          out.writeObject(getComparator());          out.writeBoolean(getImplicitDownCycleTraversal());      } +    @SuppressWarnings("unchecked") // Cast to (Comparator<? super Component>)      private void readObject(ObjectInputStream in)          throws IOException, ClassNotFoundException      { -        setComparator((Comparator)in.readObject()); +        setComparator((Comparator<? super Component>)in.readObject());          setImplicitDownCycleTraversal(in.readBoolean());      }  } --- old/src/share/classes/javax/swing/MenuSelectionManager.java 2014-07-02 23:35:11.000000000 -0700 +++ new/src/share/classes/javax/swing/MenuSelectionManager.java 2014-07-02 23:35:10.000000000 -0700 @@ -221,7 +221,6 @@          MenuElement menuElement;          MenuElement subElements[];
               MenuElement path[]; -        Vector<MenuElement> tmp;          int selectionSize;          p = event.getPoint();   @@ -250,7 +249,8 @@          screenX = p.x;          screenY = p.y;   -        tmp = (Vector<MenuElement>)selection.clone(); +        @SuppressWarnings("unchecked") +        Vector<MenuElement> tmp = (Vector<MenuElement>)selection.clone();          selectionSize = tmp.size();          boolean success = false;          for (i=selectionSize - 1;i >= 0 && success == false; i--) { @@ -385,7 +385,6 @@          int cWidth,cHeight;          MenuElement menuElement;          MenuElement subElements[]; -        Vector<MenuElement> tmp;          int selectionSize;            SwingUtilities.convertPointToScreen(p,source); @@ -393,7 +392,8 @@          screenX = p.x;          screenY = p.y;   -        tmp = (Vector<MenuElement>)selection.clone(); +        @SuppressWarnings("unchecked") +        Vector<MenuElement> tmp = (Vector<MenuElement>)selection.clone();          selectionSize = tmp.size();          for(i=selectionSize - 1 ; i >= 0 ; i--) {              menuElement = tmp.elementAt(i); --- old/src/share/classes/javax/swing/MultiUIDefaults.java      2014-07-02 23:35:11.000000000 -0700 +++ new/src/share/classes/javax/swing/MultiUIDefaults.java      2014-07-02 23:35:11.000000000 -0700 @@ -192,7 +192,7 @@      public synchronized String toString() {          StringBuilder sb = new StringBuilder();          sb.append("{"); -        Enumeration keys = keys(); +        Enumeration<?> keys = keys();          while (keys.hasMoreElements()) {              Object key = keys.nextElement();              sb.append(key + "=" + get(key) + ", "); --- old/src/share/classes/javax/swing/PopupFactory.java 2014-07-02 23:35:12.000000000 -0700 +++ new/src/share/classes/javax/swing/PopupFactory.java 2014-07-02 23:35:12.000000000 -0700 @@ -402,13 +402,14 @@           * <code>Window</code> to a <code>List</code> of           * <code>HeavyWeightPopup</code>s.           */ +        @SuppressWarnings("unchecked")          private static Map<Window, List<HeavyWeightPopup>> getHeavyWeightPopupCache() {              synchronized (HeavyWeightPopup.class) {                  Map<Window, List<HeavyWeightPopup>> cache = (Map<Window, List<HeavyWeightPopup>>)SwingUtilities.appContextGet(                                    heavyWeightPopupCacheKey);                    if (cache == null) { -                    cache = new HashMap<Window, List<HeavyWeightPopup>>(2); +                    cache = new HashMap<>(2);                      SwingUtilities.appContextPut(heavyWeightPopupCacheKey,                                                   cache);                  } @@ -699,11 +700,12 @@          /**           * Returns the cache to use for heavy weight popups.           */ +        @SuppressWarnings("unchecked")          private static List<LightWeightPopup> getLightWeightPopupCache() {              List<LightWeightPopup> cache = (List<LightWeightPopup>)SwingUtilities.appContextGet(                                     lightWeightPopupCacheKey);              if (cache == null) { -                cache = new ArrayList<LightWeightPopup>(); +                cache = new ArrayList<>();                  SwingUtilities.appContextPut(lightWeightPopupCacheKey, cache);              }              return cache; @@ -855,12 +857,13 @@          /**           * Returns the cache to use for medium weight popups.           */ +        @SuppressWarnings("unchecked")          private static List<MediumWeightPopup> getMediumWeightPopupCache() {              List<MediumWeightPopup> cache = (List<MediumWeightPopup>)SwingUtilities.appContextGet(                                      mediumWeightPopupCacheKey);                if (cache == null) { -                cache = new ArrayList<MediumWeightPopup>(); +                cache = new ArrayList<>();                  SwingUtilities.appContextPut(mediumWeightPopupCacheKey, cache);              }              return cache; --- old/src/share/classes/javax/swing/RowFilter.java    2014-07-02 23:35:13.000000000 -0700 +++ new/src/share/classes/javax/swing/RowFilter.java    2014-07-02 23:35:12.000000000 -0700 @@ -173,8 +173,7 @@       */      public static <M,I> RowFilter<M,I> regexFilter(String regex,                                                         int... indices) { -        return (RowFilter<M,I>)new RegexFilter(Pattern.compile(regex), -                                               indices); +        return new RegexFilter<M, I>(Pattern.compile(regex), indices);      }        /** @@ -201,7 +200,7 @@       */      public static <M,I> RowFilter<M,I> dateFilter(ComparisonType type,                                              Date date, int... indices) { -        return (RowFilter<M,I>)new DateFilter(type, date.getTime(), indices); +        return new DateFilter<M, I>(type, date.getTime(), indices);      }        /** @@ -224,7 +223,7 @@       */      public static <M,I> RowFilter<M,I> numberFilter(ComparisonType type,                                              Number number, int... indices) { -        return (RowFilter<M,I>)new NumberFilter(type, number, indices); +        return new NumberFilter<M, I>(type, number, indices);      }        /** @@ -397,7 +396,7 @@      }     -    private static abstract class GeneralFilter extends RowFilter<Object,Object> { +    private static abstract class GeneralFilter<M, I> extends RowFilter<M, I> {          private int[] columns;
       
               GeneralFilter(int[] columns) { @@ -405,7 +404,8 @@              this.columns = columns;          }   -        public boolean include(Entry<? extends Object,? extends Object> value){ +        @Override +        public boolean include(Entry<? extends M, ? extends I> value){              int count = value.getValueCount();              if (columns.length > 0) {                  for (int i = columns.length - 1; i >= 0; i--) { @@ -416,8 +416,7 @@                          }                      }                  } -            } -            else { +            } else {                  while (--count >= 0) {                      if (include(value, count)) {                          return true; @@ -428,11 +427,11 @@          }            protected abstract boolean include( -              Entry<? extends Object,? extends Object> value, int index); +              Entry<? extends M, ? extends I> value, int index);      }     -    private static class RegexFilter extends GeneralFilter { +    private static class RegexFilter<M, I> extends GeneralFilter<M, I> {          private Matcher matcher;            RegexFilter(Pattern regex, int[] columns) { @@ -443,15 +442,16 @@              matcher = regex.matcher("");          }   +        @Override          protected boolean include( -                Entry<? extends Object,? extends Object> value, int index) { +                Entry<? extends M, ? extends I> value, int index) {              matcher.reset(value.getStringValue(index));              return matcher.find();          }      }     -    private static class DateFilter extends GeneralFilter { +    private static class DateFilter<M, I> extends GeneralFilter<M, I> {          private long date;          private ComparisonType type;   @@ -464,8 +464,9 @@              this.date = date;          }   +        @Override          protected boolean include( -                Entry<? extends Object,? extends Object> value, int index) { +                Entry<? extends M, ? extends I> value, int index) {              Object v = value.getValue(index);                if (v instanceof Date) { @@ -487,10 +488,7 @@          }      }   - - - -    private static class NumberFilter extends GeneralFilter { +    private static class NumberFilter<M, I> extends GeneralFilter<M, I> {          private boolean isComparable;          private Number number;          private ComparisonType type; @@ -506,15 +504,16 @@              isComparable = (number instanceof Comparable);          }   +        @Override          @SuppressWarnings("unchecked")          protected boolean include( -                Entry<? extends Object,? extends Object> value, int index) { +                Entry<? extends M, ? extends I> value, int index) {              Object v = value.getValue(index);                if (v instanceof Number) {                  boolean compared = true;                  int compareResult; -                Class vClass = v.getClass(); +                Class<?> vClass = v.getClass();                  if (number.getClass() == vClass && isComparable) {                      compareResult = ((Comparable)number).compareTo(v);                  } --- old/src/share/classes/javax/swing/SpinnerDateModel.java     2014-07-02 23:35:13.000000000 -0700 +++ new/src/share/classes/javax/swing/SpinnerDateModel.java     2014-07-02 23:35:13.000000000 -0700 @@ -89,7 +89,7 @@  @SuppressWarnings("serial") // Superclass is not serializable across versions  public class SpinnerDateModel extends AbstractSpinnerModel implements Serializable  { -    private Comparable start, end; +    private Comparable<Date> start, end;      private Calendar value;      private int calendarField;   @@ -173,7 +173,7 @@       * @see #setEnd       * @see #setCalendarField       */ -    public SpinnerDateModel(Date value, Comparable start, Comparable end, int calendarField) { +    public SpinnerDateModel(Date value, Comparable<Date> start, Comparable<Date> end, int calendarField) {          if (value == null) {              throw new IllegalArgumentException("value is null");          } @@ -241,7 +241,7 @@       * @see #setEnd       * @see #addChangeListener       */ -    public void setStart(Comparable start) { +    public void setStart(Comparable<Date> start) {          if ((start == null) ? (this.start != null) : !start.equals(this.start)) {              this.start = start;              fireStateChanged(); @@ -255,7 +255,7 @@       * @return the value of the <code>start</code> property       * @see #setStart       */ -    public Comparable getStart() { +    public Comparable<Date> getStart() {          return start;      }   @@ -282,7 +282,7 @@       * @see #setStart       * @see #addChangeListener       */ -    public void setEnd(Comparable end) { +    public void setEnd(Comparable<Date> end) {          if ((end == null) ? (this.end != null) : !end.equals(this.end)) {              this.end = end;              fireStateChanged(); @@ -296,7 +296,7 @@       * @return the value of the <code>end</code> property       * @see #setEnd       */ -    public Comparable getEnd() { +    public Comparable<Date> getEnd() {          return end;      }   --- old/src/share/classes/javax/swing/SpinnerListModel.java     2014-07-02 23:35:14.000000000 -0700 +++ new/src/share/classes/javax/swing/SpinnerListModel.java     2014-07-02 23:35:13.000000000 -0700 @@ -59,7 +59,7 @@  @SuppressWarnings("serial") // Superclass is not serializable across versions  public class SpinnerListModel extends AbstractSpinnerModel implements Serializable  { -    private List list; +    private List<?> list;      private int index;     --- old/src/share/classes/javax/swing/SpinnerNumberModel.java   2014-07-02 23:35:14.000000000 -0700 +++ new/src/share/classes/javax/swing/SpinnerNumberModel.java   2014-07-02 23:35:14.000000000 -0700 @@ -84,7 +84,16 @@  public class SpinnerNumberModel extends AbstractSpinnerModel implements Serializable  {      private Number stepSize, value; -    private Comparable minimum, maximum; +    // Both minimum and maximum are logically Comparable<? extends +    // Number>, but that type is awkward to use since different +    // instances of Number are not naturally Comparable. For example, +    // a Double implements Comparable<Double> and an Integer +    // implements Comparable<Integer>. Neither Integer nor Double will +    // have a bridge method for Comparable<Number>. However, it safe +    // to cast Comparable<?> to Comparable<Object> since all +    // Comparables will have a compare(Object> method, possibly as a +    // bridge. +    private Comparable<?> minimum, maximum;          /** @@ -117,12 +126,16 @@       *     <code>null</code> or if the following expression is false:       *     <code>minimum &lt;= value &lt;= maximum</code>       */ -    public SpinnerNumberModel(Number value, Comparable minimum, Comparable maximum, Number stepSize) { +    @SuppressWarnings("unchecked") // Casts to Comparable<Object> +    public SpinnerNumberModel(Number value, +                               Comparable<?> minimum, +                               Comparable<?> maximum, +                               Number stepSize) {          if ((value == null) || (stepSize == null)) {              throw new IllegalArgumentException("value and stepSize must be non-null");          } -        if (!(((minimum == null) || (minimum.compareTo(value) <= 0)) && -              ((maximum == null) || (maximum.compareTo(value) >= 0)))) { +        if (!(((minimum == null) || (((Comparable<Object>)minimum).compareTo(value) <= 0)) && +              ((maximum == null) || (((Comparable<Object>)maximum).compareTo(value) >= 0)))) {              throw new IllegalArgumentException("(minimum <= value <= maximum) is false");          }          this.value = value; @@ -212,7 +225,7 @@       * @see #setMaximum       * @see SpinnerModel#addChangeListener       */ -    public void setMinimum(Comparable minimum) { +    public void setMinimum(Comparable<?> minimum) {          if ((minimum == null) ? (this.minimum != null) : !minimum.equals(this.minimum)) {              this.minimum = minimum;              fireStateChanged(); @@ -226,7 +239,7 @@       * @return the value of the <code>minimum</code> property       * @see #setMinimum       */ -    public Comparable getMinimum() { +    public Comparable<?> getMinimum() {          return minimum;      }   @@ -259,7 +272,7 @@       * @see #setMinimum       * @see SpinnerModel#addChangeListener       */ -    public void setMaximum(Comparable maximum) { +    public void setMaximum(Comparable<?> maximum) {          if ((maximum == null) ? (this.maximum != null) : !maximum.equals(this.maximum)) {              this.maximum = maximum;              fireStateChanged(); @@ -273,7 +286,7 @@       * @return the value of the <code>maximum</code> property       * @see #setMaximum       */ -    public Comparable getMaximum() { +    public Comparable<?> getMaximum() {          return maximum;      }   @@ -317,7 +330,7 @@          return stepSize;      }   - +    @SuppressWarnings("unchecked") // Casts to Comparable<Object>      private Number incrValue(int dir)      {          Number newValue; @@ -329,8 +342,7 @@              else {                  newValue = new Float(v);              } -        } -        else { +        } else {              long v = value.longValue() + (stepSize.longValue() * (long)dir);                if (value instanceof Long) { @@ -347,10 +359,10 @@              }          }   -        if ((maximum != null) && (maximum.compareTo(newValue) < 0)) { +        if ((maximum != null) && (((Comparable<Object>)maximum).compareTo(newValue) < 0)) {              return null;          } -        if ((minimum != null) && (minimum.compareTo(newValue) > 0)) { +        if ((minimum != null) && (((Comparable<Object>)minimum).compareTo(newValue) > 0)) {              return null;          }          else { --- old/src/share/classes/javax/swing/SpringLayout.java 2014-07-02 23:35:15.000000000 -0700 +++ new/src/share/classes/javax/swing/SpringLayout.java 2014-07-02 23:35:15.000000000 -0700 @@ -495,7 +495,7 @@              };          }   -        private boolean defined(List history, String s1, String s2) { +        private boolean defined(List<?> history, String s1, String s2) {              return history.contains(s1) && history.contains(s2);          }   --- old/src/share/classes/javax/swing/SwingWorker.java  2014-07-02 23:35:16.000000000 -0700 +++ new/src/share/classes/javax/swing/SwingWorker.java  2014-07-02 23:35:15.000000000 -0700 @@ -820,7 +820,9 @@                  doSubmit = new DoSubmitAccumulativeRunnable();                  appContext.put(DO_SUBMIT_KEY, doSubmit);              } -            return (AccumulativeRunnable<Runnable>) doSubmit; +            @SuppressWarnings("unchecked") +            AccumulativeRunnable<Runnable> tmp = (AccumulativeRunnable<Runnable>) doSubmit; +            return tmp;          }      }      private static class DoSubmitAccumulativeRunnable --- old/src/share/classes/javax/swing/UIDefaults.java   2014-07-02 23:35:16.000000000 -0700 +++ new/src/share/classes/javax/swing/UIDefaults.java   2014-07-02 23:35:16.000000000 -0700 @@ -311,10 +311,10 @@                      } else {                          b = ResourceBundle.getBundle(bundleName, l);                      } -                    Enumeration keys = b.getKeys(); +                    Enumeration<String> keys = b.getKeys();                        while (keys.hasMoreElements()) { -                        String key = (String)keys.nextElement(); +                        String key = keys.nextElement();                            if (values.get(key) == null) {                              Object value = b.getObject(key); @@ -682,7 +682,7 @@              if (className != null) {                  ReflectUtil.checkPackageAccess(className);   -                Class cls = (Class)get(className); +                Class<?> cls = (Class)get(className);                  if (cls == null) {                      if (uiClassLoader == null) {                          cls = SwingUtilities.loadSystemClass(className); @@ -695,13 +695,12 @@                          put(className, cls);                      }                  } -                return cls; +                @SuppressWarnings("unchecked") +                Class<? extends ComponentUI> tmp = (Class<? extends ComponentUI>)cls; +                return tmp;              }          } -        catch (ClassNotFoundException e) { -            return null; -        } -        catch (ClassCastException e) { +        catch (ClassNotFoundException | ClassCastException e) {              return null;          }          return null; @@ -767,7 +766,7 @@              try {                  Method m = (Method)get(uiClass);                  if (m == null) { -                    m = uiClass.getMethod("createUI", new Class[]{JComponent.class}); +                    m = uiClass.getMethod("createUI", new Class<?>[]{JComponent.class});                      put(uiClass, m);                  }                  uiObject = MethodUtil.invoke(m, null, new Object[]{target}); @@ -1106,12 +1105,12 @@                          c = Class.forName(className, true, (ClassLoader)cl);                          SwingUtilities2.checkAccess(c.getModifiers());                          if (methodName != null) { -                            Class[] types = getClassArray(args);
      +                            Class<?>[] types = getClassArray(args);                              Method m = c.getMethod(methodName, types);                              return MethodUtil.invoke(m, c, args);                          } else { -                            Class[] types = getClassArray(args);
      •                            Constructor constructor = c.getConstructor(types);
        +                            Class<?>[]
      types = getClassArray(args); +                            Constructor<?> constructor = c.getConstructor(types);                              SwingUtilities2.checkAccess(constructor.getModifiers());                              return constructor.newInstance(args);                          } @@ -1134,10 +1133,10 @@           * and superclasses for subclasses used to add the           * <code>UIResource</code> tag.           */ -        private Class[] getClassArray(Object[] args) { -            Class[] types = null;
      +        private Class<?>[] getClassArray(Object[] args) {
      +            Class<?>[] types = null;              if (args!=null) { -                types = new Class[args.length]; +                types = new Class<?>[args.length];                  for (int i = 0; i< args.length; i++) {                      /* PENDING(ges): At present only the primitive types                         used are handled correctly; this should eventually --- old/src/share/classes/javax/swing/UIManager.java    2014-07-02 23:35:17.000000000 -0700 +++ new/src/share/classes/javax/swing/UIManager.java    2014-07-02 23:35:17.000000000 -0700 @@ -581,7 +581,7 @@              setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());          }          else { -            Class lnfClass = SwingUtilities.loadSystemClass(className); +            Class<?> lnfClass = SwingUtilities.loadSystemClass(className);              setLookAndFeel((LookAndFeel)(lnfClass.newInstance()));          }      } @@ -1049,7 +1049,7 @@              String defaultName = "javax.swing.plaf.multi.MultiLookAndFeel";              String className = getLAFState().swingProps.getProperty(multiplexingLAFKey, defaultName);              try { -                Class lnfClass = SwingUtilities.loadSystemClass(className); +                Class<?> lnfClass = SwingUtilities.loadSystemClass(className);                  multiLookAndFeel = (LookAndFeel)lnfClass.newInstance();              } catch (Exception exc) {                  System.err.println("UIManager: failed loading " + className); @@ -1337,10 +1337,11 @@          // Try to get default LAF from system property, then from AppContext          // (6653395), then use cross-platform one by default.          String lafName = null; -        HashMap lafData = +        @SuppressWarnings("unchecked") +        HashMap<Object, String> lafData =                  (HashMap) AppContext.getAppContext().remove("swing.lafdata");          if (lafData != null) { -            lafName = (String) lafData.remove("defaultlaf"); +            lafName = lafData.remove("defaultlaf");          }          if (lafName == null) {              lafName = getCrossPlatformLookAndFeelClassName(); @@ -1380,7 +1381,7 @@          while (p.hasMoreTokens()) {              String className = p.nextToken();              try { -                Class lnfClass = SwingUtilities.loadSystemClass(className); +                Class<?> lnfClass = SwingUtilities.loadSystemClass(className);                  LookAndFeel newLAF = (LookAndFeel)lnfClass.newInstance();                  newLAF.initialize();                  auxLookAndFeels.addElement(newLAF); --- old/src/share/classes/javax/swing/event/EventListenerList.java      2014-07-02 23:35:17.000000000 -0700 +++ new/src/share/classes/javax/swing/event/EventListenerList.java      2014-07-02 23:35:17.000000000 -0700 @@ -141,11 +141,14 @@      public <T extends EventListener> T[] getListeners(Class<T> t) {
               Object[] lList = listenerList;          int n = getListenerCount(lList, t); +        @SuppressWarnings("unchecked")          T[] result = (T[])Array.newInstance(t, n);          int j = 0;          for (int i = lList.length-2; i>=0; i-=2) {              if (lList[i] == t) { -                result[j++] = (T)lList[i+1]; +                @SuppressWarnings("unchecked") +                T tmp = (T)lList[i+1]; +                result[j++] = tmp;              }          }          return result; @@ -172,7 +175,7 @@          return getListenerCount(lList, t);      }   -    private int getListenerCount(Object[] list, Class t) { +    private int getListenerCount(Object[] list, Class<?> t) {          int count = 0;          for (int i = 0; i < list.length; i+=2) {              if (t == (Class)list[i]) @@ -288,7 +291,9 @@              EventListener l = (EventListener)s.readObject();              String name = (String) listenerTypeOrNull;              ReflectUtil.checkPackageAccess(name); -            add((Class<EventListener>)Class.forName(name, true, cl), l); +            @SuppressWarnings("unchecked") +            Class<EventListener> tmp = (Class<EventListener>)Class.forName(name, true, cl); +            add(tmp, l);          }      }   --- old/src/share/classes/javax/swing/event/RowSorterEvent.java 2014-06-30 09:09:36.000000000 -0700 +++ new/src/share/classes/javax/swing/event/RowSorterEvent.java 2014-06-30 09:09:36.000000000 -0700 @@ -71,7 +71,7 @@       * @throws IllegalArgumentException if <code>source</code> is       *         <code>null</code>       */ -    public RowSorterEvent(RowSorter source) { +    public RowSorterEvent(RowSorter<?> source) {          this(source, Type.SORT_ORDER_CHANGED, null);      }   @@ -85,7 +85,7 @@       * @throws IllegalArgumentException if source or <code>type</code> is       *         <code>null</code>       */ -    public RowSorterEvent(RowSorter source, Type type, +    public RowSorterEvent(RowSorter<?> source, Type type,                            int[] previousRowIndexToModel) {          super(source);          if (type == null) { @@ -100,7 +100,8 @@       *       * @return the source of the event as a <code>RowSorter</code>       */ -    public RowSorter getSource() { +    @Override +    public RowSorter<?> getSource() {          return (RowSorter)super.getSource();      }   --- old/src/share/classes/javax/swing/table/DefaultTableModel.java      2014-06-30 09:10:33.000000000 -0700 +++ new/src/share/classes/javax/swing/table/DefaultTableModel.java      2014-06-30 09:10:33.000000000 -0700 @@ -70,10 +70,10 @@       * The <code>Vector</code> of <code>Vectors</code> of       * <code>Object</code> values.       */ -    protected Vector    dataVector; +    protected Vector<Vector<Object>>    dataVector;        /** The <code>Vector</code> of column identifiers. */ -    protected Vector    columnIdentifiers; +    protected Vector<Object>    columnIdentifiers;    //  // Constructors @@ -121,7 +121,7 @@       * @see #setDataVector       * @see #setValueAt       */ -    public DefaultTableModel(Vector columnNames, int rowCount) { +    public DefaultTableModel(Vector<Object> columnNames, int rowCount) {          setDataVector(newVector(rowCount), columnNames);      }   @@ -156,7 +156,7 @@       * @see #getDataVector       * @see #setDataVector       */ -    public DefaultTableModel(Vector data, Vector columnNames) { +    public DefaultTableModel(Vector<Vector<Object>> data, Vector<Object> columnNames) {          setDataVector(data, columnNames);      }   @@ -191,12 +191,12 @@       * @see #newRowsAdded       * @see #setDataVector       */ -    public Vector getDataVector() { +    public Vector<Vector<Object>> getDataVector() {          return dataVector;      } @@ -219,7 +219,8 @@       * @param   columnIdentifiers     the names of the columns       * @see #getDataVector       */ -    public void setDataVector(Vector dataVector, Vector columnIdentifiers) { +    public void setDataVector(Vector<Vector<Object>> dataVector, +                              Vector<Object> columnIdentifiers) {          this.dataVector = nonNullVector(dataVector);          this.columnIdentifiers = nonNullVector(columnIdentifiers);          justifyRows(0, getRowCount()); @@ -347,7 +348,7 @@       *       * @param   rowData          optional data of the row being added       */ -    public void addRow(Vector rowData) { +    public void addRow(Vector<Object> rowData) {          insertRow(getRowCount(), rowData);      }   @@ -371,7 +372,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<Object> rowData) {          dataVector.insertElementAt(rowData, row);          justifyRows(row, row+1);          fireTableRowsInserted(row, row); @@ -481,7 +482,7 @@       *                          to zero columns       * @see #setNumRows       */ -    public void setColumnIdentifiers(Vector columnIdentifiers) { +    public void setColumnIdentifiers(Vector<Object> columnIdentifiers) {          setDataVector(dataVector, columnIdentifiers);      } @@ -547,7 +548,7 @@       * @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) { +    public void addColumn(Object columnName, Vector<Object> columnData) {          columnIdentifiers.addElement(columnName);          if (columnData != null) {              int columnSize = columnData.size(); @@ -677,11 +678,11 @@       * @return  the new vector; if <code>anArray</code> is <code>null</code>,       *                          returns <code>null</code>       */ -    protected static Vector convertToVector(Object[] anArray) {
      +    protected static Vector<Object> convertToVector(Object[] anArray) {          if (anArray == null) {              return null;          } @@ -694,11 +695,11 @@       * @return the new vector of vectors; if <code>anArray</code> is       *                          <code>null</code>, returns <code>null</code>       */ -    protected static Vector convertToVector(Object[][] anArray) { +    protected static Vector<Vector<Object>> convertToVector(Object[][] anArray) {          if (anArray == null) {              return null; --- old/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java  2014-06-30 09:10:36.000000000 -0700 +++ new/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java  2014-06-30 09:10:35.000000000 -0700 @@ -102,7 +102,7 @@      protected MutableTreeNode   parent;        /** array of children, may be null if this node has no children */ -    protected Vector children; +    protected Vector<TreeNode> children;        /** optional user object */      transient protected Object  userObject; @@ -290,7 +290,7 @@       *       * @return  an Enumeration of this node's children       */ -    public Enumeration children() { +    public Enumeration<TreeNode> children() {          if (children == null) {              return EMPTY_ENUMERATION;          } else { @@ -765,7 +765,7 @@       * @see     #postorderEnumeration       * @return  an enumeration for traversing the tree in preorder       */ -    public Enumeration preorderEnumeration() { +    public Enumeration<TreeNode> preorderEnumeration() {          return new PreorderEnumeration(this);      }   @@ -782,7 +782,7 @@       * @see     #preorderEnumeration       * @return  an enumeration for traversing the tree in postorder       */ -    public Enumeration postorderEnumeration() { +    public Enumeration<TreeNode> postorderEnumeration() {          return new PostorderEnumeration(this);      }   @@ -797,7 +797,7 @@       * @see     #depthFirstEnumeration       * @return  an enumeration for traversing the tree in breadth-first order       */ -    public Enumeration breadthFirstEnumeration() { +    public Enumeration<TreeNode> breadthFirstEnumeration() {          return new BreadthFirstEnumeration(this);      }   @@ -814,7 +814,7 @@       * @see     #postorderEnumeration       * @return  an enumeration for traversing the tree in depth-first order       */ -    public Enumeration depthFirstEnumeration() { +    public Enumeration<TreeNode> depthFirstEnumeration() {          return postorderEnumeration();      }   @@ -839,7 +839,7 @@       * @return  an enumeration for following the path from an ancestor of       *          this node to this one       */ -    public Enumeration pathFromAncestorEnumeration(TreeNode ancestor) { +    public Enumeration<TreeNode> pathFromAncestorEnumeration(TreeNode ancestor) {          return new PathBetweenNodesEnumeration(ancestor, this);      } @@ -1099,7 +1099,8 @@           * If the receiver is not currently expanded, this will return an           * empty enumeration.           */ -        public Enumeration children() { +        @Override +        public Enumeration<TreeNode> children() {              if (!this.isExpanded()) {                  return DefaultMutableTreeNode.EMPTY_ENUMERATION;              } else { @@ -1405,7 +1406,7 @@           * <code>createIfNeeded</code> is true, the children are first           * loaded.           */ -        protected Enumeration getLoadedChildren(boolean createIfNeeded) { +        protected Enumeration<TreeNode> getLoadedChildren(boolean createIfNeeded) {              if(!createIfNeeded || hasBeenExpanded)                  return super.children();

            darcy Joe Darcy
            darcy Joe Darcy
            Petr Pchelko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: