Index: src/main/java/common/javax/swing/AbstractListModel.java =================================================================== --- src/main/java/common/javax/swing/AbstractListModel.java (revision 453165) +++ src/main/java/common/javax/swing/AbstractListModel.java (working copy) @@ -44,7 +44,7 @@ return (ListDataListener[])getListeners(ListDataListener.class); } - public EventListener[] getListeners(final Class listenerType) { + public T[] getListeners(final Class listenerType) { return listenerList.getListeners(listenerType); } Index: src/main/java/common/javax/swing/AbstractSpinnerModel.java =================================================================== --- src/main/java/common/javax/swing/AbstractSpinnerModel.java (revision 453165) +++ src/main/java/common/javax/swing/AbstractSpinnerModel.java (working copy) @@ -58,7 +58,7 @@ } } - public EventListener[] getListeners(final Class listenerType) { + public T[] getListeners(final Class listenerType) { return listenerList.getListeners(listenerType); } } Index: src/main/java/common/javax/swing/ButtonGroup.java =================================================================== --- src/main/java/common/javax/swing/ButtonGroup.java (revision 453165) +++ src/main/java/common/javax/swing/ButtonGroup.java (working copy) @@ -26,7 +26,7 @@ public class ButtonGroup implements Serializable { - protected Vector buttons = new Vector(); + protected Vector buttons = new Vector(); private ButtonModel selection; @@ -52,7 +52,7 @@ return buttons.size(); } - public Enumeration getElements() { + public Enumeration getElements() { return buttons.elements(); } Index: src/main/java/common/javax/swing/DefaultBoundedRangeModel.java =================================================================== --- src/main/java/common/javax/swing/DefaultBoundedRangeModel.java (revision 453165) +++ src/main/java/common/javax/swing/DefaultBoundedRangeModel.java (working copy) @@ -86,7 +86,7 @@ return extent; } - public EventListener[] getListeners(final Class c) { + public T[] getListeners(final Class c) { return listenerList.getListeners(c); } Index: src/main/java/common/javax/swing/DefaultButtonModel.java =================================================================== --- src/main/java/common/javax/swing/DefaultButtonModel.java (revision 453165) +++ src/main/java/common/javax/swing/DefaultButtonModel.java (working copy) @@ -46,7 +46,7 @@ protected EventListenerList listenerList = new EventListenerList(); - public EventListener[] getListeners(final Class listenersClass) { + public T[] getListeners(final Class listenersClass) { return listenerList.getListeners(listenersClass); } Index: src/main/java/common/javax/swing/DefaultComboBoxModel.java =================================================================== --- src/main/java/common/javax/swing/DefaultComboBoxModel.java (revision 453165) +++ src/main/java/common/javax/swing/DefaultComboBoxModel.java (working copy) @@ -42,7 +42,7 @@ } } - public DefaultComboBoxModel(final Vector items) { + public DefaultComboBoxModel(final Vector items) { listData = items; if (items.size() > 0) { selection = items.get(0); Index: src/main/java/common/javax/swing/DefaultListModel.java =================================================================== --- src/main/java/common/javax/swing/DefaultListModel.java (revision 453165) +++ src/main/java/common/javax/swing/DefaultListModel.java (working copy) @@ -62,7 +62,7 @@ return internalStorage.elementAt(index); } - public Enumeration elements() { + public Enumeration elements() { return internalStorage.elements(); } Index: src/main/java/common/javax/swing/DefaultListSelectionModel.java =================================================================== --- src/main/java/common/javax/swing/DefaultListSelectionModel.java (revision 453165) +++ src/main/java/common/javax/swing/DefaultListSelectionModel.java (working copy) @@ -365,7 +365,7 @@ return (ListSelectionListener[])getListeners(ListSelectionListener.class); } - public EventListener[] getListeners(final Class listenerType) { + public T[] getListeners(final Class listenerType) { return listenerList.getListeners(listenerType); } Index: src/main/java/common/javax/swing/DefaultSingleSelectionModel.java =================================================================== --- src/main/java/common/javax/swing/DefaultSingleSelectionModel.java (revision 453165) +++ src/main/java/common/javax/swing/DefaultSingleSelectionModel.java (working copy) @@ -61,7 +61,7 @@ listenerList.remove(ChangeListener.class, l); } - public EventListener[] getListeners(final Class listenerType) { + public T[] getListeners(final Class listenerType) { return listenerList.getListeners(listenerType); } Index: src/main/java/common/javax/swing/event/EventListenerList.java =================================================================== --- src/main/java/common/javax/swing/event/EventListenerList.java (revision 453165) +++ src/main/java/common/javax/swing/event/EventListenerList.java (working copy) @@ -32,7 +32,10 @@ protected transient Object[] listenerList = new Object[0]; - public synchronized void remove(final Class listenerClass, final EventListener listener) { + public synchronized void remove( + final Class listenerClass, + final T listener + ) { if (listener == null) { return; } @@ -54,7 +57,10 @@ } } - public synchronized void add(final Class listenerClass, final EventListener listener) { + public synchronized void add( + final Class listenerClass, + final T listener + ) { if (listener == null) { return; } @@ -67,16 +73,16 @@ listenerList = newList; } - public EventListener[] getListeners(final Class listenerClass) { + public T[] getListeners(final Class listenerClass) { int numClassListeners = getListenerCount(listenerClass); - EventListener[] listeners = (EventListener[]) (Array.newInstance( + T[] listeners = (T[]) (Array.newInstance( listenerClass, numClassListeners)); if (numClassListeners > 0) { for (int innerIndex = 0, outerIndex = 0; outerIndex < numClassListeners; innerIndex += 2) { if (listenerList[innerIndex] == listenerClass) { - listeners[numClassListeners - 1 - outerIndex] = (EventListener) listenerList[innerIndex + 1]; + listeners[numClassListeners - 1 - outerIndex] = (T) listenerList[innerIndex + 1]; ++outerIndex; } } @@ -106,7 +112,7 @@ return listenerList; } - public int getListenerCount(final Class listenerClass) { + public int getListenerCount(final Class listenerClass) { int counter = 0; for (int i = 0; i < listenerList.length; i += 2){ if (listenerList[i] == listenerClass) { Index: src/main/java/common/javax/swing/JComboBox.java =================================================================== --- src/main/java/common/javax/swing/JComboBox.java (revision 453165) +++ src/main/java/common/javax/swing/JComboBox.java (working copy) @@ -175,7 +175,7 @@ public JComboBox(final Object[] items) { this(new DefaultComboBoxModel(items)); } - public JComboBox(final Vector items) { + public JComboBox(final Vector items) { this(new DefaultComboBoxModel(items)); } Index: src/main/java/common/javax/swing/JComponent.java =================================================================== --- src/main/java/common/javax/swing/JComponent.java (revision 453165) +++ src/main/java/common/javax/swing/JComponent.java (working copy) @@ -480,8 +480,8 @@ vetoableChangeSupport.fireVetoableChange(property, oldValue, newValue); } - public EventListener[] getListeners(final Class listenersClass) { - EventListener[] result = super.getListeners(listenersClass); + public T[] getListeners(final Class listenersClass) { + T[] result = super.getListeners(listenersClass); if (!Utilities.isEmptyArray(result)) { return result; } @@ -492,7 +492,7 @@ } if (VetoableChangeListener.class.isAssignableFrom(listenersClass)) { - result = getVetoableChangeListeners(); + result = (T[]) getVetoableChangeListeners(); } return result; } Index: src/main/java/common/javax/swing/JLayeredPane.java =================================================================== --- src/main/java/common/javax/swing/JLayeredPane.java (revision 453165) +++ src/main/java/common/javax/swing/JLayeredPane.java (working copy) @@ -57,7 +57,7 @@ /** * The hash table used to store layers for components. */ - private Hashtable componentToLayer; + private Hashtable componentToLayer; static { DEFAULT_LAYER = new Integer(DELAULT_LAYER_NUMBER); @@ -148,9 +148,9 @@ */ //XXX: 1.5 migration: uncomment //protected Hashtable getComponentToLayer() - protected Hashtable getComponentToLayer() { + protected Hashtable getComponentToLayer() { if (componentToLayer == null) { - componentToLayer = new Hashtable(); + componentToLayer = new Hashtable(); } return componentToLayer; Index: src/main/java/common/javax/swing/JList.java =================================================================== --- src/main/java/common/javax/swing/JList.java (revision 453165) +++ src/main/java/common/javax/swing/JList.java (working copy) @@ -388,7 +388,7 @@ putListData((DefaultListModel)getModel(), listData); } - public JList(final Vector listData) { + public JList(final Vector listData) { this(new DefaultListModel()); putListData((DefaultListModel)getModel(), listData); } @@ -443,7 +443,7 @@ } - public void setListData(final Vector listData) { + public void setListData(final Vector listData) { DefaultListModel defaultModel = new DefaultListModel(); putListData(defaultModel, listData); Index: src/main/java/common/javax/swing/JTable.java =================================================================== --- src/main/java/common/javax/swing/JTable.java (revision 453165) +++ src/main/java/common/javax/swing/JTable.java (working copy) @@ -609,8 +609,8 @@ } } - private Class getColumnClass() { - Class columnClass = JTable.this.getColumnClass(getEditingColumn()); + private Class getColumnClass() { + Class columnClass = JTable.this.getColumnClass(getEditingColumn()); return columnClass == Object.class ? String.class : columnClass; } } @@ -893,7 +893,7 @@ } } - public void setDefaultRenderer(final Class columnClass, final TableCellRenderer renderer) { + public void setDefaultRenderer(final Class columnClass, final TableCellRenderer renderer) { if (renderer != null) { defaultRenderersByColumnClass.put(columnClass, renderer); } else { @@ -901,11 +901,11 @@ } } - public TableCellRenderer getDefaultRenderer(final Class columnClass) { + public TableCellRenderer getDefaultRenderer(final Class columnClass) { return (TableCellRenderer)getClosestClass(columnClass, defaultRenderersByColumnClass); } - public void setDefaultEditor(final Class columnClass, final TableCellEditor editor) { + public void setDefaultEditor(final Class columnClass, final TableCellEditor editor) { if (editor != null) { defaultEditorsByColumnClass.put(columnClass, editor); } else { @@ -913,7 +913,7 @@ } } - public TableCellEditor getDefaultEditor(final Class columnClass) { + public TableCellEditor getDefaultEditor(final Class columnClass) { return (TableCellEditor)getClosestClass(columnClass, defaultEditorsByColumnClass); } Index: src/main/java/common/javax/swing/JTree.java =================================================================== --- src/main/java/common/javax/swing/JTree.java (revision 453165) +++ src/main/java/common/javax/swing/JTree.java (working copy) @@ -588,13 +588,13 @@ setShowsRootHandles(true); } - public JTree(final Vector value) { + public JTree(final Vector value) { this(createTreeModel(value)); setRootVisible(false); setShowsRootHandles(true); } - public JTree(final Hashtable value) { + public JTree(final Hashtable value) { this(createTreeModel(value)); setRootVisible(false); setShowsRootHandles(true); @@ -906,7 +906,7 @@ return getSelectionModel().isRowSelected(row); } - public Enumeration getExpandedDescendants(final TreePath parent) { + public Enumeration getExpandedDescendants(final TreePath parent) { final Enumeration toggled = getDescendantToggledPaths(parent); if (toggled == null) { return null; @@ -1355,7 +1355,7 @@ getSelectionModel().resetRowSelection(); } - protected Enumeration getDescendantToggledPaths(final TreePath parent) { + protected Enumeration getDescendantToggledPaths(final TreePath parent) { if (parent == null) { return null; } @@ -1390,7 +1390,7 @@ }; } - protected void removeDescendantToggledPaths(final Enumeration toRemove) { + protected void removeDescendantToggledPaths(final Enumeration toRemove) { if (toRemove == null) { return; } Index: src/main/java/common/javax/swing/LookAndFeel.java =================================================================== --- src/main/java/common/javax/swing/LookAndFeel.java (revision 453165) +++ src/main/java/common/javax/swing/LookAndFeel.java (working copy) @@ -107,7 +107,7 @@ } } - public static Object makeIcon(final Class c, final String path) { + public static Object makeIcon(final Class c, final String path) { return new UIDefaults.LazyValue() { public Object createValue(final UIDefaults uiDefaults) { URL resource = c.getResource(path); Index: src/main/java/common/javax/swing/plaf/basic/BasicDirectoryModel.java =================================================================== --- src/main/java/common/javax/swing/plaf/basic/BasicDirectoryModel.java (revision 453165) +++ src/main/java/common/javax/swing/plaf/basic/BasicDirectoryModel.java (working copy) @@ -34,25 +34,28 @@ import javax.swing.filechooser.FileFilter; public class BasicDirectoryModel extends AbstractListModel implements PropertyChangeListener { - private Vector fileList; + private Vector fileList; private JFileChooser fc; - private final Comparator fileComparator = new Comparator() { - public int compare(final Object o1, final Object o2) { - File file1 = (File)o1; - File file2 = (File)o2; + private final Comparator fileComparator = new Comparator() { + public int compare(final File o1, final File o2) { + return lt(o1, o2) ? -1 : 1; + } + }; - return lt(file1, file2) ? -1 : 1; + private final class FileComparator implements Comparator { + public int compare(final T o1, final T o2) { + return lt(o1, o2) ? -1 : 1; } }; - public Vector getFiles() { + public Vector getFiles() { return fileList; } public BasicDirectoryModel(final JFileChooser filechooser) { fc = filechooser; fc.addPropertyChangeListener(this); - fileList = new Vector(); + fileList = new Vector(); } public Object getElementAt(final int index) { @@ -76,7 +79,7 @@ public void invalidateFileCache() { } - public Vector getDirectories() { + public Vector getDirectories() { return null; } @@ -139,7 +142,7 @@ public void intervalRemoved(final ListDataEvent e) { } - protected void sort(final Vector v) { + protected void sort(final Vector v) { Collections.sort(v, fileComparator); } Index: src/main/java/common/javax/swing/plaf/basic/BasicFileChooserUI.java =================================================================== --- src/main/java/common/javax/swing/plaf/basic/BasicFileChooserUI.java (revision 453165) +++ src/main/java/common/javax/swing/plaf/basic/BasicFileChooserUI.java (working copy) @@ -76,7 +76,7 @@ } protected class BasicFileView extends FileView { - protected Hashtable iconCache = new Hashtable(); + protected Hashtable iconCache = new Hashtable(); public BasicFileView() { } Index: src/main/java/common/javax/swing/plaf/basic/BasicTreeUI.java =================================================================== --- src/main/java/common/javax/swing/plaf/basic/BasicTreeUI.java (revision 453165) +++ src/main/java/common/javax/swing/plaf/basic/BasicTreeUI.java (working copy) @@ -624,7 +624,7 @@ protected CellRendererPane rendererPane; protected Dimension preferredSize; protected AbstractLayoutCache treeState; - protected Hashtable drawingCache; + protected Hashtable drawingCache; protected AbstractLayoutCache.NodeDimensions nodeDimensions; protected TreeModel treeModel; protected TreeSelectionModel treeSelectionModel; @@ -1011,7 +1011,7 @@ protected void prepareForUIInstall() { preferredSize = new Dimension(); - drawingCache = new Hashtable(); + drawingCache = new Hashtable(); treeState = createLayoutCache(); nodeDimensions = createNodeDimensions(); Index: src/main/java/common/javax/swing/SortingFocusTraversalPolicy.java =================================================================== --- src/main/java/common/javax/swing/SortingFocusTraversalPolicy.java (revision 453165) +++ src/main/java/common/javax/swing/SortingFocusTraversalPolicy.java (working copy) @@ -30,7 +30,7 @@ import java.util.List; public class SortingFocusTraversalPolicy extends InternalFrameFocusTraversalPolicy { - private Comparator comparator; + private Comparator comparator; private boolean isImplicitDownCycleTraversal = true; private final NextComponentFinder afterComponentFinder = new NextComponentFinder() { @@ -118,7 +118,7 @@ } }; - public SortingFocusTraversalPolicy(final Comparator comparator) { + public SortingFocusTraversalPolicy(final Comparator comparator) { setComparator(comparator); } @@ -164,11 +164,11 @@ return isImplicitDownCycleTraversal; } - protected void setComparator(final Comparator c) { + protected void setComparator(final Comparator c) { comparator = c; } - protected Comparator getComparator() { + protected Comparator getComparator() { return comparator; } Index: src/main/java/common/javax/swing/SpinnerListModel.java =================================================================== --- src/main/java/common/javax/swing/SpinnerListModel.java (revision 453165) +++ src/main/java/common/javax/swing/SpinnerListModel.java (working copy) @@ -26,14 +26,14 @@ public class SpinnerListModel extends AbstractSpinnerModel implements Serializable { private static final String[] DEFAULT_VALUES = {"empty"}; - private List values; + private List values; private int index = 0; public SpinnerListModel() { this(Arrays.asList(DEFAULT_VALUES)); } - public SpinnerListModel(final List values) { + public SpinnerListModel(final List values) { if (values == null || values.size() <= 0) { throw new IllegalArgumentException("SpinnerListModel(List) expects non-null non-empty List"); } @@ -47,11 +47,11 @@ this.values = Arrays.asList(values); } - public List getList() { + public List getList() { return values; } - public void setList(final List list) { + public void setList(final List list) { if (list == null || list.size() <= 0) { throw new IllegalArgumentException(""); } Index: src/main/java/common/javax/swing/SwingUtilities.java =================================================================== --- src/main/java/common/javax/swing/SwingUtilities.java (revision 453165) +++ src/main/java/common/javax/swing/SwingUtilities.java (working copy) @@ -207,7 +207,7 @@ return (Container)ancestor; } - public static Container getAncestorOfClass(final Class wantedClass, final Component component) { + public static Container getAncestorOfClass(final Class wantedClass, final Component component) { if (component == null || wantedClass == null) { return null; } Index: src/main/java/common/javax/swing/Timer.java =================================================================== --- src/main/java/common/javax/swing/Timer.java (revision 453165) +++ src/main/java/common/javax/swing/Timer.java (working copy) @@ -147,7 +147,7 @@ return (timerTask != null); } - public EventListener[] getListeners(final Class listenersClass) { + public T[] getListeners(final Class listenersClass) { return listenerList.getListeners(listenersClass); } Index: src/main/java/common/javax/swing/UIDefaults.java =================================================================== --- src/main/java/common/javax/swing/UIDefaults.java (revision 453165) +++ src/main/java/common/javax/swing/UIDefaults.java (working copy) @@ -44,7 +44,7 @@ import javax.swing.plaf.ComponentUI; import javax.swing.plaf.UIResource; -public class UIDefaults extends Hashtable { +public class UIDefaults extends Hashtable { public static interface ActiveValue { Object createValue(UIDefaults uiDefaults); @@ -354,16 +354,18 @@ }); } - public Class getUIClass(final String name) { + public Class getUIClass(final String name) { return getUIClass(name, ClassLoader.getSystemClassLoader()); } - public Class getUIClass(final String name, final ClassLoader classLoader) { + public Class getUIClass(final String name, final ClassLoader classLoader) { try { if (classLoader == null) { - return Class.forName((String)get(name), false, classLoader); + return (Class) + Class.forName((String)get(name), false, classLoader); } else { - return classLoader.loadClass((String)get(name)); + return (Class) + classLoader.loadClass((String)get(name)); } } catch (final ClassNotFoundException e) { StringWriter writer = new StringWriter(); Index: src/test/api/java/common/javax/swing/event/EventListenerListTest.java =================================================================== --- src/test/api/java/common/javax/swing/event/EventListenerListTest.java (revision 453165) +++ src/test/api/java/common/javax/swing/event/EventListenerListTest.java (working copy) @@ -117,9 +117,9 @@ } public void testRemove() { - EventListener listener1 = new ConcreteListener("1"); - EventListener listener2 = new ConcreteListener("2"); - EventListener listener3 = new ConcreteListener("3"); + ConcreteListener listener1 = new ConcreteListener("1"); + ConcreteListener listener2 = new ConcreteListener("2"); + ConcreteListener listener3 = new ConcreteListener("3"); list.add(ConcreteListener.class, listener1); list.add(ConcreteListener.class, listener2); @@ -285,9 +285,9 @@ * Class under test for int getListenerCount() */ public void testGetListenerCount() { - EventListener listener1 = new ConcreteListener("1"); - EventListener listener2 = new ConcreteListener("2"); - EventListener listener3 = new ConcreteListener("3"); + ConcreteListener listener1 = new ConcreteListener("1"); + ConcreteListener listener2 = new ConcreteListener("2"); + ConcreteListener listener3 = new ConcreteListener("3"); assertTrue(list.getListenerCount() == 0); @@ -307,7 +307,7 @@ public void testWriteObject() throws IOException { ConcreteListener listener1 = new ConcreteSerializableListener("1"); - ConcreteListener listener2 = new ConcreteSerializableListener("2"); + ConcreteSerializableListener listener2 = new ConcreteSerializableListener("2"); ConcreteListener listener3 = new ConcreteListener("3"); list.add(ConcreteListener.class, listener1); list.add(ConcreteSerializableListener.class, listener2);