<Swing Dev> [PATCH] 6179357-related: Working on warnings removal
Alexander Potochkin
Alexander.Potochkin at Sun.COM
Mon Sep 10 16:16:29 UTC 2007
Hello Florian
> Hi,
>
> here's my first patch. When compiling with
> -Xlint -J-Xms80m -J-Xmx256m -Xlint:-serial -Xlint:-deprecation
> -Xlint:-fallthrough -Xmaxwarns 1200
> this patch reduces the number of reported warnings from 1185 to 91.
>
> This will be the basis to add generics support to the Swing framework
> and I will try to further reduce the number of warnings once I started
> with this task.
>
> The basis of this patch is revision 250. Apply it at
> openjdk/jdk/trunk/j2se/src.
>
> I tried not to change any public or protected APIs in public or
> protected classes in this patch.
>
> At many places I tried to add type parameters as meaningful as possible,
> but with some cases I just used Object, if a more meaningful type
> parameter was not so trivial. You might want to refactor this if needed.
> (Though everything should work as it is.)
Could you please to split your fix to several ones ?
It is difficult to review so big fixes
I'd suggest to make a fix for a package
We also usually don't mix two problems in one fix
so it is better to factor out removing warnings from existent code
to another fix
We also update the @author tag in a very rare occasion
when someone added a significant amount of code to a class
>
> I also started a new project at java.net:
> https://swing-generics.dev.java.net/ (pending approval)
> Am I correct that with the licences of openjdk I am allowed to publish
> the modified swing project in source, binary and javadoc form?
I hope you can do it, because I can't imagine it was not allowed by the
lisence
But since I am not a lawyer, probably someone else can confirm that ?
Thanks
alexp
> **
> -Florian
>
> Alexander Potochkin schrieb:
>> Hello Florian
>>> Hi,
>>>
>>> I decided first to remove some warning for trivial cases, since even
>>> if I compile with
>>> -Xlint:-serial -Xlint:-deprecation -Xlint:-cast -Xlint:-fallthrough
>>> -Xmaxwarns 1200
>>> I get 977 warnings! And since most of them are [unckecked] warnings,
>>> it's hard to see, if and where I introduce new [unckecked] warnings,
>>> when adding generics.
>>
>> You are right, unfortunately we have a lot of warnings in compile time
>>
>> We should have paid more attention to this problem
>>
>> Thanks
>> alexp
>>
>>> Please tell me if somebody else is working on the warnings removal, too.
>>>
>>> -Florian
>>>
>>> Florian Brunner schrieb:
>>>> Hi Alecander!
>>>>
>>>> Thanks for your help. I installed the basic environment and started
>>>> to work on this issue.
>>>>
>>>> Note that the path at
>>>>
>>>> https://openjdk.dev.java.net/source/browse/openjdk/
>>>>
>>>> as well as at
>>>>
>>>> https://openjdk.dev.java.net/servlets/ProjectSource
>>>>
>>>> don't seem to be correct!
>>>>
>>>> At
>>>> |https://openjdk.dev.java.net/svn/openjdk/trunk
>>>>
>>>> there's only a www directory!
>>>>
>>>> Instead I checked out
>>>>
>>>> https://openjdk.dev.java.net/svn/openjdk/jdk/trunk/j2se/
>>>>
>>>> Is this the correct path to work on the Swing project?
>>>>
>>>> I'will post to this list again when there are more news or questions
>>>> arise.
>>>>
>>>> -Florian
>>>>
>>>> |Alexander Potochkin schrieb:
>>>>>
>>>>> Hello Florian
>>>>>
>>>>> Welcome to the swing-dev
>>>>>
>>>>> The RFE #6179357 is definitely worth investigating
>>>>> we was going to generify Swing for 1.6
>>>>> but unfortunately didn't have enough time
>>>>>
>>>>> Your fixes are welcome
>>>>>
>>>>> Here is the information how to contribute:
>>>>> http://openjdk.java.net/contribute/
>>>>>
>>>>> For now the process is:
>>>>>
>>>>> Become a contributor
>>>>> download openJDK
>>>>> make the fix
>>>>> ask any related questions on this list
>>>>> submit a patch
>>>>> we'll assign a sponsor who we'll review your fix
>>>>> and put it back when it is done
>>>>>
>>>>> The whole process will be simplified when we complete moving to
>>>>> Mercurial repository
>>>>>
>>>>> For this RFE you don't need to file JSR
>>>>> as you mentioned changes should as backward compatible as possible
>>>>>
>>>>> but we'll need the request to the special committee which keeps
>>>>> track of the Java public API, the sponsor will do it for you
>>>>>
>>>>> Please note that we prefer to make the incremental fixes which fix
>>>>> the particular problem, I mean, not to mix e.g. generifying and
>>>>> optimization
>>>>> in one fix but split it to two ones.
>>>>>
>>>>> >I want my
>>>>> > progress to be visible by the public. So what is the best
>>>>> strategy? Work at
>>>>> > openjdk.org? Work at SwingLabs? Start a new project at java.net?
>>>>>
>>>>> The current process doesn't seem to provide much visibility for the
>>>>> public. To make it visible I personally would do the following things:
>>>>>
>>>>> - start a project on java.net
>>>>> (not sure it helps for this particular case)
>>>>> - blog about your progress and discuss it with the community
>>>>> (this is the best way to make your work visible)
>>>>>
>>>>> Thanks
>>>>> alexp
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm interessted in the RFE "6179357: Request interface
>>>>>> javax.swing.tree.TreeModel to have a generic type for nodes". Is
>>>>>> there already someone working on this issue? If not I would like
>>>>>> to help there.
>>>>>>
>>>>>> I want to address following issues:
>>>>>> - add generics support to the Swing framework
>>>>>> - provide support for new language features like varargs
>>>>>> - provide better support for the collection framework
>>>>>> - optimize code where reasonable
>>>>>>
>>>>>> Do you think this is a good idea? How probable will such a change
>>>>>> make its way to the "official" jdk?
>>>>>> I sent the signed SCA to Sun. So what would be the next steps? I
>>>>>> want my progress to be visible by the public. So what is the best
>>>>>> strategy? Work at openjdk.org? Work at SwingLabs? Start a new
>>>>>> project at java.net?
>>>>>>
>>>>>> Should I work on a branch of openjdk? Or should I copy the current
>>>>>> revision to a new repository? What is the easiest/ best way to get
>>>>>> the source back to openjdk?
>>>>>>
>>>>>> Is a JSR needed for such a change? Note: the suggested changes
>>>>>> should be backwards compatible (eg. thanks to the "raw type
>>>>>> feature" of generics), as far as I can see up to now. (The only
>>>>>> exception is of course reflection, which can always break if you
>>>>>> change an API).
>>>>>> Thanks for your help.
>>>>>>
>>>>>> -Florian
>>>>>
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------
>
> Index: classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java
> ===================================================================
> --- classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java (revision 250)
> +++ classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java (working copy)
> @@ -45,6 +45,7 @@
> * @version 1.54 05/05/07
> * @author Jeff Dinkins
> * @author Dave Kloba
> + * @author Florian Brunner
> */
>
> public class MotifGraphicsUtils implements SwingConstants
> @@ -226,15 +227,15 @@
> if(b.getIcon() != null) {
> Icon icon;
> if(!model.isEnabled()) {
> - icon = (Icon) b.getDisabledIcon();
> + icon = b.getDisabledIcon();
> } else if(model.isPressed() && model.isArmed()) {
> - icon = (Icon) b.getPressedIcon();
> + icon = b.getPressedIcon();
> if(icon == null) {
> // Use default icon
> - icon = (Icon) b.getIcon();
> + icon = b.getIcon();
> }
> } else {
> - icon = (Icon) b.getIcon();
> + icon = b.getIcon();
> }
>
> if (icon!=null) {
> Index: classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java
> ===================================================================
> --- classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java (revision 250)
> +++ classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java (working copy)
> @@ -41,6 +41,9 @@
> * Class that manages a Motif title bar
> * @version 1.41 05/05/07
> *
> + * @author unattributed
> + * @author Florian Brunner
> + *
> * @since 1.3
> */
> public class MotifInternalFrameTitlePane
> @@ -87,18 +90,18 @@
>
> protected void assembleSystemMenu() {
> systemMenu = new JPopupMenu();
> - JMenuItem mi = (JMenuItem)systemMenu.add(new JMenuItem(restoreAction));
> + JMenuItem mi = systemMenu.add(new JMenuItem(restoreAction));
> mi.setMnemonic('R');
> - mi = (JMenuItem) systemMenu.add(new JMenuItem(moveAction));
> + mi = systemMenu.add(new JMenuItem(moveAction));
> mi.setMnemonic('M');
> - mi = (JMenuItem) systemMenu.add(new JMenuItem(sizeAction));
> + mi = systemMenu.add(new JMenuItem(sizeAction));
> mi.setMnemonic('S');
> - mi = (JMenuItem) systemMenu.add(new JMenuItem(iconifyAction));
> + mi = systemMenu.add(new JMenuItem(iconifyAction));
> mi.setMnemonic('n');
> - mi = (JMenuItem) systemMenu.add(new JMenuItem(maximizeAction));
> + mi = systemMenu.add(new JMenuItem(maximizeAction));
> mi.setMnemonic('x');
> systemMenu.add(new JSeparator());
> - mi = (JMenuItem) systemMenu.add(new JMenuItem(closeAction));
> + mi = systemMenu.add(new JMenuItem(closeAction));
> mi.setMnemonic('C');
>
> systemButton = new SystemButton();
> @@ -158,7 +161,7 @@
> }
>
> public void propertyChange(PropertyChangeEvent evt) {
> - String prop = (String)evt.getPropertyName();
> + String prop = evt.getPropertyName();
> JInternalFrame f = (JInternalFrame)evt.getSource();
> boolean value = false;
> if (JInternalFrame.IS_SELECTED_PROPERTY.equals(prop)) {
> Index: classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java
> ===================================================================
> --- classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java (revision 250)
> +++ classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java (working copy)
> @@ -60,6 +60,7 @@
> *
> * @version 1.193 06/07/07
> * @author unattributed
> + * @author Florian Brunner
> */
> public class MotifLookAndFeel extends BasicLookAndFeel
> {
> @@ -291,7 +292,7 @@
>
> Object unselectedTabBackground = new UIDefaults.LazyValue() {
> public Object createValue(UIDefaults table) {
> - Color c = (Color)table.getColor("control");
> + Color c = table.getColor("control");
> return new ColorUIResource(Math.max((int)(c.getRed()*.85),0),
> Math.max((int)(c.getGreen()*.85),0),
> Math.max((int)(c.getBlue()*.85),0));
> @@ -300,7 +301,7 @@
>
> Object unselectedTabForeground = new UIDefaults.LazyValue() {
> public Object createValue(UIDefaults table) {
> - Color c = (Color)table.getColor("controlText");
> + Color c = table.getColor("controlText");
> return new ColorUIResource(Math.max((int)(c.getRed()*.85),0),
> Math.max((int)(c.getGreen()*.85),0),
> Math.max((int)(c.getBlue()*.85),0));
> @@ -309,7 +310,7 @@
>
> Object unselectedTabShadow = new UIDefaults.LazyValue() {
> public Object createValue(UIDefaults table) {
> - Color c = (Color)table.getColor("control");
> + Color c = table.getColor("control");
> Color base = new Color(Math.max((int)(c.getRed()*.85),0),
> Math.max((int)(c.getGreen()*.85),0),
> Math.max((int)(c.getBlue()*.85),0));
> @@ -319,7 +320,7 @@
>
> Object unselectedTabHighlight = new UIDefaults.LazyValue() {
> public Object createValue(UIDefaults table) {
> - Color c = (Color)table.getColor("control");
> + Color c = table.getColor("control");
> Color base = new Color(Math.max((int)(c.getRed()*.85),0),
> Math.max((int)(c.getGreen()*.85),0),
> Math.max((int)(c.getBlue()*.85),0));
> @@ -1285,3 +1286,4 @@
>
> }
>
> +
> Index: classes/com/sun/java/swing/plaf/windows/DesktopProperty.java
> ===================================================================
> --- classes/com/sun/java/swing/plaf/windows/DesktopProperty.java (revision 250)
> +++ classes/com/sun/java/swing/plaf/windows/DesktopProperty.java (working copy)
> @@ -37,6 +37,8 @@
> * will force the UIs to update all known Frames. You can invoke
> * <code>invalidate</code> to force the value to be fetched again.
> *
> + * @author unattributed
> + * @author Florian Brunner
> * @version @(#)DesktopProperty.java 1.16 07/05/05
> */
> // NOTE: Don't rely on this class staying in this location. It is likely
> @@ -50,7 +52,7 @@
> /**
> * ReferenceQueue of unreferenced WeakPCLs.
> */
> - private static ReferenceQueue queue;
> + private static ReferenceQueue<Object> queue;
>
>
> /**
> @@ -77,7 +79,7 @@
>
>
> static {
> - queue = new ReferenceQueue();
> + queue = new ReferenceQueue<Object>();
> }
>
> /**
> @@ -271,7 +273,7 @@
> * is handled via a WeakReference so as not to pin down the
> * DesktopProperty.
> */
> - private static class WeakPCL extends WeakReference
> + private static class WeakPCL extends WeakReference<Object>
> implements PropertyChangeListener {
> private Toolkit kit;
> private String key;
> Index: classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java
> ===================================================================
> --- classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java (revision 250)
> +++ classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java (working copy)
> @@ -51,6 +51,7 @@
> * @see javax.swing.DefaultDesktopManager
> * @version 1.27 05/05/07
> * @author Thomas Ball
> + * @author Florian Brunner
> */
> public class WindowsDesktopManager extends DefaultDesktopManager
> implements java.io.Serializable, javax.swing.plaf.UIResource {
> @@ -97,7 +98,7 @@
> }
> } catch (PropertyVetoException e) {}
> if (f != currentFrame) {
> - currentFrameRef = new WeakReference(f);
> + currentFrameRef = new WeakReference<JInternalFrame>(f);
> }
> }
>
> Index: classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java
> ===================================================================
> --- classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java (revision 250)
> +++ classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java (working copy)
> @@ -51,6 +51,7 @@
> *
> * @version 1.110 06/08/07
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public class WindowsFileChooserUI extends BasicFileChooserUI {
>
> @@ -1143,7 +1144,7 @@
> * Data model for a type-face selection combo-box.
> */
> protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel {
> - Vector directories = new Vector();
> + Vector<File> directories = new Vector<File>();
> int[] depths = null;
> File selectedDirectory = null;
> JFileChooser chooser = getFileChooser();
> @@ -1195,7 +1196,7 @@
> File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
> : canonical;
> File f = sf;
> - Vector path = new Vector(10);
> + Vector<File> path = new Vector<File>(10);
> do {
> path.addElement(f);
> } while ((f = f.getParentFile()) != null);
> @@ -1203,7 +1204,7 @@
> int pathCount = path.size();
> // Insert chain at appropriate place in vector
> for (int i = 0; i < pathCount; i++) {
> - f = (File)path.get(i);
> + f = path.get(i);
> if (directories.contains(f)) {
> int topIndex = directories.indexOf(f);
> for (int j = i-1; j >= 0; j--) {
> @@ -1222,12 +1223,12 @@
> private void calculateDepths() {
> depths = new int[directories.size()];
> for (int i = 0; i < depths.length; i++) {
> - File dir = (File)directories.get(i);
> + File dir = directories.get(i);
> File parent = dir.getParentFile();
> depths[i] = 0;
> if (parent != null) {
> for (int j = i-1; j >= 0; j--) {
> - if (parent.equals((File)directories.get(j))) {
> + if (parent.equals(directories.get(j))) {
> depths[i] = depths[j] + 1;
> break;
> }
> @@ -1412,3 +1413,4 @@
> }
> }
>
> +
> Index: classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
> ===================================================================
> --- classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java (revision 250)
> +++ classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java (working copy)
> @@ -41,6 +41,11 @@
> import static com.sun.java.swing.plaf.windows.TMSchema.*;
> import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
>
> +/**
> + *
> + * @author unattributed
> + * @author Florian Brunner
> + */
> public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
> private Color selectedTitleGradientColor;
> private Color notSelectedTitleGradientColor;
> @@ -304,18 +309,18 @@
> }
>
> protected void addSystemMenuItems(JPopupMenu menu) {
> - JMenuItem mi = (JMenuItem)menu.add(restoreAction);
> + JMenuItem mi = menu.add(restoreAction);
> mi.setMnemonic('R');
> - mi = (JMenuItem)menu.add(moveAction);
> + mi = menu.add(moveAction);
> mi.setMnemonic('M');
> - mi = (JMenuItem)menu.add(sizeAction);
> + mi = menu.add(sizeAction);
> mi.setMnemonic('S');
> - mi = (JMenuItem)menu.add(iconifyAction);
> + mi = menu.add(iconifyAction);
> mi.setMnemonic('n');
> - mi = (JMenuItem)menu.add(maximizeAction);
> + mi = menu.add(maximizeAction);
> mi.setMnemonic('x');
> systemPopupMenu.add(new JSeparator());
> - mi = (JMenuItem)menu.add(closeAction);
> + mi = menu.add(closeAction);
> mi.setMnemonic('C');
> }
>
> @@ -441,7 +446,7 @@
>
> public class WindowsPropertyChangeHandler extends PropertyChangeHandler {
> public void propertyChange(PropertyChangeEvent evt) {
> - String prop = (String)evt.getPropertyName();
> + String prop = evt.getPropertyName();
>
> // Update the internal frame icon for the system menu.
> if (JInternalFrame.FRAME_ICON_PROPERTY.equals(prop) &&
> Index: classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java
> ===================================================================
> --- classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java (revision 250)
> +++ classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java (working copy)
> @@ -47,6 +47,9 @@
> * for short term storage or RMI between applications running the same
> * version of Swing. A future release of Swing will provide support for
> * long term persistence.
> + *
> + * @author unattributed
> + * @author Florian Brunner
> */
> public class WindowsScrollBarUI extends BasicScrollBarUI {
> private Grid thumbGrid;
> @@ -369,21 +372,21 @@
> */
> private static class Grid {
> private static final int BUFFER_SIZE = 64;
> - private static HashMap map;
> + private static HashMap<String, WeakReference<Grid>> map;
>
> private BufferedImage image;
>
> static {
> - map = new HashMap();
> + map = new HashMap<String, WeakReference<Grid>>();
> }
>
> public static Grid getGrid(Color fg, Color bg) {
> String key = fg.getRGB() + " " + bg.getRGB();
> - WeakReference ref = (WeakReference)map.get(key);
> - Grid grid = (ref == null) ? null : (Grid)ref.get();
> + WeakReference<Grid> ref = map.get(key);
> + Grid grid = (ref == null) ? null : ref.get();
> if (grid == null) {
> grid = new Grid(fg, bg);
> - map.put(key, new WeakReference(grid));
> + map.put(key, new WeakReference<Grid>(grid));
> }
> return grid;
> }
> Index: classes/com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java
> ===================================================================
> --- classes/com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java (revision 250)
> +++ classes/com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java (working copy)
> @@ -47,19 +47,22 @@
> * for short term storage or RMI between applications running the same
> * version of Swing. A future release of Swing will provide support for
> * long term persistence.
> + *
> + * @author unattributed
> + * @author Florian Brunner
> */
> public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
> /**
> * Keys to use for forward focus traversal when the JComponent is
> * managing focus.
> */
> - private static Set managingFocusForwardTraversalKeys;
> + private static Set<KeyStroke> managingFocusForwardTraversalKeys;
>
> /**
> * Keys to use for backward focus traversal when the JComponent is
> * managing focus.
> */
> - private static Set managingFocusBackwardTraversalKeys;
> + private static Set<KeyStroke> managingFocusBackwardTraversalKeys;
>
> private boolean contentOpaque = true;
>
> @@ -69,13 +72,13 @@
>
> // focus forward traversal key
> if (managingFocusForwardTraversalKeys==null) {
> - managingFocusForwardTraversalKeys = new HashSet();
> + managingFocusForwardTraversalKeys = new HashSet<KeyStroke>();
> managingFocusForwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
> }
> tabPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, managingFocusForwardTraversalKeys);
> // focus backward traversal key
> if (managingFocusBackwardTraversalKeys==null) {
> - managingFocusBackwardTraversalKeys = new HashSet();
> + managingFocusBackwardTraversalKeys = new HashSet<KeyStroke>();
> managingFocusBackwardTraversalKeys.add( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
> }
> tabPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, managingFocusBackwardTraversalKeys);
> @@ -226,3 +229,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/AbstractButton.java
> ===================================================================
> --- classes/javax/swing/AbstractButton.java (revision 250)
> +++ classes/javax/swing/AbstractButton.java (working copy)
> @@ -70,6 +70,7 @@
> *
> * @version 1.196 05/05/07
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public abstract class AbstractButton extends JComponent implements ItemSelectable, SwingConstants {
>
> @@ -1313,8 +1314,7 @@
> // Make sure the change actually took effect
> if (!selected && isSelected()) {
> if (getModel() instanceof DefaultButtonModel) {
> - ButtonGroup group = (ButtonGroup)
> - ((DefaultButtonModel)getModel()).getGroup();
> + ButtonGroup group = ((DefaultButtonModel)getModel()).getGroup();
> if (group != null) {
> group.clearSelection();
> }
> @@ -1884,8 +1884,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])(listenerList.getListeners(
> - ChangeListener.class));
> + return listenerList.getListeners(ChangeListener.class);
> }
>
> /**
> @@ -1942,8 +1941,7 @@
> * @since 1.4
> */
> public ActionListener[] getActionListeners() {
> - return (ActionListener[])(listenerList.getListeners(
> - ActionListener.class));
> + return listenerList.getListeners(ActionListener.class);
> }
>
> /**
> @@ -2135,7 +2133,7 @@
> * @since 1.4
> */
> public ItemListener[] getItemListeners() {
> - return (ItemListener[])listenerList.getListeners(ItemListener.class);
> + return listenerList.getListeners(ItemListener.class);
> }
>
> /**
> Index: classes/javax/swing/AbstractCellEditor.java
> ===================================================================
> --- classes/javax/swing/AbstractCellEditor.java (revision 250)
> +++ classes/javax/swing/AbstractCellEditor.java (working copy)
> @@ -49,6 +49,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Philip Milne
> + * @author Florian Brunner
> * @since 1.3
> */
>
> @@ -119,8 +120,7 @@
> * @since 1.4
> */
> public CellEditorListener[] getCellEditorListeners() {
> - return (CellEditorListener[])listenerList.getListeners(
> - CellEditorListener.class);
> + return listenerList.getListeners(CellEditorListener.class);
> }
>
> /**
> Index: classes/javax/swing/AbstractListModel.java
> ===================================================================
> --- classes/javax/swing/AbstractListModel.java (revision 250)
> +++ classes/javax/swing/AbstractListModel.java (working copy)
> @@ -44,6 +44,7 @@
> *
> * @version 1.41 05/05/07
> * @author Hans Muller
> + * @author Florian Brunner
> */
> public abstract class AbstractListModel implements ListModel, Serializable
> {
> @@ -86,8 +87,7 @@
> * @since 1.4
> */
> public ListDataListener[] getListDataListeners() {
> - return (ListDataListener[])listenerList.getListeners(
> - ListDataListener.class);
> + return listenerList.getListeners(ListDataListener.class);
> }
>
>
> Index: classes/javax/swing/AbstractSpinnerModel.java
> ===================================================================
> --- classes/javax/swing/AbstractSpinnerModel.java (revision 250)
> +++ classes/javax/swing/AbstractSpinnerModel.java (working copy)
> @@ -45,6 +45,7 @@
> *
> * @version 1.14 05/05/07
> * @author Hans Muller
> + * @author Florian Brunner
> * @since 1.4
> */
> public abstract class AbstractSpinnerModel implements SpinnerModel, Serializable
> @@ -99,8 +100,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
>
> @@ -141,3 +141,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/ActionMap.java
> ===================================================================
> --- classes/javax/swing/ActionMap.java (revision 250)
> +++ classes/javax/swing/ActionMap.java (working copy)
> @@ -54,6 +54,7 @@
> *
> * @version 1.21 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> * @since 1.3
> */
> public class ActionMap implements Serializable {
> @@ -198,8 +199,8 @@
> return pKeys;
> }
>
> - HashMap keyMap = new HashMap();
> - int counter;
> + HashMap<Object, Object> keyMap = new HashMap<Object, Object>();
> + int counter;
>
> for (counter = keys.length - 1; counter >= 0; counter--) {
> keyMap.put(keys[counter], keys[counter]);
> Index: classes/javax/swing/AncestorNotifier.java
> ===================================================================
> --- classes/javax/swing/AncestorNotifier.java (revision 250)
> +++ classes/javax/swing/AncestorNotifier.java (working copy)
> @@ -41,6 +41,7 @@
> /**
> * @version 1.27 05/05/07
> * @author Dave Moore
> + * @author Florian Brunner
> */
>
> class AncestorNotifier implements ComponentListener, PropertyChangeListener, Serializable
> @@ -63,7 +64,7 @@
> }
>
> AncestorListener[] getAncestorListeners() {
> - return (AncestorListener[])listenerList.getListeners(AncestorListener.class);
> + return listenerList.getListeners(AncestorListener.class);
> }
>
> /**
> Index: classes/javax/swing/ArrayTable.java
> ===================================================================
> --- classes/javax/swing/ArrayTable.java (revision 250)
> +++ classes/javax/swing/ArrayTable.java (working copy)
> @@ -42,6 +42,7 @@
> * @version 1.12 05/05/07
> * @author Georges Saab
> * @author Scott Violet
> + * @author Florian Brunner
> */
> class ArrayTable implements Cloneable {
> // Our field for storage
> @@ -134,7 +135,7 @@
> if ((size==ARRAY_BOUNDARY) && isArray()) {
> grow();
> }
> - ((Hashtable)table).put(key, value);
> + ((Hashtable<Object, Object>)table).put(key, value);
> }
> }
> }
> @@ -316,7 +317,7 @@
> */
> private void grow() {
> Object[] array = (Object[])table;
> - Hashtable tmp = new Hashtable(array.length/2);
> + Hashtable<Object, Object> tmp = new Hashtable<Object, Object>(array.length/2);
> for (int i = 0; i<array.length; i+=2) {
> tmp.put(array[i], array[i+1]);
> }
> Index: classes/javax/swing/ButtonGroup.java
> ===================================================================
> --- classes/javax/swing/ButtonGroup.java (revision 250)
> +++ classes/javax/swing/ButtonGroup.java (working copy)
> @@ -65,11 +65,12 @@
> *
> * @version 1.45 05/05/07
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public class ButtonGroup implements Serializable {
>
> // the list of buttons participating in this group
> - protected Vector<AbstractButton> buttons = new Vector();
> + protected Vector<AbstractButton> buttons = new Vector<AbstractButton>();
>
> /**
> * The current selection.
> Index: classes/javax/swing/colorchooser/DefaultColorSelectionModel.java
> ===================================================================
> --- classes/javax/swing/colorchooser/DefaultColorSelectionModel.java (revision 250)
> +++ classes/javax/swing/colorchooser/DefaultColorSelectionModel.java (working copy)
> @@ -35,6 +35,7 @@
> *
> * @version 1.22 05/05/07
> * @author Steve Wilson
> + * @author Florian Brunner
> *
> * @see java.awt.Color
> */
> @@ -129,8 +130,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
> /**
> Index: classes/javax/swing/colorchooser/SyntheticImage.java
> ===================================================================
> --- classes/javax/swing/colorchooser/SyntheticImage.java (revision 250)
> +++ classes/javax/swing/colorchooser/SyntheticImage.java (working copy)
> @@ -54,6 +54,7 @@
> *
> * @version 1.31 05/05/07
> * @author James Gosling
> + * @author Florian Brunner
> */
> abstract class SyntheticImage implements ImageProducer {
> private SyntheticImageGenerator root;
> @@ -156,7 +157,7 @@
>
> private final static void doPrivileged(final Runnable doRun) {
> java.security.AccessController.doPrivileged(
> - new java.security.PrivilegedAction() {
> + new java.security.PrivilegedAction<Object>() {
> public Object run() {
> doRun.run();
> return null;
> Index: classes/javax/swing/DebugGraphicsInfo.java
> ===================================================================
> --- classes/javax/swing/DebugGraphicsInfo.java (revision 250)
> +++ classes/javax/swing/DebugGraphicsInfo.java (working copy)
> @@ -33,12 +33,13 @@
> *
> * @version 1.20 05/05/07
> * @author Dave Karlton
> + * @author Florian Brunner
> */
> class DebugGraphicsInfo {
> Color flashColor = Color.red;
> int flashTime = 100;
> int flashCount = 2;
> - Hashtable componentToDebug;
> + Hashtable<JComponent, Integer> componentToDebug;
> JFrame debugFrame = null;
> java.io.PrintStream stream = System.out;
>
> @@ -47,10 +48,10 @@
> return;
> }
> if (componentToDebug == null) {
> - componentToDebug = new Hashtable();
> + componentToDebug = new Hashtable<JComponent, Integer>();
> }
> if (debug > 0) {
> - componentToDebug.put(component, new Integer(debug));
> + componentToDebug.put(component, debug);
> } else {
> componentToDebug.remove(component);
> }
> @@ -60,7 +61,7 @@
> if (componentToDebug == null) {
> return 0;
> } else {
> - Integer integer = (Integer)componentToDebug.get(component);
> + Integer integer = componentToDebug.get(component);
>
> return integer == null ? 0 : integer.intValue();
> }
> @@ -72,3 +73,4 @@
> }
>
>
> +
> Index: classes/javax/swing/DefaultBoundedRangeModel.java
> ===================================================================
> --- classes/javax/swing/DefaultBoundedRangeModel.java (revision 250)
> +++ classes/javax/swing/DefaultBoundedRangeModel.java (working copy)
> @@ -44,6 +44,7 @@
> * @version 1.54 05/05/07
> * @author David Kloba
> * @author Hans Muller
> + * @author Florian Brunner
> * @see BoundedRangeModel
> */
> public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable
> @@ -344,8 +345,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
>
> @@ -424,3 +424,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/DefaultButtonModel.java
> ===================================================================
> --- classes/javax/swing/DefaultButtonModel.java (revision 250)
> +++ classes/javax/swing/DefaultButtonModel.java (working copy)
> @@ -45,6 +45,7 @@
> *
> * @version 1.55 05/05/07
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public class DefaultButtonModel implements ButtonModel, Serializable {
>
> @@ -327,8 +328,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
> /**
> @@ -381,8 +381,7 @@
> * @since 1.4
> */
> public ActionListener[] getActionListeners() {
> - return (ActionListener[])listenerList.getListeners(
> - ActionListener.class);
> + return listenerList.getListeners(ActionListener.class);
> }
>
> /**
> @@ -435,7 +434,7 @@
> * @since 1.4
> */
> public ItemListener[] getItemListeners() {
> - return (ItemListener[])listenerList.getListeners(ItemListener.class);
> + return listenerList.getListeners(ItemListener.class);
> }
>
> /**
> Index: classes/javax/swing/DefaultFocusManager.java
> ===================================================================
> --- classes/javax/swing/DefaultFocusManager.java (revision 250)
> +++ classes/javax/swing/DefaultFocusManager.java (working copy)
> @@ -46,6 +46,7 @@
> * @version 1.36, 05/05/07
> * @author Arnaud Weber
> * @author David Mendenhall
> + * @author Florian Brunner
> */
> public class DefaultFocusManager extends FocusManager {
>
> @@ -157,18 +158,17 @@
> }
> }
>
> -final class CompareTabOrderComparator implements Comparator {
> +final class CompareTabOrderComparator implements Comparator<Component> {
> private final DefaultFocusManager defaultFocusManager;
>
> CompareTabOrderComparator(DefaultFocusManager defaultFocusManager) {
> this.defaultFocusManager = defaultFocusManager;
> }
>
> - public int compare(Object o1, Object o2) {
> + public int compare(Component o1, Component o2) {
> if (o1 == o2) {
> return 0;
> }
> - return (defaultFocusManager.compareTabOrder((Component)o1,
> - (Component)o2)) ? -1 : 1;
> + return (defaultFocusManager.compareTabOrder(o1, o2)) ? -1 : 1;
> }
> }
> Index: classes/javax/swing/DefaultListSelectionModel.java
> ===================================================================
> --- classes/javax/swing/DefaultListSelectionModel.java (revision 250)
> +++ classes/javax/swing/DefaultListSelectionModel.java (working copy)
> @@ -47,6 +47,7 @@
> * @version 1.84 05/05/07
> * @author Philip Milne
> * @author Hans Muller
> + * @author Florian Brunner
> * @see ListSelectionModel
> */
>
> @@ -133,8 +134,7 @@
> * @since 1.4
> */
> public ListSelectionListener[] getListSelectionListeners() {
> - return (ListSelectionListener[])listenerList.getListeners(
> - ListSelectionListener.class);
> + return listenerList.getListeners(ListSelectionListener.class);
> }
>
> /**
> @@ -847,3 +847,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/DefaultSingleSelectionModel.java
> ===================================================================
> --- classes/javax/swing/DefaultSingleSelectionModel.java (revision 250)
> +++ classes/javax/swing/DefaultSingleSelectionModel.java (working copy)
> @@ -43,6 +43,7 @@
> *
> * @version 1.42 05/05/07
> * @author Dave Moore
> + * @author Florian Brunner
> */
> public class DefaultSingleSelectionModel implements SingleSelectionModel,
> Serializable {
> @@ -111,8 +112,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
> /**
> @@ -177,3 +177,4 @@
> }
>
>
> +
> Index: classes/javax/swing/filechooser/FileSystemView.java
> ===================================================================
> --- classes/javax/swing/filechooser/FileSystemView.java (revision 250)
> +++ classes/javax/swing/filechooser/FileSystemView.java (working copy)
> @@ -63,6 +63,7 @@
> *
> * @version 1.55 05/05/07
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
>
> // PENDING(jeff) - need to provide a specification for
> @@ -440,7 +441,7 @@
> * Gets the list of shown (i.e. not hidden) files.
> */
> public File[] getFiles(File dir, boolean useFileHiding) {
> - Vector files = new Vector();
> + Vector<File> files = new Vector<File>();
>
>
> // add all files in dir
> @@ -479,7 +480,7 @@
> }
> }
>
> - return (File[])files.toArray(new File[files.size()]);
> + return files.toArray(new File[files.size()]);
> }
>
>
> Index: classes/javax/swing/GroupLayout.java
> ===================================================================
> --- classes/javax/swing/GroupLayout.java (revision 250)
> +++ classes/javax/swing/GroupLayout.java (working copy)
> @@ -203,6 +203,7 @@
> * @author Tomas Pavek
> * @author Jan Stola
> * @author Scott Violet
> + * @author Florian Brunner
> * @version 1.9, 05/05/07
> * @since 1.6
> */
> @@ -1120,7 +1121,7 @@
> * creating one if necessary.
> */
> private ComponentInfo getComponentInfo(Component component) {
> - ComponentInfo info = (ComponentInfo)componentInfos.get(component);
> + ComponentInfo info = componentInfos.get(component);
> if (info == null) {
> info = new ComponentInfo(component);
> componentInfos.put(component, info);
> Index: classes/javax/swing/InputMap.java
> ===================================================================
> --- classes/javax/swing/InputMap.java (revision 250)
> +++ classes/javax/swing/InputMap.java (working copy)
> @@ -51,6 +51,7 @@
> *
> * @version 1.21 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> * @since 1.3
> */
> public class InputMap implements Serializable {
> @@ -201,7 +202,7 @@
> return pKeys;
> }
>
> - HashMap keyMap = new HashMap();
> + HashMap<KeyStroke, KeyStroke> keyMap = new HashMap<KeyStroke, KeyStroke>();
> int counter;
>
> for (counter = keys.length - 1; counter >= 0; counter--) {
> @@ -213,7 +214,7 @@
>
> KeyStroke[] allKeys = new KeyStroke[keyMap.size()];
>
> - return (KeyStroke[])keyMap.keySet().toArray(allKeys);
> + return keyMap.keySet().toArray(allKeys);
> }
>
> private void writeObject(ObjectOutputStream s) throws IOException {
> Index: classes/javax/swing/JComboBox.java
> ===================================================================
> --- classes/javax/swing/JComboBox.java (revision 250)
> +++ classes/javax/swing/JComboBox.java (working copy)
> @@ -76,6 +76,7 @@
> * @version 1.147 05/05/07
> * @author Arnaud Weber
> * @author Mark Davidson
> + * @author Florian Brunner
> */
> public class JComboBox extends JComponent
> implements ItemSelectable,ListDataListener,ActionListener, Accessible {
> @@ -857,7 +858,7 @@
> * @since 1.4
> */
> public ItemListener[] getItemListeners() {
> - return (ItemListener[])listenerList.getListeners(ItemListener.class);
> + return listenerList.getListeners(ItemListener.class);
> }
>
> /**
> @@ -895,8 +896,7 @@
> * @since 1.4
> */
> public ActionListener[] getActionListeners() {
> - return (ActionListener[])listenerList.getListeners(
> - ActionListener.class);
> + return listenerList.getListeners(ActionListener.class);
> }
>
> /**
> @@ -935,8 +935,7 @@
> * @since 1.4
> */
> public PopupMenuListener[] getPopupMenuListeners() {
> - return (PopupMenuListener[])listenerList.getListeners(
> - PopupMenuListener.class);
> + return listenerList.getListeners(PopupMenuListener.class);
> }
>
> /**
> Index: classes/javax/swing/JComponent.java
> ===================================================================
> --- classes/javax/swing/JComponent.java (revision 250)
> +++ classes/javax/swing/JComponent.java (working copy)
> @@ -177,6 +177,7 @@
> * @version 2.291, 05/05/07
> * @author Hans Muller
> * @author Arnaud Weber
> + * @author Florian Brunner
> */
> public abstract class JComponent extends Container implements Serializable,
> TransferHandler.HasGetTransferHandler
> @@ -190,7 +191,8 @@
> /**
> * @see #readObject
> */
> - private static final Hashtable readObjectCallbacks = new Hashtable(1);
> + private static final Hashtable<ObjectInputStream, ReadObjectCallback> readObjectCallbacks =
> + new Hashtable<ObjectInputStream, ReadObjectCallback>(1);
>
> /**
> * Keys to use for forward focus traversal when the JComponent is
> @@ -354,7 +356,7 @@
> /**
> * Temporary rectangles.
> */
> - private static java.util.List tempRectangles = new java.util.ArrayList(11);
> + private static java.util.List<Rectangle> tempRectangles = new java.util.ArrayList<Rectangle>(11);
>
> /** Used for <code>WHEN_FOCUSED</code> bindings. */
> private InputMap focusInputMap;
> @@ -449,7 +451,7 @@
> Rectangle rect;
> int size = tempRectangles.size();
> if (size > 0) {
> - rect = (Rectangle)tempRectangles.remove(size - 1);
> + rect = tempRectangles.remove(size - 1);
> }
> else {
> rect = new Rectangle(0, 0, 0, 0);
> @@ -2091,8 +2093,8 @@
> private void registerWithKeyboardManager(boolean onlyIfNew) {
> InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW, false);
> KeyStroke[] strokes;
> - Hashtable registered = (Hashtable)getClientProperty
> - (WHEN_IN_FOCUSED_WINDOW_BINDINGS);
> + Hashtable<KeyStroke, KeyStroke> registered =
> + (Hashtable<KeyStroke, KeyStroke>)getClientProperty(WHEN_IN_FOCUSED_WINDOW_BINDINGS);
>
> if (inputMap != null) {
> // Push any new KeyStrokes to the KeyboardManager.
> @@ -2126,7 +2128,7 @@
> // Updated the registered Hashtable.
> if (strokes != null && strokes.length > 0) {
> if (registered == null) {
> - registered = new Hashtable(strokes.length);
> + registered = new Hashtable<KeyStroke, KeyStroke>(strokes.length);
> putClientProperty(WHEN_IN_FOCUSED_WINDOW_BINDINGS, registered);
> }
> for (int counter = strokes.length - 1; counter >= 0; counter--) {
> @@ -4092,13 +4094,13 @@
> if (!getFlag(FOCUS_TRAVERSAL_KEYS_FORWARD_SET)) {
> super.setFocusTraversalKeys(KeyboardFocusManager.
> FORWARD_TRAVERSAL_KEYS,
> - (Set)value);
> + (Set<? extends java.awt.AWTKeyStroke>)value);
> }
> } else if (propertyName == "focusTraversalKeysBackward") {
> if (!getFlag(FOCUS_TRAVERSAL_KEYS_BACKWARD_SET)) {
> super.setFocusTraversalKeys(KeyboardFocusManager.
> BACKWARD_TRAVERSAL_KEYS,
> - (Set)value);
> + (Set<? extends java.awt.AWTKeyStroke>)value);
> }
> } else {
> throw new IllegalArgumentException("property \""+
> @@ -4688,7 +4690,7 @@
> result = (T[])getPropertyChangeListeners();
> }
> else {
> - result = (T[])listenerList.getListeners(listenerType);
> + result = listenerList.getListeners(listenerType);
> }
>
> if (result.length == 0) {
> @@ -5340,7 +5342,7 @@
> */
> private class ReadObjectCallback implements ObjectInputValidation
> {
> - private final Vector roots = new Vector(1);
> + private final Vector<JComponent> roots = new Vector<JComponent>(1);
> private final ObjectInputStream inputStream;
>
> ReadObjectCallback(ObjectInputStream s) throws Exception {
> @@ -5357,7 +5359,7 @@
> public void validateObject() throws InvalidObjectException {
> try {
> for(int i = 0; i < roots.size(); i++) {
> - JComponent root = (JComponent)(roots.elementAt(i));
> + JComponent root = roots.elementAt(i);
> SwingUtilities.updateComponentTreeUI(root);
> }
> }
> @@ -5378,7 +5380,7 @@
> * existing roots (or it IS an existing root), we're done.
> */
> for(int i = 0; i < roots.size(); i++) {
> - JComponent root = (JComponent)roots.elementAt(i);
> + JComponent root = roots.elementAt(i);
> for(Component p = c; p != null; p = p.getParent()) {
> if (p == root) {
> return;
> @@ -5391,7 +5393,7 @@
> * to the roots vector.
> */
> for(int i = 0; i < roots.size(); i++) {
> - JComponent root = (JComponent)roots.elementAt(i);
> + JComponent root = roots.elementAt(i);
> for(Component p = root.getParent(); p != null; p = p.getParent()) {
> if (p == c) {
> roots.removeElementAt(i--); // !!
> @@ -5423,7 +5425,7 @@
> * in the readObjectCallbacks table. Note that the ReadObjectCallback
> * constructor takes care of calling s.registerValidation().
> */
> - ReadObjectCallback cb = (ReadObjectCallback)(readObjectCallbacks.get(s));
> + ReadObjectCallback cb = readObjectCallbacks.get(s);
> if (cb == null) {
> try {
> readObjectCallbacks.put(s, cb = new ReadObjectCallback(s));
> Index: classes/javax/swing/JDesktopPane.java
> ===================================================================
> --- classes/javax/swing/JDesktopPane.java (revision 250)
> +++ classes/javax/swing/JDesktopPane.java (working copy)
> @@ -86,6 +86,7 @@
> *
> * @version 1.64 05/05/07
> * @author David Kloba
> + * @author Florian Brunner
> */
> public class JDesktopPane extends JLayeredPane implements Accessible
> {
> @@ -263,8 +264,8 @@
> public JInternalFrame[] getAllFrames() {
> int i, count;
> JInternalFrame[] results;
> - Vector vResults = new Vector(10);
> - Object next, tmp;
> + Vector<Component> vResults = new Vector<Component>(10);
> + Component next, tmp;
>
> count = getComponentCount();
> for(i = 0; i < count; i++) {
> @@ -325,8 +326,8 @@
> public JInternalFrame[] getAllFramesInLayer(int layer) {
> int i, count;
> JInternalFrame[] results;
> - Vector vResults = new Vector(10);
> - Object next, tmp;
> + Vector<Component> vResults = new Vector<Component>(10);
> + Component next, tmp;
>
> count = getComponentCount();
> for(i = 0; i < count; i++) {
> @@ -636,3 +637,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/JDialog.java
> ===================================================================
> --- classes/javax/swing/JDialog.java (revision 250)
> +++ classes/javax/swing/JDialog.java (working copy)
> @@ -99,6 +99,7 @@
> * @author David Kloba
> * @author James Gosling
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class JDialog extends Dialog implements WindowConstants,
> Accessible,
> @@ -278,7 +279,7 @@
> title, modal);
> if (owner == null) {
> WindowListener ownerShutdownListener =
> - (WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
> + SwingUtilities.getSharedOwnerFrameShutdownListener();
> addWindowListener(ownerShutdownListener);
> }
> dialogInit();
> @@ -330,7 +331,7 @@
> title, modal, gc);
> if (owner == null) {
> WindowListener ownerShutdownListener =
> - (WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
> + SwingUtilities.getSharedOwnerFrameShutdownListener();
> addWindowListener(ownerShutdownListener);
> }
> dialogInit();
> Index: classes/javax/swing/JEditorPane.java
> ===================================================================
> --- classes/javax/swing/JEditorPane.java (revision 250)
> +++ classes/javax/swing/JEditorPane.java (working copy)
> @@ -186,6 +186,7 @@
> * description: A text component to edit various types of content.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.145 05/05/07
> */
> public class JEditorPane extends JTextComponent {
> @@ -320,8 +321,7 @@
> * @since 1.4
> */
> public synchronized HyperlinkListener[] getHyperlinkListeners() {
> - return (HyperlinkListener[])listenerList.getListeners(
> - HyperlinkListener.class);
> + return listenerList.getListeners(HyperlinkListener.class);
> }
>
> /**
> @@ -835,7 +835,7 @@
> */
> private void handleConnectionProperties(URLConnection conn) {
> if (pageProperties == null) {
> - pageProperties = new Hashtable();
> + pageProperties = new Hashtable<String, Object>();
> }
> String type = conn.getContentType();
> if (type != null) {
> @@ -1138,9 +1138,9 @@
> */
> public EditorKit getEditorKitForContentType(String type) {
> if (typeHandlers == null) {
> - typeHandlers = new Hashtable(3);
> + typeHandlers = new Hashtable<String, EditorKit>(3);
> }
> - EditorKit k = (EditorKit) typeHandlers.get(type);
> + EditorKit k = typeHandlers.get(type);
> if (k == null) {
> k = createEditorKitForContentType(type);
> if (k != null) {
> @@ -1164,7 +1164,7 @@
> */
> public void setEditorKitForContentType(String type, EditorKit k) {
> if (typeHandlers == null) {
> - typeHandlers = new Hashtable(3);
> + typeHandlers = new Hashtable<String, EditorKit>(3);
> }
> typeHandlers.put(type, k);
> }
> @@ -1240,12 +1240,12 @@
> */
> public static EditorKit createEditorKitForContentType(String type) {
> EditorKit k = null;
> - Hashtable kitRegistry = getKitRegisty();
> - k = (EditorKit) kitRegistry.get(type);
> + Hashtable<String, EditorKit> kitRegistry = getKitRegisty();
> + k = kitRegistry.get(type);
> if (k == null) {
> // try to dynamically load the support
> - String classname = (String) getKitTypeRegistry().get(type);
> - ClassLoader loader = (ClassLoader) getKitLoaderRegistry().get(type);
> + String classname = getKitTypeRegistry().get(type);
> + ClassLoader loader = getKitLoaderRegistry().get(type);
> try {
> Class c;
> if (loader != null) {
> @@ -1315,23 +1315,24 @@
> * @since 1.3
> */
> public static String getEditorKitClassNameForContentType(String type) {
> - return (String)getKitTypeRegistry().get(type);
> + return getKitTypeRegistry().get(type);
> }
>
> - private static Hashtable getKitTypeRegistry() {
> + private static Hashtable<String, String> getKitTypeRegistry() {
> loadDefaultKitsIfNecessary();
> - return (Hashtable)SwingUtilities.appContextGet(kitTypeRegistryKey);
> + return (Hashtable<String, String>)SwingUtilities.appContextGet(kitTypeRegistryKey);
> }
>
> - private static Hashtable getKitLoaderRegistry() {
> + private static Hashtable<String, ClassLoader> getKitLoaderRegistry() {
> loadDefaultKitsIfNecessary();
> - return (Hashtable)SwingUtilities.appContextGet(kitLoaderRegistryKey);
> + return (Hashtable<String, ClassLoader>)SwingUtilities.appContextGet(kitLoaderRegistryKey);
> }
>
> - private static Hashtable getKitRegisty() {
> - Hashtable ht = (Hashtable)SwingUtilities.appContextGet(kitRegistryKey);
> + private static Hashtable<String, EditorKit> getKitRegisty() {
> + Hashtable<String, EditorKit> ht =
> + (Hashtable<String, EditorKit>)SwingUtilities.appContextGet(kitRegistryKey);
> if (ht == null) {
> - ht = new Hashtable(3);
> + ht = new Hashtable<String, EditorKit>(3);
> SwingUtilities.appContextPut(kitRegistryKey, ht);
> }
> return ht;
> @@ -1584,7 +1585,7 @@
> private EditorKit kit;
> private boolean isUserSetEditorKit;
>
> - private Hashtable pageProperties;
> + private Hashtable<String, Object> pageProperties;
>
> /** Should be kept in sync with javax.swing.text.html.FormView counterpart. */
> final static String PostDataProperty = "javax.swing.JEditorPane.postdata";
> @@ -1592,7 +1593,7 @@
> /**
> * Table of registered type handlers for this editor.
> */
> - private Hashtable typeHandlers;
> + private Hashtable<String, EditorKit> typeHandlers;
>
> /*
> * Private AppContext keys for this class's static variables.
> @@ -2473,3 +2474,4 @@
>
> }
>
> +
> Index: classes/javax/swing/JFileChooser.java
> ===================================================================
> --- classes/javax/swing/JFileChooser.java (revision 250)
> +++ classes/javax/swing/JFileChooser.java (working copy)
> @@ -87,6 +87,7 @@
> *
> * @version 1.123 05/09/07
> * @author Jeff Dinkins
> + * @author Florian Brunner
> *
> */
> public class JFileChooser extends JComponent implements Accessible {
> @@ -249,7 +250,7 @@
> private String approveButtonToolTipText = null;
> private int approveButtonMnemonic = 0;
>
> - private Vector filters = new Vector(5);
> + private Vector<FileFilter> filters = new Vector<FileFilter>(5);
> private JDialog dialog = null;
> private int dialogType = OPEN_DIALOG;
> private int returnValue = ERROR_OPTION;
> @@ -504,7 +505,7 @@
> if(selectedFiles == null) {
> return new File[0];
> } else {
> - return (File[]) selectedFiles.clone();
> + return selectedFiles.clone();
> }
> }
>
> @@ -1414,7 +1415,7 @@
> fileFilter = filter;
> if (filter != null) {
> if (isMultiSelectionEnabled() && selectedFiles != null && selectedFiles.length > 0) {
> - Vector fList = new Vector();
> + Vector<File> fList = new Vector<File>();
> boolean failed = false;
> for (int i = 0; i < selectedFiles.length; i++) {
> if (filter.accept(selectedFiles[i])) {
> @@ -1424,7 +1425,7 @@
> }
> }
> if (failed) {
> - setSelectedFiles((fList.size() == 0) ? null : (File[])fList.toArray(new File[fList.size()]));
> + setSelectedFiles((fList.size() == 0) ? null : fList.toArray(new File[fList.size()]));
> }
> } else if (selectedFile != null && !filter.accept(selectedFile)) {
> setSelectedFile(null);
> @@ -1701,8 +1702,7 @@
> * @since 1.4
> */
> public ActionListener[] getActionListeners() {
> - return (ActionListener[])listenerList.getListeners(
> - ActionListener.class);
> + return listenerList.getListeners(ActionListener.class);
> }
>
> /**
> @@ -1743,7 +1743,7 @@
> WeakReference<JFileChooser> jfcRef;
>
> public WeakPCL(JFileChooser jfc) {
> - jfcRef = new WeakReference(jfc);
> + jfcRef = new WeakReference<JFileChooser>(jfc);
> }
> public void propertyChange(PropertyChangeEvent ev) {
> assert ev.getPropertyName().equals(SHOW_HIDDEN_PROP);
> Index: classes/javax/swing/JInternalFrame.java
> ===================================================================
> --- classes/javax/swing/JInternalFrame.java (revision 250)
> +++ classes/javax/swing/JInternalFrame.java (working copy)
> @@ -108,6 +108,7 @@
> * @version 1.164 05/05/07
> * @author David Kloba
> * @author Rich Schiavi
> + * @author Florian Brunner
> * @beaninfo
> * attribute: isContainer true
> * attribute: containerDelegate getContentPane
> @@ -1536,8 +1537,7 @@
> * @see #addInternalFrameListener
> */
> public InternalFrameListener[] getInternalFrameListeners() {
> - return (InternalFrameListener[])listenerList.getListeners(
> - InternalFrameListener.class);
> + return listenerList.getListeners(InternalFrameListener.class);
> }
>
> // remind: name ok? all one method ok? need to be synchronized?
> Index: classes/javax/swing/JLayeredPane.java
> ===================================================================
> --- classes/javax/swing/JLayeredPane.java (revision 250)
> +++ classes/javax/swing/JLayeredPane.java (working copy)
> @@ -153,6 +153,7 @@
> *
> * @version 1.36 02/02/00
> * @author David Kloba
> + * @author Florian Brunner
> */
> public class JLayeredPane extends JComponent implements Accessible {
> /// Watch the values in getObjectForLayer()
> @@ -365,7 +366,7 @@
> if(c instanceof JComponent)
> ((JComponent)c).putClientProperty(LAYER_PROPERTY, layerObj);
> else
> - getComponentToLayer().put((Component)c, layerObj);
> + getComponentToLayer().put(c, layerObj);
>
> if(c.getParent() == null || c.getParent() != this) {
> repaint(c.getBounds());
> @@ -389,7 +390,7 @@
> if(c instanceof JComponent)
> i = (Integer)((JComponent)c).getClientProperty(LAYER_PROPERTY);
> else
> - i = (Integer)getComponentToLayer().get((Component)c);
> + i = getComponentToLayer().get(c);
>
> if(i == null)
> return DEFAULT_LAYER.intValue();
> @@ -781,3 +782,4 @@
> }
>
>
> +
> Index: classes/javax/swing/JList.java
> ===================================================================
> --- classes/javax/swing/JList.java (revision 250)
> +++ classes/javax/swing/JList.java (working copy)
> @@ -264,6 +264,7 @@
> *
> * @version 1.142 05/05/07
> * @author Hans Muller
> + * @author Florian Brunner
> */
> public class JList extends JComponent implements Scrollable, Accessible
> {
> @@ -1846,8 +1847,7 @@
> * @since 1.4
> */
> public ListSelectionListener[] getListSelectionListeners() {
> - return (ListSelectionListener[])listenerList.getListeners(
> - ListSelectionListener.class);
> + return listenerList.getListeners(ListSelectionListener.class);
> }
>
>
> @@ -3683,3 +3683,4 @@
> } // inner class AccessibleJList
> }
>
> +
> Index: classes/javax/swing/JMenu.java
> ===================================================================
> --- classes/javax/swing/JMenu.java (revision 250)
> +++ classes/javax/swing/JMenu.java (working copy)
> @@ -105,6 +105,7 @@
> * @author Georges Saab
> * @author David Karlton
> * @author Arnaud Weber
> + * @author Florian Brunner
> * @see JMenuItem
> * @see JSeparator
> * @see JMenuBar
> @@ -1016,7 +1017,7 @@
> * @since 1.4
> */
> public MenuListener[] getMenuListeners() {
> - return (MenuListener[])listenerList.getListeners(MenuListener.class);
> + return listenerList.getListeners(MenuListener.class);
> }
>
> /**
> @@ -1306,7 +1307,7 @@
> * @return the array of menu items
> */
> private MenuElement[] buildMenuElementArray(JMenu leaf) {
> - Vector elements = new Vector();
> + Vector<JComponent> elements = new Vector<JComponent>();
> Component current = leaf.getPopupMenu();
> JPopupMenu pop;
> JMenu menu;
> @@ -1626,3 +1627,4 @@
>
> }
>
> +
> Index: classes/javax/swing/JMenuBar.java
> ===================================================================
> --- classes/javax/swing/JMenuBar.java (revision 250)
> +++ classes/javax/swing/JMenuBar.java (working copy)
> @@ -78,6 +78,7 @@
> * @author Georges Saab
> * @author David Karlton
> * @author Arnaud Weber
> + * @author Florian Brunner
> * @see JMenu
> * @see JPopupMenu
> * @see JMenuItem
> @@ -413,7 +414,7 @@
> */
> public MenuElement[] getSubElements() {
> MenuElement result[];
> - Vector tmp = new Vector();
> + Vector<MenuElement> tmp = new Vector<MenuElement>();
> int c = getComponentCount();
> int i;
> Component m;
> @@ -421,12 +422,12 @@
> for(i=0 ; i < c ; i++) {
> m = getComponent(i);
> if(m instanceof MenuElement)
> - tmp.addElement(m);
> + tmp.addElement((MenuElement) m);
> }
>
> result = new MenuElement[tmp.size()];
> for(i=0,c=tmp.size() ; i < c ; i++)
> - result[i] = (MenuElement) tmp.elementAt(i);
> + result[i] = tmp.elementAt(i);
> return result;
> }
>
> @@ -764,3 +765,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/JMenuItem.java
> ===================================================================
> --- classes/javax/swing/JMenuItem.java (revision 250)
> +++ classes/javax/swing/JMenuItem.java (working copy)
> @@ -83,6 +83,7 @@
> * @version 1.134 05/05/07
> * @author Georges Saab
> * @author David Karlton
> + * @author Florian Brunner
> * @see JPopupMenu
> * @see JMenu
> * @see JCheckBoxMenuItem
> @@ -276,7 +277,7 @@
> * hidden: true
> */
> public void setArmed(boolean b) {
> - ButtonModel model = (ButtonModel) getModel();
> + ButtonModel model = getModel();
>
> boolean oldValue = model.isArmed();
> if(model.isArmed() != b) {
> @@ -291,7 +292,7 @@
> * @see #setArmed
> */
> public boolean isArmed() {
> - ButtonModel model = (ButtonModel) getModel();
> + ButtonModel model = getModel();
> return model.isArmed();
> }
>
> @@ -722,8 +723,7 @@
> * @since 1.4
> */
> public MenuDragMouseListener[] getMenuDragMouseListeners() {
> - return (MenuDragMouseListener[])listenerList.getListeners(
> - MenuDragMouseListener.class);
> + return listenerList.getListeners(MenuDragMouseListener.class);
> }
>
> /**
> @@ -753,8 +753,7 @@
> * @since 1.4
> */
> public MenuKeyListener[] getMenuKeyListeners() {
> - return (MenuKeyListener[])listenerList.getListeners(
> - MenuKeyListener.class);
> + return listenerList.getListeners(MenuKeyListener.class);
> }
>
> /**
> @@ -949,3 +948,4 @@
>
> }
>
> +
> Index: classes/javax/swing/JOptionPane.java
> ===================================================================
> --- classes/javax/swing/JOptionPane.java (revision 250)
> +++ classes/javax/swing/JOptionPane.java (working copy)
> @@ -312,6 +312,7 @@
> * @version 1.108 05/05/07
> * @author James Gosling
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class JOptionPane extends JComponent implements Accessible
> {
> @@ -964,7 +965,7 @@
> }
> if (window instanceof SwingUtilities.SharedOwnerFrame) {
> WindowListener ownerShutdownListener =
> - (WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
> + SwingUtilities.getSharedOwnerFrameShutdownListener();
> dialog.addWindowListener(ownerShutdownListener);
> }
> initDialog(dialog, style, parentComponent);
> @@ -1301,11 +1302,11 @@
>
> // Use reflection to get Container.startLWModal.
> try {
> - Object obj;
> - obj = AccessController.doPrivileged(new ModalPrivilegedAction(
> + Method method;
> + method = AccessController.doPrivileged(new ModalPrivilegedAction(
> Container.class, "startLWModal"));
> - if (obj != null) {
> - ((Method)obj).invoke(dialog, (Object[])null);
> + if (method != null) {
> + method.invoke(dialog, (Object[])null);
> }
> } catch (IllegalAccessException ex) {
> } catch (IllegalArgumentException ex) {
> @@ -1447,11 +1448,11 @@
>
> // Use reflection to get Container.startLWModal.
> try {
> - Object obj;
> - obj = AccessController.doPrivileged(new ModalPrivilegedAction(
> + Method method;
> + method = AccessController.doPrivileged(new ModalPrivilegedAction(
> Container.class, "startLWModal"));
> - if (obj != null) {
> - ((Method)obj).invoke(dialog, (Object[])null);
> + if (method != null) {
> + method.invoke(dialog, (Object[])null);
> }
> } catch (IllegalAccessException ex) {
> } catch (IllegalArgumentException ex) {
> @@ -1532,12 +1533,12 @@
> event.getPropertyName().equals(VALUE_PROPERTY)) {
> // Use reflection to get Container.stopLWModal().
> try {
> - Object obj;
> - obj = AccessController.doPrivileged(
> + Method method;
> + method = AccessController.doPrivileged(
> new ModalPrivilegedAction(
> Container.class, "stopLWModal"));
> - if (obj != null) {
> - ((Method)obj).invoke(iFrame, (Object[])null);
> + if (method != null) {
> + method.invoke(iFrame, (Object[])null);
> }
> } catch (IllegalAccessException ex) {
> } catch (IllegalArgumentException ex) {
> @@ -2328,7 +2329,7 @@
>
> // Serialization support.
> private void writeObject(ObjectOutputStream s) throws IOException {
> - Vector values = new Vector();
> + Vector<Object> values = new Vector<Object>();
>
> s.defaultWriteObject();
> // Save the icon, if its Serializable.
> @@ -2343,7 +2344,7 @@
> }
> // Save the treeModel, if its Serializable.
> if(options != null) {
> - Vector serOptions = new Vector();
> + Vector<Object> serOptions = new Vector<Object>();
>
> for(int counter = 0, maxCounter = options.length;
> counter < maxCounter; counter++)
> @@ -2511,16 +2512,16 @@
> /**
> * Retrieves a method from the provided class and makes it accessible.
> */
> - private static class ModalPrivilegedAction implements PrivilegedAction {
> - private Class clazz;
> + private static class ModalPrivilegedAction implements PrivilegedAction<Method> {
> + private Class<?> clazz;
> private String methodName;
>
> - public ModalPrivilegedAction(Class clazz, String methodName) {
> + public ModalPrivilegedAction(Class<?> clazz, String methodName) {
> this.clazz = clazz;
> this.methodName = methodName;
> }
>
> - public Object run() {
> + public Method run() {
> Method method = null;
> try {
> method = clazz.getDeclaredMethod(methodName, (Class[])null);
> @@ -2596,3 +2597,4 @@
> } // inner class AccessibleJOptionPane
> }
>
> +
> Index: classes/javax/swing/JPopupMenu.java
> ===================================================================
> --- classes/javax/swing/JPopupMenu.java (revision 250)
> +++ classes/javax/swing/JPopupMenu.java (working copy)
> @@ -80,6 +80,7 @@
> * @author Georges Saab
> * @author David Karlton
> * @author Arnaud Weber
> + * @author Florian Brunner
> */
> public class JPopupMenu extends JComponent implements Accessible,MenuElement {
>
> @@ -557,7 +558,7 @@
>
> int nitems = getComponentCount();
> // PENDING(ges): Why not use an array?
> - Vector tempItems = new Vector();
> + Vector<Component> tempItems = new Vector<Component>();
>
> /* Remove the item at index, nitems-index times
> storing them in a temporary vector in the
> @@ -574,7 +575,7 @@
> already in the correct order in the temp vector.
> */
> for (int i = 0; i < tempItems.size() ; i++) {
> - add((Component)tempItems.elementAt(i));
> + add(tempItems.elementAt(i));
> }
> }
>
> @@ -605,8 +606,7 @@
> * @since 1.4
> */
> public PopupMenuListener[] getPopupMenuListeners() {
> - return (PopupMenuListener[])listenerList.getListeners(
> - PopupMenuListener.class);
> + return listenerList.getListeners(PopupMenuListener.class);
> }
>
> /**
> @@ -638,8 +638,7 @@
> * @since 1.5
> */
> public MenuKeyListener[] getMenuKeyListeners() {
> - return (MenuKeyListener[])listenerList.getListeners(
> - MenuKeyListener.class);
> + return listenerList.getListeners(MenuKeyListener.class);
> }
>
> /**
> @@ -1291,7 +1290,7 @@
> // Serialization support.
> ////////////
> private void writeObject(ObjectOutputStream s) throws IOException {
> - Vector values = new Vector();
> + Vector<Object> values = new Vector<Object>();
>
> s.defaultWriteObject();
> // Save the invoker, if its Serializable.
> @@ -1474,7 +1473,7 @@
> */
> public MenuElement[] getSubElements() {
> MenuElement result[];
> - Vector tmp = new Vector();
> + Vector<MenuElement> tmp = new Vector<MenuElement>();
> int c = getComponentCount();
> int i;
> Component m;
> @@ -1482,12 +1481,12 @@
> for(i=0 ; i < c ; i++) {
> m = getComponent(i);
> if(m instanceof MenuElement)
> - tmp.addElement(m);
> + tmp.addElement((MenuElement) m);
> }
>
> result = new MenuElement[tmp.size()];
> for(i=0,c=tmp.size() ; i < c ; i++)
> - result[i] = (MenuElement) tmp.elementAt(i);
> + result[i] = tmp.elementAt(i);
> return result;
> }
>
> @@ -1537,3 +1536,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/JProgressBar.java
> ===================================================================
> --- classes/javax/swing/JProgressBar.java (revision 250)
> +++ classes/javax/swing/JProgressBar.java (working copy)
> @@ -129,6 +129,7 @@
> * @version 1.102 05/05/07
> * @author Michael C. Albers
> * @author Kathy Walrath
> + * @author Florian Brunner
> */
> public class JProgressBar extends JComponent implements SwingConstants, Accessible
> {
> @@ -700,8 +701,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
> /**
> Index: classes/javax/swing/JScrollBar.java
> ===================================================================
> --- classes/javax/swing/JScrollBar.java (revision 250)
> +++ classes/javax/swing/JScrollBar.java (working copy)
> @@ -78,6 +78,7 @@
> *
> * @version 1.87 05/05/07
> * @author David Kloba
> + * @author Florian Brunner
> */
> public class JScrollBar extends JComponent implements Adjustable, Accessible
> {
> @@ -660,8 +661,7 @@
> * @since 1.4
> */
> public AdjustmentListener[] getAdjustmentListeners() {
> - return (AdjustmentListener[])listenerList.getListeners(
> - AdjustmentListener.class);
> + return listenerList.getListeners(AdjustmentListener.class);
> }
>
>
> Index: classes/javax/swing/JSlider.java
> ===================================================================
> --- classes/javax/swing/JSlider.java (revision 250)
> +++ classes/javax/swing/JSlider.java (working copy)
> @@ -80,6 +80,7 @@
> *
> * @version 1.116 05/05/07
> * @author David Kloba
> + * @author Florian Brunner
> */
> public class JSlider extends JComponent implements SwingConstants, Accessible {
> /**
> @@ -410,8 +411,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
>
> @@ -914,7 +914,7 @@
> throw new IllegalArgumentException( "Label incremement must be > 0" );
> }
>
> - class SmartHashtable extends Hashtable implements PropertyChangeListener {
> + class SmartHashtable extends Hashtable<Object, Object> implements PropertyChangeListener {
> int increment = 0;
> int start = 0;
> boolean startAtMin = false;
> @@ -963,7 +963,7 @@
>
> Enumeration keys = getLabelTable().keys();
> Object key = null;
> - Hashtable hashtable = new Hashtable();
> + Hashtable<Object, Object> hashtable = new Hashtable<Object, Object>();
>
> // Save the labels that were added by the developer
> while ( keys.hasMoreElements() ) {
> Index: classes/javax/swing/JSpinner.java
> ===================================================================
> --- classes/javax/swing/JSpinner.java (revision 250)
> +++ classes/javax/swing/JSpinner.java (working copy)
> @@ -123,6 +123,7 @@
> * @version 1.57 05/05/07
> * @author Hans Muller
> * @author Lynn Monsanto (accessibility)
> + * @author Florian Brunner
> * @since 1.4
> */
> public class JSpinner extends JComponent implements Accessible
> @@ -433,8 +434,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
>
> Index: classes/javax/swing/JTabbedPane.java
> ===================================================================
> --- classes/javax/swing/JTabbedPane.java (revision 250)
> +++ classes/javax/swing/JTabbedPane.java (working copy)
> @@ -104,6 +104,7 @@
> * @author Dave Moore
> * @author Philip Milne
> * @author Amy Fowler
> + * @author Florian Brunner
> *
> * @see SingleSelectionModel
> */
> @@ -314,8 +315,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
> /**
> Index: classes/javax/swing/JTable.java
> ===================================================================
> --- classes/javax/swing/JTable.java (revision 250)
> +++ classes/javax/swing/JTable.java (working copy)
> @@ -211,6 +211,7 @@
> * @version 1.294 05/05/07
> * @author Philip Milne
> * @author Shannon Hickey (printing support)
> + * @author Florian Brunner
> * @see javax.swing.table.DefaultTableModel
> * @see javax.swing.table.TableRowSorter
> */
> @@ -1678,9 +1679,9 @@
> if (!forDrop && state != null) {
> clearSelection();
>
> - int[] rows = (int[])((int[][])state)[0];
> - int[] cols = (int[])((int[][])state)[1];
> - int[] anchleads = (int[])((int[][])state)[2];
> + int[] rows = ((int[][])state)[0];
> + int[] cols = ((int[][])state)[1];
> + int[] anchleads = ((int[][])state)[2];
>
> for (int i = 0; i < rows.length; i++) {
> addRowSelectionInterval(rows[i], rows[i]);
> @@ -1777,7 +1778,7 @@
> boolean oldValue = this.autoCreateRowSorter;
> this.autoCreateRowSorter = autoCreateRowSorter;
> if (autoCreateRowSorter) {
> - setRowSorter(new TableRowSorter(getModel()));
> + setRowSorter(new TableRowSorter<TableModel>(getModel()));
> }
> firePropertyChange("autoCreateRowSorter", oldValue,
> autoCreateRowSorter);
> @@ -3634,7 +3635,7 @@
> firePropertyChange("model", old, dataModel);
>
> if (getAutoCreateRowSorter()) {
> - setRowSorter(new TableRowSorter(dataModel));
> + setRowSorter(new TableRowSorter<TableModel>(dataModel));
> }
> }
> }
> @@ -5249,7 +5250,7 @@
> return retValue;
> }
>
> - private void setLazyValue(Hashtable h, Class c, String s) {
> + private void setLazyValue(Hashtable<Object, Object> h, Class c, String s) {
> h.put(c, new UIDefaults.ProxyLazyValue(s));
> }
>
> @@ -5428,7 +5429,7 @@
> this.value = null;
> ((JComponent)getComponent()).setBorder(new LineBorder(Color.black));
> try {
> - Class type = table.getColumnClass(column);
> + Class<?> type = table.getColumnClass(column);
> // Since our obligation is to produce a value which is
> // assignable for the required type it is OK to use the
> // String constructor for columns which are declared
> Index: classes/javax/swing/JTextField.java
> ===================================================================
> --- classes/javax/swing/JTextField.java (revision 250)
> +++ classes/javax/swing/JTextField.java (working copy)
> @@ -155,6 +155,7 @@
> * description: A component which allows for the editing of a single line of text.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.101 05/05/07
> * @see #setActionCommand
> * @see JPasswordField
> @@ -476,8 +477,7 @@
> * @since 1.4
> */
> public synchronized ActionListener[] getActionListeners() {
> - return (ActionListener[])listenerList.getListeners(
> - ActionListener.class);
> + return listenerList.getListeners(ActionListener.class);
> }
>
> /**
> Index: classes/javax/swing/JTree.java
> ===================================================================
> --- classes/javax/swing/JTree.java (revision 250)
> +++ classes/javax/swing/JTree.java (working copy)
> @@ -142,6 +142,7 @@
> * @author Rob Davis
> * @author Ray Ryan
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class JTree extends JComponent implements Scrollable, Accessible
> {
> @@ -188,7 +189,7 @@
> * information must be determined by visiting all the parent
> * paths and seeing if they are visible.
> */
> - transient private Hashtable expandedState;
> + transient private Hashtable<TreePath, Boolean> expandedState;
>
>
> /**
> @@ -282,7 +283,7 @@
> * Used when <code>setExpandedState</code> is invoked,
> * will be a <code>Stack</code> of <code>Stack</code>s.
> */
> - transient private Stack expandedStack;
> + transient private Stack<Stack<TreePath>> expandedStack;
>
> /**
> * Lead selection path, may not be <code>null</code>.
> @@ -653,9 +654,9 @@
> @ConstructorProperties({"model"})
> public JTree(TreeModel newModel) {
> super();
> - expandedStack = new Stack();
> + expandedStack = new Stack<Stack<TreePath>>();
> toggleClickCount = 2;
> - expandedState = new Hashtable();
> + expandedState = new Hashtable<TreePath, Boolean>();
> setLayout(null);
> rowHeight = 16;
> visibleRowCount = 20;
> @@ -1942,7 +1943,7 @@
> return null;
>
> Enumeration toggledPaths = expandedState.keys();
> - Vector elements = null;
> + Vector<TreePath> elements = null;
> TreePath path;
> Object value;
>
> @@ -1957,7 +1958,7 @@
> ((Boolean)value).booleanValue() &&
> parent.isDescendant(path) && isVisible(path)) {
> if (elements == null) {
> - elements = new Vector();
> + elements = new Vector<TreePath>();
> }
> elements.addElement(path);
> }
> @@ -2019,7 +2020,7 @@
> TreePath path = tree.getPathForRow(this, row);
>
> if(path != null) {
> - Boolean value = (Boolean)expandedState.get(path);
> + Boolean value = expandedState.get(path);
>
> return (value != null && value.booleanValue());
> }
> @@ -2705,8 +2706,7 @@
> * @since 1.4
> */
> public TreeExpansionListener[] getTreeExpansionListeners() {
> - return (TreeExpansionListener[])listenerList.getListeners(
> - TreeExpansionListener.class);
> + return listenerList.getListeners(TreeExpansionListener.class);
> }
>
> /**
> @@ -2738,8 +2738,7 @@
> * @since 1.4
> */
> public TreeWillExpandListener[] getTreeWillExpandListeners() {
> - return (TreeWillExpandListener[])listenerList.getListeners(
> - TreeWillExpandListener.class);
> + return listenerList.getListeners(TreeWillExpandListener.class);
> }
>
> /**
> @@ -2896,8 +2895,7 @@
> * @since 1.4
> */
> public TreeSelectionListener[] getTreeSelectionListeners() {
> - return (TreeSelectionListener[])listenerList.getListeners(
> - TreeSelectionListener.class);
> + return listenerList.getListeners(TreeSelectionListener.class);
> }
>
> /**
> @@ -3031,7 +3029,7 @@
>
> // Serialization support.
> private void writeObject(ObjectOutputStream s) throws IOException {
> - Vector values = new Vector();
> + Vector<Object> values = new Vector<Object>();
>
> s.defaultWriteObject();
> // Save the cellRenderer, if its Serializable.
> @@ -3078,9 +3076,9 @@
>
> // Create an instance of expanded state.
>
> - expandedState = new Hashtable();
> + expandedState = new Hashtable<TreePath, Boolean>();
>
> - expandedStack = new Stack();
> + expandedStack = new Stack<Stack<TreePath>>();
>
> Vector values = (Vector)s.readObject();
> int indexCounter = 0;
> @@ -3136,7 +3134,7 @@
> Enumeration paths = expandedState.keys();
>
> if(paths != null) {
> - Vector state = new Vector();
> + Vector<Object> state = new Vector<Object>();
>
> while(paths.hasMoreElements()) {
> TreePath path = (TreePath)paths.nextElement();
> @@ -3536,14 +3534,14 @@
> protected void setExpandedState(TreePath path, boolean state) {
> if(path != null) {
> // Make sure all parents of path are expanded.
> - Stack stack;
> - TreePath parentPath = path.getParentPath();
> + Stack<TreePath> stack;
> + TreePath parentPath = path.getParentPath();
>
> if (expandedStack.size() == 0) {
> - stack = new Stack();
> + stack = new Stack<TreePath>();
> }
> else {
> - stack = (Stack)expandedStack.pop();
> + stack = expandedStack.pop();
> }
>
> try {
> @@ -3557,7 +3555,7 @@
> }
> }
> for(int counter = stack.size() - 1; counter >= 0; counter--) {
> - parentPath = (TreePath)stack.pop();
> + parentPath = stack.pop();
> if(!isExpanded(parentPath)) {
> try {
> fireTreeWillExpand(parentPath);
> @@ -3637,12 +3635,10 @@
> if(parent == null)
> return null;
>
> - Vector descendants = new Vector();
> - Enumeration nodes = expandedState.keys();
> - TreePath path;
> + Vector<TreePath> descendants = new Vector<TreePath>();
> + Set<TreePath> nodes = expandedState.keySet();
>
> - while(nodes.hasMoreElements()) {
> - path = (TreePath)nodes.nextElement();
> + for(TreePath path : nodes) {
> if(parent.isDescendant(path))
> descendants.addElement(path);
> }
> @@ -3665,8 +3661,8 @@
> {
> if(toRemove != null) {
> while(toRemove.hasMoreElements()) {
> - Enumeration descendants = getDescendantToggledPaths
> - ((TreePath)toRemove.nextElement());
> + Enumeration descendants = getDescendantToggledPaths
> + (toRemove.nextElement());
>
> if(descendants != null) {
> while(descendants.hasMoreElements()) {
> @@ -5512,3 +5508,4 @@
>
> } // End of class JTree
>
> +
> Index: classes/javax/swing/JViewport.java
> ===================================================================
> --- classes/javax/swing/JViewport.java (revision 250)
> +++ classes/javax/swing/JViewport.java (working copy)
> @@ -100,6 +100,7 @@
> * @version 1.128 05/05/07
> * @author Hans Muller
> * @author Philip Milne
> + * @author Florian Brunner
> * @see JScrollPane
> */
> public class JViewport extends JComponent implements Accessible
> @@ -1379,8 +1380,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
> /**
> Index: classes/javax/swing/JWindow.java
> ===================================================================
> --- classes/javax/swing/JWindow.java (revision 250)
> +++ classes/javax/swing/JWindow.java (working copy)
> @@ -89,6 +89,7 @@
> *
> * @version 1.74 05/05/07
> * @author David Kloba
> + * @author Florian Brunner
> */
> public class JWindow extends Window implements Accessible,
> RootPaneContainer,
> @@ -186,7 +187,7 @@
> super(owner == null? SwingUtilities.getSharedOwnerFrame() : owner);
> if (owner == null) {
> WindowListener ownerShutdownListener =
> - (WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
> + SwingUtilities.getSharedOwnerFrameShutdownListener();
> addWindowListener(ownerShutdownListener);
> }
> windowInit();
> @@ -213,7 +214,7 @@
> owner);
> if (owner == null) {
> WindowListener ownerShutdownListener =
> - (WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
> + SwingUtilities.getSharedOwnerFrameShutdownListener();
> addWindowListener(ownerShutdownListener);
> }
> windowInit();
> @@ -251,7 +252,7 @@
> owner, gc);
> if (owner == null) {
> WindowListener ownerShutdownListener =
> - (WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
> + SwingUtilities.getSharedOwnerFrameShutdownListener();
> addWindowListener(ownerShutdownListener);
> }
> windowInit();
> Index: classes/javax/swing/KeyboardManager.java
> ===================================================================
> --- classes/javax/swing/KeyboardManager.java (revision 250)
> +++ classes/javax/swing/KeyboardManager.java (working copy)
> @@ -60,6 +60,9 @@
> *
> *
> * @see InputMap
> + *
> + * @author unattributed
> + * @author Florian Brunner
> */
> class KeyboardManager {
>
> @@ -68,13 +71,13 @@
> /**
> * maps top-level containers to a sub-hashtable full of keystrokes
> */
> - Hashtable containerMap = new Hashtable();
> + Hashtable<Container, Hashtable<Object, Object>> containerMap = new Hashtable<Container, Hashtable<Object, Object>>();
>
> /**
> * Maps component/keystroke pairs to a topLevel container
> * This is mainly used for fast unregister operations
> */
> - Hashtable componentKeyStrokeMap = new Hashtable();
> + Hashtable<ComponentKeyStrokePair, Container> componentKeyStrokeMap = new Hashtable<ComponentKeyStrokePair, Container>();
>
> public static KeyboardManager getCurrentManager() {
> return currentManager;
> @@ -95,7 +98,7 @@
> if (topContainer == null) {
> return;
> }
> - Hashtable keyMap = (Hashtable)containerMap.get(topContainer);
> + Hashtable<Object, Object> keyMap = containerMap.get(topContainer);
>
> if (keyMap == null) { // lazy evaluate one
> keyMap = registerNewTopContainer(topContainer);
> @@ -105,7 +108,7 @@
> 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;
> + Vector<JComponent> v = (Vector<JComponent>)tmp;
> if (!v.contains(c)) { // only add if this keystroke isn't registered for this component
> v.addElement(c);
> }
> @@ -114,8 +117,8 @@
> // 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 v = new Vector();
> - v.addElement(tmp);
> + Vector<JComponent> v = new Vector<JComponent>();
> + v.addElement((JComponent) tmp);
> v.addElement(c);
> keyMap.put(k, v);
> }
> @@ -293,17 +296,17 @@
> if (top == null) {
> return;
> }
> - Hashtable keyMap = (Hashtable)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);
> + Vector<JMenuBar> menuBars = (Vector<JMenuBar>)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<JMenuBar>();
> keyMap.put(JMenuBar.class, menuBars);
> }
>
> @@ -334,7 +337,7 @@
> }
> }
> protected Hashtable registerNewTopContainer(Container topContainer) {
> - Hashtable keyMap = new Hashtable();
> + Hashtable<Object, Object> keyMap = new Hashtable<Object, Object>();
> containerMap.put(topContainer, keyMap);
> return keyMap;
> }
> Index: classes/javax/swing/LayoutComparator.java
> ===================================================================
> --- classes/javax/swing/LayoutComparator.java (revision 250)
> +++ classes/javax/swing/LayoutComparator.java (working copy)
> @@ -39,8 +39,9 @@
> *
> * @version 1.14, 05/05/07
> * @author David Mendenhall
> + * @author Florian Brunner
> */
> -final class LayoutComparator implements Comparator, java.io.Serializable {
> +final class LayoutComparator implements Comparator<Component>, java.io.Serializable {
>
> private static final int ROW_TOLERANCE = 10;
>
> @@ -52,10 +53,7 @@
> leftToRight = orientation.isLeftToRight();
> }
>
> - public int compare(Object o1, Object o2) {
> - Component a = (Component)o1;
> - Component b = (Component)o2;
> -
> + public int compare(Component a, Component b) {
> if (a == b) {
> return 0;
> }
> @@ -66,9 +64,9 @@
> // each Component and then search from the Window down until the
> // hierarchy branches.
> if (a.getParent() != b.getParent()) {
> - LinkedList aAncestory, bAncestory;
> + LinkedList<Component> aAncestory, bAncestory;
>
> - for(aAncestory = new LinkedList(); a != null; a = a.getParent()) {
> + for(aAncestory = new LinkedList<Component>(); a != null; a = a.getParent()) {
> aAncestory.add(a);
> if (a instanceof Window) {
> break;
> @@ -79,7 +77,7 @@
> throw new ClassCastException();
> }
>
> - for(bAncestory = new LinkedList(); b != null; b = b.getParent()) {
> + for(bAncestory = new LinkedList<Component>(); b != null; b = b.getParent()) {
> bAncestory.add(b);
> if (b instanceof Window) {
> break;
> @@ -90,18 +88,18 @@
> throw new ClassCastException();
> }
>
> - for (ListIterator
> + for (ListIterator<Component>
> aIter = aAncestory.listIterator(aAncestory.size()),
> bIter = bAncestory.listIterator(bAncestory.size()); ;) {
> if (aIter.hasPrevious()) {
> - a = (Component)aIter.previous();
> + a = aIter.previous();
> } else {
> // a is an ancestor of b
> return -1;
> }
>
> if (bIter.hasPrevious()) {
> - b = (Component)bIter.previous();
> + b = bIter.previous();
> } else {
> // b is an ancestor of a
> return 1;
> Index: classes/javax/swing/LayoutFocusTraversalPolicy.java
> ===================================================================
> --- classes/javax/swing/LayoutFocusTraversalPolicy.java (revision 250)
> +++ classes/javax/swing/LayoutFocusTraversalPolicy.java (working copy)
> @@ -43,6 +43,7 @@
> *
> * @version 1.18, 05/05/07
> * @author David Mendenhall
> + * @author Florian Brunner
> *
> * @see java.awt.ComponentOrientation
> * @since 1.4
> @@ -66,7 +67,7 @@
> * Constructs a LayoutFocusTraversalPolicy with the passed in
> * <code>Comparator</code>.
> */
> - LayoutFocusTraversalPolicy(Comparator c) {
> + LayoutFocusTraversalPolicy(Comparator<? super Component> c) {
> super(c);
> }
>
> @@ -258,7 +259,7 @@
> private void readObject(ObjectInputStream in)
> throws IOException, ClassNotFoundException
> {
> - setComparator((Comparator)in.readObject());
> + setComparator((Comparator<? super Component>)in.readObject());
> setImplicitDownCycleTraversal(in.readBoolean());
> }
> }
> Index: classes/javax/swing/LegacyGlueFocusTraversalPolicy.java
> ===================================================================
> --- classes/javax/swing/LegacyGlueFocusTraversalPolicy.java (revision 250)
> +++ classes/javax/swing/LegacyGlueFocusTraversalPolicy.java (working copy)
> @@ -42,6 +42,7 @@
> *
> * @version 1.13, 05/05/07
> * @author David Mendenhall
> + * @author Florian Brunner
> */
> final class LegacyGlueFocusTraversalPolicy extends FocusTraversalPolicy
> implements Serializable
> @@ -49,8 +50,8 @@
> private transient FocusTraversalPolicy delegatePolicy;
> private transient DefaultFocusManager delegateManager;
>
> - private HashMap forwardMap = new HashMap(),
> - backwardMap = new HashMap();
> + private HashMap<Component, Component> forwardMap = new HashMap<Component, Component>(),
> + backwardMap = new HashMap<Component, Component>();
>
> LegacyGlueFocusTraversalPolicy(FocusTraversalPolicy delegatePolicy) {
> this.delegatePolicy = delegatePolicy;
> @@ -71,11 +72,11 @@
> public Component getComponentAfter(Container focusCycleRoot,
> Component aComponent) {
> Component hardCoded = aComponent, prevHardCoded;
> - HashSet sanity = new HashSet();
> + HashSet<Component> sanity = new HashSet<Component>();
>
> do {
> prevHardCoded = hardCoded;
> - hardCoded = (Component)forwardMap.get(hardCoded);
> + hardCoded = forwardMap.get(hardCoded);
> if (hardCoded == null) {
> if (delegatePolicy != null &&
> prevHardCoded.isFocusCycleRoot(focusCycleRoot)) {
> @@ -100,11 +101,11 @@
> public Component getComponentBefore(Container focusCycleRoot,
> Component aComponent) {
> Component hardCoded = aComponent, prevHardCoded;
> - HashSet sanity = new HashSet();
> + HashSet<Component> sanity = new HashSet<Component>();
>
> do {
> prevHardCoded = hardCoded;
> - hardCoded = (Component)backwardMap.get(hardCoded);
> + hardCoded = backwardMap.get(hardCoded);
> if (hardCoded == null) {
> if (delegatePolicy != null &&
> prevHardCoded.isFocusCycleRoot(focusCycleRoot)) {
> Index: classes/javax/swing/MenuSelectionManager.java
> ===================================================================
> --- classes/javax/swing/MenuSelectionManager.java (revision 250)
> +++ classes/javax/swing/MenuSelectionManager.java (working copy)
> @@ -36,9 +36,10 @@
> *
> * @version 1.47 05/05/07
> * @author Arnaud Weber
> + * @author Florian Brunner
> */
> public class MenuSelectionManager {
> - private Vector selection = new Vector();
> + private Vector<MenuElement> selection = new Vector<MenuElement>();
>
> /* diagnostic aids -- should be false for production builds. */
> private static final boolean TRACE = false; // trace creates and disposes
> @@ -101,14 +102,14 @@
> }
>
> for(i=0,c=path.length;i<c;i++) {
> - if(i < currentSelectionCount && (MenuElement)selection.elementAt(i) == path[i])
> + if(i < currentSelectionCount && selection.elementAt(i) == path[i])
> firstDifference++;
> else
> break;
> }
>
> for(i=currentSelectionCount - 1 ; i >= firstDifference ; i--) {
> - MenuElement me = (MenuElement)selection.elementAt(i);
> + MenuElement me = selection.elementAt(i);
> selection.removeElementAt(i);
> me.menuSelectionChanged(false);
> }
> @@ -132,7 +133,7 @@
> MenuElement res[] = new MenuElement[selection.size()];
> int i,c;
> for(i=0,c=selection.size();i<c;i++)
> - res[i] = (MenuElement) selection.elementAt(i);
> + res[i] = selection.elementAt(i);
> return res;
> }
>
> @@ -173,8 +174,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
> /**
> @@ -337,7 +337,7 @@
> for(i=0,j=path.length; i<j ;i++){
> for (int k=0; k<=i; k++)
> System.out.print(" ");
> - MenuElement me = (MenuElement) path[i];
> + MenuElement me = path[i];
> if(me instanceof JMenuItem) {
> System.out.println(((JMenuItem)me).getText() + ", ");
> } else if (me instanceof JMenuBar) {
> @@ -428,7 +428,7 @@
> */
> public void processKeyEvent(KeyEvent e) {
> MenuElement[] sel2 = new MenuElement[0];
> - sel2 = (MenuElement[])selection.toArray(sel2);
> + sel2 = selection.toArray(sel2);
> int selSize = sel2.length;
> MenuElement[] path;
>
> @@ -473,7 +473,7 @@
> */
> public boolean isComponentPartOfCurrentMenu(Component c) {
> if(selection.size() > 0) {
> - MenuElement me = (MenuElement)selection.elementAt(0);
> + MenuElement me = selection.elementAt(0);
> return isComponentPartOfCurrentMenu(me,c);
> } else
> return false;
> @@ -500,3 +500,4 @@
> }
>
>
> +
> Index: classes/javax/swing/MultiUIDefaults.java
> ===================================================================
> --- classes/javax/swing/MultiUIDefaults.java (revision 250)
> +++ classes/javax/swing/MultiUIDefaults.java (working copy)
> @@ -34,6 +34,7 @@
> *
> * @version 1.10 02/02/00
> * @author Hans Muller
> + * @author Florian Brunner
> */
> class MultiUIDefaults extends UIDefaults
> {
> @@ -103,7 +104,7 @@
> }
>
>
> - public Enumeration keys()
> + public Enumeration<Object> keys()
> {
> Enumeration[] enums = new Enumeration[1 + tables.length];
> enums[0] = super.keys();
> @@ -117,7 +118,7 @@
> }
>
>
> - public Enumeration elements()
> + public Enumeration<Object> elements()
> {
> Enumeration[] enums = new Enumeration[1 + tables.length];
> enums[0] = super.elements();
> @@ -138,7 +139,7 @@
> }
> }
>
> - private static class MultiUIDefaultsEnumerator implements Enumeration
> + private static class MultiUIDefaultsEnumerator implements Enumeration<Object>
> {
> Enumeration[] enums;
> int n = 0;
> Index: classes/javax/swing/plaf/basic/BasicButtonListener.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicButtonListener.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicButtonListener.java (working copy)
> @@ -42,6 +42,7 @@
> * @version 1.75 05/05/07
> * @author Jeff Dinkins
> * @author Arnaud Weber (keyboard UI support)
> + * @author Florian Brunner
> */
>
> public class BasicButtonListener implements MouseListener, MouseMotionListener,
> @@ -166,7 +167,7 @@
> JRootPane root = b.getRootPane();
> if (root != null) {
> BasicButtonUI ui = (BasicButtonUI)BasicLookAndFeel.getUIOfType(
> - ((AbstractButton)b).getUI(), BasicButtonUI.class);
> + b.getUI(), BasicButtonUI.class);
> if (ui != null && DefaultLookup.getBoolean(b, ui,
> ui.getPropertyPrefix() +
> "defaultButtonFollowsFocus", true)) {
> @@ -186,7 +187,7 @@
> JButton initialDefault = (JButton)root.getClientProperty("initialDefaultButton");
> if (b != initialDefault) {
> BasicButtonUI ui = (BasicButtonUI)BasicLookAndFeel.getUIOfType(
> - ((AbstractButton)b).getUI(), BasicButtonUI.class);
> + b.getUI(), BasicButtonUI.class);
> if (ui != null && DefaultLookup.getBoolean(b, ui,
> ui.getPropertyPrefix() +
> "defaultButtonFollowsFocus", true)) {
> Index: classes/javax/swing/plaf/basic/BasicButtonUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicButtonUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicButtonUI.java (working copy)
> @@ -43,6 +43,7 @@
> *
> * @version 1.124 05/05/07
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public class BasicButtonUI extends ButtonUI{
> // Shared UI object
> @@ -238,7 +239,7 @@
>
> /* the fallback icon should be based on the selected state */
> if (model.isSelected()) {
> - selectedIcon = (Icon) b.getSelectedIcon();
> + selectedIcon = b.getSelectedIcon();
> if (selectedIcon != null) {
> icon = selectedIcon;
> }
> @@ -246,31 +247,31 @@
>
> if(!model.isEnabled()) {
> if(model.isSelected()) {
> - tmpIcon = (Icon) b.getDisabledSelectedIcon();
> + tmpIcon = b.getDisabledSelectedIcon();
> if (tmpIcon == null) {
> tmpIcon = selectedIcon;
> }
> }
>
> if (tmpIcon == null) {
> - tmpIcon = (Icon) b.getDisabledIcon();
> + tmpIcon = b.getDisabledIcon();
> }
> } else if(model.isPressed() && model.isArmed()) {
> - tmpIcon = (Icon) b.getPressedIcon();
> + tmpIcon = b.getPressedIcon();
> if(tmpIcon != null) {
> // revert back to 0 offset
> clearTextShiftOffset();
> }
> } else if(b.isRolloverEnabled() && model.isRollover()) {
> if(model.isSelected()) {
> - tmpIcon = (Icon) b.getRolloverSelectedIcon();
> + tmpIcon = b.getRolloverSelectedIcon();
> if (tmpIcon == null) {
> tmpIcon = selectedIcon;
> }
> }
>
> if (tmpIcon == null) {
> - tmpIcon = (Icon) b.getRolloverIcon();
> + tmpIcon = b.getRolloverIcon();
> }
> }
>
> Index: classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicComboBoxEditor.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicComboBoxEditor.java (working copy)
> @@ -42,6 +42,7 @@
> * @version 1.34 05/05/07
> * @author Arnaud Weber
> * @author Mark Davidson
> + * @author Florian Brunner
> */
> public class BasicComboBoxEditor implements ComboBoxEditor,FocusListener {
> protected JTextField editor;
> @@ -93,7 +94,7 @@
> return oldValue;
> } else {
> // Must take the value from the editor and get the value and cast it to the new type.
> - Class cls = oldValue.getClass();
> + Class<?> cls = oldValue.getClass();
> try {
> Method method = cls.getMethod("valueOf", new Class[]{String.class});
> newValue = method.invoke(oldValue, new Object[] { editor.getText()});
> @@ -166,3 +167,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/plaf/basic/BasicDirectoryModel.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicDirectoryModel.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicDirectoryModel.java (working copy)
> @@ -39,15 +39,16 @@
> *
> * @version %i% %g%
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public class BasicDirectoryModel extends AbstractListModel implements PropertyChangeListener {
>
> private JFileChooser filechooser = null;
> // PENDING(jeff) pick the size more sensibly
> - private Vector fileCache = new Vector(50);
> + private Vector<File> fileCache = new Vector<File>(50);
> private LoadFilesThread loadThread = null;
> - private Vector files = null;
> - private Vector directories = null;
> + private Vector<File> files = null;
> + private Vector<File> directories = null;
> private int fetchID = 0;
>
> private PropertyChangeSupport changeSupport;
> @@ -107,14 +108,14 @@
> if (files != null) {
> return files;
> }
> - files = new Vector();
> - directories = new Vector();
> + files = new Vector<File>();
> + directories = new Vector<File>();
> directories.addElement(filechooser.getFileSystemView().createFileObject(
> filechooser.getCurrentDirectory(), "..")
> );
>
> for (int i = 0; i < getSize(); i++) {
> - File f = (File)fileCache.get(i);
> + File f = fileCache.get(i);
> if (filechooser.isTraversable(f)) {
> directories.add(f);
> } else {
> @@ -216,7 +217,7 @@
> class LoadFilesThread extends Thread {
> File currentDirectory = null;
> int fid;
> - Vector runnables = new Vector(10);
> + Vector<Runnable> runnables = new Vector<Runnable>(10);
>
> public LoadFilesThread(File currentDirectory, int fid) {
> super("Basic L&F File Loading Thread");
> @@ -259,11 +260,11 @@
> // First sort alphabetically by filename
> sort(acceptsList);
>
> - Vector newDirectories = new Vector(50);
> - Vector newFiles = new Vector();
> + Vector<File> newDirectories = new Vector<File>(50);
> + Vector<File> newFiles = new Vector<File>();
> // run through list grabbing directories in chunks of ten
> for(int i = 0; i < acceptsList.size(); i++) {
> - File f = (File) acceptsList.elementAt(i);
> + File f = acceptsList.elementAt(i);
> boolean isTraversable = filechooser.isTraversable(f);
> if (isTraversable) {
> newDirectories.addElement(f);
> @@ -275,7 +276,7 @@
> }
> }
>
> - Vector newFileCache = new Vector(newDirectories);
> + Vector<File> newFileCache = new Vector<File>(newDirectories);
> newFileCache.addAll(newFiles);
>
> int newSize = newFileCache.size();
> @@ -321,7 +322,7 @@
> if(isInterrupted()) {
> return;
> }
> - invokeLater(new DoChangeContents(null, 0, new Vector(fileCache.subList(start, end)),
> + invokeLater(new DoChangeContents(null, 0, new Vector<File>(fileCache.subList(start, end)),
> start, fid));
> newFileCache = null;
> }
> @@ -450,15 +451,15 @@
>
>
> class DoChangeContents implements Runnable {
> - private List addFiles;
> - private List remFiles;
> + private List<File> addFiles;
> + private List<File> remFiles;
> private boolean doFire = true;
> private int fid;
> private int addStart = 0;
> private int remStart = 0;
> private int change;
>
> - public DoChangeContents(List addFiles, int addStart, List remFiles, int remStart, int fid) {
> + public DoChangeContents(List<File> addFiles, int addStart, List<File> remFiles, int remStart, int fid) {
> this.addFiles = addFiles;
> this.addStart = addStart;
> this.remFiles = remFiles;
> @@ -496,3 +497,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/plaf/basic/BasicFileChooserUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicFileChooserUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicFileChooserUI.java (working copy)
> @@ -46,6 +46,7 @@
> *
> * @version %i% %g%
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public class BasicFileChooserUI extends FileChooserUI {
>
> @@ -158,9 +159,9 @@
> }
>
> public void uninstallUI(JComponent c) {
> - uninstallListeners((JFileChooser) filechooser);
> - uninstallComponents((JFileChooser) filechooser);
> - uninstallDefaults((JFileChooser) filechooser);
> + uninstallListeners(filechooser);
> + uninstallComponents(filechooser);
> + uninstallDefaults(filechooser);
>
> if(accessoryPanel != null) {
> accessoryPanel.removeAll();
> @@ -498,7 +499,7 @@
> setDirectorySelected(true);
> setDirectory(((File)objects[0]));
> } else {
> - ArrayList fList = new ArrayList(objects.length);
> + ArrayList<File> fList = new ArrayList<File>(objects.length);
> for (int i = 0; i < objects.length; i++) {
> File f = (File)objects[i];
> boolean isDir = f.isDirectory();
> @@ -510,7 +511,7 @@
> }
> }
> if (fList.size() > 0) {
> - files = (File[])fList.toArray(new File[fList.size()]);
> + files = fList.toArray(new File[fList.size()]);
> }
> setDirectorySelected(false);
> }
> @@ -836,7 +837,7 @@
> }
>
> if (chooser.isMultiSelectionEnabled() && filename.startsWith("\"")) {
> - ArrayList fList = new ArrayList();
> + ArrayList<File> fList = new ArrayList<File>();
>
> filename = filename.substring(1);
> if (filename.endsWith("\"")) {
> @@ -872,7 +873,7 @@
> fList.add(file);
> } while (filename.length() > 0);
> if (fList.size() > 0) {
> - selectedFiles = (File[])fList.toArray(new File[fList.size()]);
> + selectedFiles = fList.toArray(new File[fList.size()]);
> }
> resetGlobFilter();
> } else {
> @@ -1196,7 +1197,7 @@
> }
>
> public Icon getCachedIcon(File f) {
> - return (Icon) iconCache.get(f);
> + return iconCache.get(f);
> }
>
> public void cacheIcon(File f, Icon i) {
> @@ -1320,7 +1321,7 @@
> */
> protected Object getRicherData(DataFlavor flavor) {
> if (DataFlavor.javaFileListFlavor.equals(flavor)) {
> - ArrayList files = new ArrayList();
> + ArrayList<Object> files = new ArrayList<Object>();
> for (int i = 0; i < fileData.length; i++) {
> files.add(fileData[i]);
> }
> Index: classes/javax/swing/plaf/basic/BasicGraphicsUtils.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicGraphicsUtils.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicGraphicsUtils.java (working copy)
> @@ -40,6 +40,7 @@
> /*
> * @version 1.44 02/11/99
> * @author Hans Muller
> + * @author Florian Brunner
> */
>
> public class BasicGraphicsUtils
> @@ -267,7 +268,7 @@
> return null;
> }
>
> - Icon icon = (Icon) b.getIcon();
> + Icon icon = b.getIcon();
> String text = b.getText();
>
> Font font = b.getFont();
> Index: classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java (working copy)
> @@ -57,6 +57,7 @@
> * @version 1.41 01/18/01
> * @author David Kloba
> * @author Steve Wilson
> + * @author Florian Brunner
> */
> public class BasicInternalFrameTitlePane extends JComponent
> {
> @@ -269,18 +270,18 @@
> }
>
> protected void addSystemMenuItems(JMenu systemMenu) {
> - JMenuItem mi = (JMenuItem)systemMenu.add(restoreAction);
> + JMenuItem mi = systemMenu.add(restoreAction);
> mi.setMnemonic('R');
> - mi = (JMenuItem)systemMenu.add(moveAction);
> + mi = systemMenu.add(moveAction);
> mi.setMnemonic('M');
> - mi = (JMenuItem)systemMenu.add(sizeAction);
> + mi = systemMenu.add(sizeAction);
> mi.setMnemonic('S');
> - mi = (JMenuItem)systemMenu.add(iconifyAction);
> + mi = systemMenu.add(iconifyAction);
> mi.setMnemonic('n');
> - mi = (JMenuItem)systemMenu.add(maximizeAction);
> + mi = systemMenu.add(maximizeAction);
> mi.setMnemonic('x');
> systemMenu.add(new JSeparator());
> - mi = (JMenuItem)systemMenu.add(closeAction);
> + mi = systemMenu.add(closeAction);
> mi.setMnemonic('C');
> }
>
> @@ -414,7 +415,7 @@
> // PropertyChangeListener
> //
> public void propertyChange(PropertyChangeEvent evt) {
> - String prop = (String)evt.getPropertyName();
> + String prop = evt.getPropertyName();
>
> if (prop == JInternalFrame.IS_SELECTED_PROPERTY) {
> repaint();
> @@ -788,3 +789,4 @@
>
> } // End Title Pane Class
>
> +
> Index: classes/javax/swing/plaf/basic/BasicInternalFrameUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicInternalFrameUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicInternalFrameUI.java (working copy)
> @@ -46,6 +46,7 @@
> * @version 1.135 05/05/07
> * @author David Kloba
> * @author Rich Schiavi
> + * @author Florian Brunner
> */
> public class BasicInternalFrameUI extends InternalFrameUI
> {
> @@ -321,7 +322,7 @@
> if (resizing) {
> return;
> }
> - Cursor s = (Cursor)frame.getLastCursor();
> + Cursor s = frame.getLastCursor();
> if (s == null) {
> s = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
> }
> @@ -1404,7 +1405,7 @@
>
> // PropertyChangeListener
> public void propertyChange(PropertyChangeEvent evt) {
> - String prop = (String)evt.getPropertyName();
> + String prop = evt.getPropertyName();
> JInternalFrame f = (JInternalFrame)evt.getSource();
> Object newValue = evt.getNewValue();
> Object oldValue = evt.getOldValue();
> Index: classes/javax/swing/plaf/basic/BasicLookAndFeel.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicLookAndFeel.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicLookAndFeel.java (working copy)
> @@ -101,6 +101,7 @@
> *
> * @version 1.283 05/09/07
> * @author unattributed
> + * @author Florian Brunner
> */
> public abstract class BasicLookAndFeel extends LookAndFeel implements Serializable
> {
> @@ -2120,9 +2121,9 @@
> * Class.getResourceAsStream just returns raw
> * bytes, which we can convert to a sound.
> */
> - byte[] buffer = (byte[])AccessController.doPrivileged(
> - new PrivilegedAction() {
> - public Object run() {
> + byte[] buffer = AccessController.doPrivileged(
> + new PrivilegedAction<byte[]>() {
> + public byte[] run() {
> try {
> InputStream resource = BasicLookAndFeel.this.
> getClass().getResourceAsStream(soundFile);
> @@ -2184,7 +2185,7 @@
> UIManager.get("AuditoryCues.playList");
> if (audioStrings != null) {
> // create a HashSet to help us decide to play or not
> - HashSet audioCues = new HashSet();
> + HashSet<Object> audioCues = new HashSet<Object>();
> for (int i = 0; i < audioStrings.length; i++) {
> audioCues.add(audioStrings[i]);
> }
> @@ -2237,7 +2238,7 @@
> * This class contains listener that watches for all the mouse
> * events that can possibly invoke popup on the component
> */
> - class AWTEventHelper implements AWTEventListener,PrivilegedAction {
> + class AWTEventHelper implements AWTEventListener,PrivilegedAction<Object> {
> AWTEventHelper() {
> super();
> AccessController.doPrivileged(this);
> Index: classes/javax/swing/plaf/basic/BasicMenuItemUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicMenuItemUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicMenuItemUI.java (working copy)
> @@ -49,6 +49,7 @@
> * @author David Karlton
> * @author Arnaud Weber
> * @author Fredrik Lagerblad
> + * @author Florian Brunner
> */
> public class BasicMenuItemUI extends MenuItemUI
> {
> @@ -702,15 +703,15 @@
> // Paint the Icon
> if(icon != null ) {
> if(!model.isEnabled()) {
> - icon = (Icon) b.getDisabledIcon();
> + icon = b.getDisabledIcon();
> } else if(model.isPressed() && model.isArmed()) {
> - icon = (Icon) b.getPressedIcon();
> + icon = b.getPressedIcon();
> if(icon == null) {
> // Use default icon
> - icon = (Icon) b.getIcon();
> + icon = b.getIcon();
> }
> } else {
> - icon = (Icon) b.getIcon();
> + icon = b.getIcon();
> }
>
> if (icon!=null) {
> @@ -1151,7 +1152,7 @@
> for(i=0,j=path.length; i<j ;i++){
> for (int k=0; k<=i; k++)
> System.out.print(" ");
> - MenuElement me = (MenuElement) path[i];
> + MenuElement me = path[i];
> if(me instanceof JMenuItem)
> System.out.println(((JMenuItem)me).getText() + ", ");
> else if (me == null)
> Index: classes/javax/swing/plaf/basic/BasicMenuUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicMenuUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicMenuUI.java (working copy)
> @@ -46,6 +46,7 @@
> * @author Georges Saab
> * @author David Karlton
> * @author Arnaud Weber
> + * @author Florian Brunner
> */
> public class BasicMenuUI extends BasicMenuItemUI
> {
> @@ -605,7 +606,7 @@
> MenuSelectionManager manager = e.getMenuSelectionManager();
> if (key == Character.toLowerCase(e.getKeyChar())) {
> JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu();
> - ArrayList newList = new ArrayList(Arrays.asList(path));
> + ArrayList<MenuElement> newList = new ArrayList<MenuElement>(Arrays.asList(path));
> newList.add(popupMenu);
> MenuElement subs[] = popupMenu.getSubElements();
> MenuElement sub =
> @@ -613,8 +614,8 @@
> if(sub != null) {
> newList.add(sub);
> }
> - MenuElement newPath[] = new MenuElement[0];;
> - newPath = (MenuElement[]) newList.toArray(newPath);
> + MenuElement newPath[] = new MenuElement[0];
> + newPath = newList.toArray(newPath);
> manager.setSelectedPath(newPath);
> e.consume();
> } else if (((JMenu)menuItem).isTopLevelMenu()
> Index: classes/javax/swing/plaf/basic/BasicOptionPaneUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicOptionPaneUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicOptionPaneUI.java (working copy)
> @@ -77,6 +77,7 @@
> * @author James Gosling
> * @author Scott Violet
> * @author Amy Fowler
> + * @author Florian Brunner
> */
> public class BasicOptionPaneUI extends OptionPaneUI {
>
> @@ -110,7 +111,7 @@
>
>
> static {
> - newline = (String)java.security.AccessController.doPrivileged(
> + newline = java.security.AccessController.doPrivileged(
> new GetPropertyAction("line.separator"));
> if (newline == null) {
> newline = "\n";
> Index: classes/javax/swing/plaf/basic/BasicPopupMenuUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicPopupMenuUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicPopupMenuUI.java (working copy)
> @@ -60,6 +60,7 @@
> * @author Georges Saab
> * @author David Karlton
> * @author Arnaud Weber
> + * @author Florian Brunner
> */
> public class BasicPopupMenuUI extends PopupMenuUI {
> static final StringBuilder MOUSE_GRABBER_KEY = new StringBuilder(
> @@ -226,11 +227,11 @@
> return popup;
> }
>
> - static List getPopups() {
> + static List<JPopupMenu> getPopups() {
> MenuSelectionManager msm = MenuSelectionManager.defaultManager();
> MenuElement[] p = msm.getSelectedPath();
>
> - List list = new ArrayList(p.length);
> + List<JPopupMenu> list = new ArrayList<JPopupMenu>(p.length);
> for(int i = 0; i < p.length; i++) {
> if (p[i] instanceof JPopupMenu) {
> list.add((JPopupMenu)p[i]);
> @@ -291,14 +292,14 @@
> MenuElement subitem = findEnabledChild(
> subpopup.getSubElements(), -1, true);
>
> - ArrayList lst = new ArrayList(Arrays.asList(e.getPath()));
> + ArrayList<MenuElement> lst = new ArrayList<MenuElement>(Arrays.asList(e.getPath()));
> lst.add(menuToOpen);
> lst.add(subpopup);
> if (subitem != null) {
> lst.add(subitem);
> }
> - MenuElement newPath[] = new MenuElement[0];;
> - newPath = (MenuElement[])lst.toArray(newPath);
> + MenuElement newPath[] = new MenuElement[0];
> + newPath = lst.toArray(newPath);
> MenuSelectionManager.defaultManager().setSelectedPath(newPath);
> e.consume();
> }
> @@ -620,7 +621,7 @@
> // 4234793: This action should call JPopupMenu.firePopupMenuCanceled but it's
> // a protected method. The real solution could be to make
> // firePopupMenuCanceled public and call it directly.
> - JPopupMenu lastPopup = (JPopupMenu)getLastPopup();
> + JPopupMenu lastPopup = getLastPopup();
> if (lastPopup != null) {
> lastPopup.putClientProperty("JPopupMenu.firePopupMenuCanceled", Boolean.TRUE);
> }
> @@ -747,7 +748,7 @@
> // A grab needs to be added
> final Toolkit tk = Toolkit.getDefaultToolkit();
> java.security.AccessController.doPrivileged(
> - new java.security.PrivilegedAction() {
> + new java.security.PrivilegedAction<Object>() {
> public Object run() {
> tk.addAWTEventListener(MouseGrabber.this,
> AWTEvent.MOUSE_EVENT_MASK |
> @@ -780,7 +781,7 @@
> final Toolkit tk = Toolkit.getDefaultToolkit();
> // The grab should be removed
> java.security.AccessController.doPrivileged(
> - new java.security.PrivilegedAction() {
> + new java.security.PrivilegedAction<Object>() {
> public Object run() {
> tk.removeAWTEventListener(MouseGrabber.this);
> return null;
> Index: classes/javax/swing/plaf/basic/BasicRadioButtonUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicRadioButtonUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicRadioButtonUI.java (working copy)
> @@ -39,6 +39,7 @@
> *
> * @version 1.77 05/05/07
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public class BasicRadioButtonUI extends BasicToggleButtonUI
> {
> @@ -151,15 +152,15 @@
> }
> } else if(model.isSelected()) {
> if(b.isRolloverEnabled() && model.isRollover()) {
> - altIcon = (Icon) b.getRolloverSelectedIcon();
> + altIcon = b.getRolloverSelectedIcon();
> if (altIcon == null) {
> - altIcon = (Icon) b.getSelectedIcon();
> + altIcon = b.getSelectedIcon();
> }
> } else {
> - altIcon = (Icon) b.getSelectedIcon();
> + altIcon = b.getSelectedIcon();
> }
> } else if(b.isRolloverEnabled() && model.isRollover()) {
> - altIcon = (Icon) b.getRolloverIcon();
> + altIcon = b.getRolloverIcon();
> }
>
> if(altIcon == null) {
> @@ -215,7 +216,7 @@
>
> String text = b.getText();
>
> - Icon buttonIcon = (Icon) b.getIcon();
> + Icon buttonIcon = b.getIcon();
> if(buttonIcon == null) {
> buttonIcon = getDefaultIcon();
> }
> Index: classes/javax/swing/plaf/basic/BasicSliderUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicSliderUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicSliderUI.java (working copy)
> @@ -56,6 +56,7 @@
> *
> * @version 1.113 05/05/07
> * @author Tom Santos
> + * @author Florian Brunner
> */
> public class BasicSliderUI extends SliderUI{
> // Old actions forward to an instance of this.
> @@ -1351,7 +1352,7 @@
> int min = slider.getMinimum();
> int max = slider.getMaximum();
> double valueRange = (double)max - (double)min;
> - double pixelsPerValue = (double)trackHeight / (double)valueRange;
> + double pixelsPerValue = (double)trackHeight / valueRange;
> int trackBottom = trackY + (trackHeight - 1);
> int yPosition;
>
> Index: classes/javax/swing/plaf/basic/BasicSplitPaneUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicSplitPaneUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicSplitPaneUI.java (working copy)
> @@ -52,6 +52,7 @@
> * @author Scott Violet
> * @author Steve Wilson
> * @author Ralph Kar
> + * @author Florian Brunner
> */
> public class BasicSplitPaneUI extends SplitPaneUI
> {
> @@ -107,13 +108,13 @@
> * Keys to use for forward focus traversal when the JComponent is
> * managing focus.
> */
> - private static Set managingFocusForwardTraversalKeys;
> + private static Set<KeyStroke> managingFocusForwardTraversalKeys;
>
> /**
> * Keys to use for backward focus traversal when the JComponent is
> * managing focus.
> */
> - private static Set managingFocusBackwardTraversalKeys;
> + private static Set<KeyStroke> managingFocusBackwardTraversalKeys;
>
>
> /**
> @@ -371,7 +372,7 @@
>
> // focus forward traversal key
> if (managingFocusForwardTraversalKeys==null) {
> - managingFocusForwardTraversalKeys = new HashSet();
> + managingFocusForwardTraversalKeys = new HashSet<KeyStroke>();
> managingFocusForwardTraversalKeys.add(
> KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
> }
> @@ -379,7 +380,7 @@
> managingFocusForwardTraversalKeys);
> // focus backward traversal key
> if (managingFocusBackwardTraversalKeys==null) {
> - managingFocusBackwardTraversalKeys = new HashSet();
> + managingFocusBackwardTraversalKeys = new HashSet<KeyStroke>();
> managingFocusBackwardTraversalKeys.add(
> KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
> }
> @@ -2171,7 +2172,7 @@
> Component focusOn = (direction > 0) ?
> policy.getComponentAfter(rootAncestor, splitPane) :
> policy.getComponentBefore(rootAncestor, splitPane);
> - HashSet focusFrom = new HashSet();
> + HashSet<Component> focusFrom = new HashSet<Component>();
> if (splitPane.isAncestorOf(focusOn)) {
> do {
> focusFrom.add(focusOn);
> Index: classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java (working copy)
> @@ -51,6 +51,7 @@
> * @author Steve Wilson
> * @author Tom Santos
> * @author Dave Moore
> + * @author Florian Brunner
> */
> public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants {
>
> @@ -143,9 +144,9 @@
>
> private Component visibleComponent;
> // PENDING(api): See comment for ContainerHandler
> - private Vector htmlViews;
> + private Vector<View> htmlViews;
>
> - private Hashtable mnemonicToIndexMap;
> + private Hashtable<Integer, Integer> mnemonicToIndexMap;
>
> /**
> * InputMap used for mnemonics. Only non-null if the JTabbedPane has
> @@ -540,14 +541,14 @@
> }
> mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, Event.ALT_MASK),
> "setSelectedIndex");
> - mnemonicToIndexMap.put(new Integer(mnemonic), new Integer(index));
> + mnemonicToIndexMap.put(mnemonic, index);
> }
>
> /**
> * Installs the state needed for mnemonics.
> */
> private void initMnemonics() {
> - mnemonicToIndexMap = new Hashtable();
> + mnemonicToIndexMap = new Hashtable<Integer, Integer>();
> mnemonicInputMap = new ComponentInputMapUIResource(tabPane);
> mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(tabPane,
> JComponent.WHEN_IN_FOCUSED_WINDOW));
> @@ -1695,7 +1696,7 @@
> */
> protected View getTextViewForTab(int tabIndex) {
> if (htmlViews != null) {
> - return (View)htmlViews.elementAt(tabIndex);
> + return htmlViews.elementAt(tabIndex);
> }
> return null;
> }
> @@ -2231,8 +2232,7 @@
> if (mnemonic >= 'a' && mnemonic <='z') {
> mnemonic -= ('a' - 'A');
> }
> - Integer index = (Integer)ui.mnemonicToIndexMap.
> - get(new Integer(mnemonic));
> + Integer index = ui.mnemonicToIndexMap.get(new Integer(mnemonic));
> if (index != null && pane.isEnabledAt(index.intValue())) {
> pane.setSelectedIndex(index.intValue());
> }
> @@ -3789,8 +3789,8 @@
> }
> }
>
> - private Vector createHTMLVector() {
> - Vector htmlViews = new Vector();
> + private Vector<View> createHTMLVector() {
> + Vector<View> htmlViews = new Vector<View>();
> int count = tabPane.getTabCount();
> if (count>0) {
> for (int i=0 ; i<count; i++) {
> Index: classes/javax/swing/plaf/basic/BasicTextUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicTextUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicTextUI.java (working copy)
> @@ -101,6 +101,7 @@
> *
> * @author Timothy Prinzing
> * @author Shannon Hickey (drag and drop)
> + * @author Florian Brunner
> * @version 1.126 05/05/07
> */
> public abstract class BasicTextUI extends TextUI implements ViewFactory {
> @@ -527,16 +528,16 @@
> EditorKit editorKit = getEditorKit(editor);
> if ( editorKit != null
> && editorKit instanceof DefaultEditorKit) {
> - Set storedForwardTraversalKeys = editor.
> + Set<AWTKeyStroke> storedForwardTraversalKeys = editor.
> getFocusTraversalKeys(KeyboardFocusManager.
> FORWARD_TRAVERSAL_KEYS);
> - Set storedBackwardTraversalKeys = editor.
> + Set<AWTKeyStroke> storedBackwardTraversalKeys = editor.
> getFocusTraversalKeys(KeyboardFocusManager.
> BACKWARD_TRAVERSAL_KEYS);
> - Set forwardTraversalKeys =
> - new HashSet(storedForwardTraversalKeys);
> - Set backwardTraversalKeys =
> - new HashSet(storedBackwardTraversalKeys);
> + Set<AWTKeyStroke> forwardTraversalKeys =
> + new HashSet<AWTKeyStroke>(storedForwardTraversalKeys);
> + Set<AWTKeyStroke> backwardTraversalKeys =
> + new HashSet<AWTKeyStroke>(storedBackwardTraversalKeys);
> if (editor.isEditable()) {
> forwardTraversalKeys.
> remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
> @@ -2010,7 +2011,7 @@
> public void addLayoutComponent(Component comp, Object constraint) {
> if (constraint instanceof View) {
> if (constraints == null) {
> - constraints = new Hashtable(7);
> + constraints = new Hashtable<Component, Object>(7);
> }
> constraints.put(comp, constraint);
> }
> @@ -2061,7 +2062,7 @@
> * These are View objects for those components that are represented
> * by a View in the View tree.
> */
> - private Hashtable constraints;
> + private Hashtable<Component, Object> constraints;
>
> private boolean i18nView = false;
> }
> @@ -2458,8 +2459,7 @@
> JTextComponent c = (JTextComponent)comp;
>
> int pos = modeBetween
> - ? ((JTextComponent.DropLocation)c.getDropLocation()).getIndex()
> - : c.getCaretPosition();
> + ? c.getDropLocation().getIndex() : c.getCaretPosition();
>
> // if we are importing to the same component that we exported from
> // then don't actually do anything if the drop location is inside
> @@ -2650,3 +2650,4 @@
>
> }
>
> +
> Index: classes/javax/swing/plaf/basic/BasicToggleButtonUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicToggleButtonUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicToggleButtonUI.java (working copy)
> @@ -41,6 +41,7 @@
> *
> * @version 1.65 05/05/07
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public class BasicToggleButtonUI extends BasicButtonUI {
>
> @@ -126,31 +127,31 @@
>
> if(!model.isEnabled()) {
> if(model.isSelected()) {
> - icon = (Icon) b.getDisabledSelectedIcon();
> + icon = b.getDisabledSelectedIcon();
> } else {
> - icon = (Icon) b.getDisabledIcon();
> + icon = b.getDisabledIcon();
> }
> } else if(model.isPressed() && model.isArmed()) {
> - icon = (Icon) b.getPressedIcon();
> + icon = b.getPressedIcon();
> if(icon == null) {
> // Use selected icon
> - icon = (Icon) b.getSelectedIcon();
> + icon = b.getSelectedIcon();
> }
> } else if(model.isSelected()) {
> if(b.isRolloverEnabled() && model.isRollover()) {
> - icon = (Icon) b.getRolloverSelectedIcon();
> + icon = b.getRolloverSelectedIcon();
> if (icon == null) {
> - icon = (Icon) b.getSelectedIcon();
> + icon = b.getSelectedIcon();
> }
> } else {
> - icon = (Icon) b.getSelectedIcon();
> + icon = b.getSelectedIcon();
> }
> } else if(b.isRolloverEnabled() && model.isRollover()) {
> - icon = (Icon) b.getRolloverIcon();
> + icon = b.getRolloverIcon();
> }
>
> if(icon == null) {
> - icon = (Icon) b.getIcon();
> + icon = b.getIcon();
> }
>
> icon.paintIcon(b, g, iconRect.x, iconRect.y);
> Index: classes/javax/swing/plaf/basic/BasicToolBarUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicToolBarUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicToolBarUI.java (working copy)
> @@ -49,6 +49,7 @@
> * @version 1.109 05/05/07
> * @author Georges Saab
> * @author Jeff Shapiro
> + * @author Florian Brunner
> */
> public class BasicToolBarUI extends ToolBarUI implements SwingConstants
> {
> @@ -84,8 +85,8 @@
> private static Border nonRolloverToggleBorder;
> private boolean rolloverBorders = false;
>
> - private HashMap borderTable = new HashMap();
> - private Hashtable rolloverTable = new Hashtable();
> + private HashMap<AbstractButton, Border> borderTable = new HashMap<AbstractButton, Border>();
> + private Hashtable<AbstractButton, Boolean> rolloverTable = new Hashtable<AbstractButton, Boolean>();
>
>
> /**
> @@ -682,7 +683,7 @@
> if (c instanceof AbstractButton) {
> AbstractButton b = (AbstractButton)c;
>
> - Border border = (Border)borderTable.get(b);
> + Border border = borderTable.get(b);
> if (border == null || border instanceof UIResource) {
> borderTable.put(b, b.getBorder());
> }
> @@ -722,7 +723,7 @@
> if (c instanceof AbstractButton) {
> AbstractButton b = (AbstractButton)c;
>
> - Border border = (Border)borderTable.get(b);
> + Border border = borderTable.get(b);
> if (border == null || border instanceof UIResource) {
> borderTable.put(b, b.getBorder());
> }
> @@ -766,10 +767,10 @@
> if (c instanceof AbstractButton) {
> AbstractButton b = (AbstractButton)c;
>
> - Border border = (Border)borderTable.remove(b);
> + Border border = borderTable.remove(b);
> b.setBorder(border);
>
> - Boolean value = (Boolean)rolloverTable.remove(b);
> + Boolean value = rolloverTable.remove(b);
> if (value != null) {
> b.setRolloverEnabled(value.booleanValue());
> }
> Index: classes/javax/swing/plaf/basic/BasicTreeUI.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/BasicTreeUI.java (revision 250)
> +++ classes/javax/swing/plaf/basic/BasicTreeUI.java (working copy)
> @@ -58,6 +58,7 @@
> * @version 1.202 05/05/07
> * @author Scott Violet
> * @author Shannon Hickey (drag and drop)
> + * @author Florian Brunner
> */
>
> public class BasicTreeUI extends TreeUI
> @@ -3126,7 +3127,7 @@
>
> private static final TransferHandler defaultTransferHandler = new TreeTransferHandler();
>
> - static class TreeTransferHandler extends TransferHandler implements UIResource, Comparator {
> + static class TreeTransferHandler extends TransferHandler implements UIResource, Comparator<TreePath> {
>
> private JTree tree;
>
> @@ -3180,9 +3181,9 @@
> return null;
> }
>
> - public int compare(Object o1, Object o2) {
> - int row1 = tree.getRowForPath((TreePath)o1);
> - int row2 = tree.getRowForPath((TreePath)o2);
> + public int compare(TreePath o1, TreePath o2) {
> + int row1 = tree.getRowForPath(o1);
> + int row2 = tree.getRowForPath(o2);
> return row1 - row2;
> }
>
> @@ -3201,7 +3202,7 @@
> */
> TreePath[] getDisplayOrderPaths(TreePath[] paths) {
> // sort the paths to display order rather than selection order
> - ArrayList selOrder = new ArrayList();
> + ArrayList<TreePath> selOrder = new ArrayList<TreePath>();
> for (int i = 0; i < paths.length; i++) {
> selOrder.add(paths[i]);
> }
> @@ -3209,7 +3210,7 @@
> int n = selOrder.size();
> TreePath[] displayPaths = new TreePath[n];
> for (int i = 0; i < n; i++) {
> - displayPaths[i] = (TreePath) selOrder.get(i);
> + displayPaths[i] = selOrder.get(i);
> }
> return displayPaths;
> }
> Index: classes/javax/swing/plaf/basic/DragRecognitionSupport.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/DragRecognitionSupport.java (revision 250)
> +++ classes/javax/swing/plaf/basic/DragRecognitionSupport.java (working copy)
> @@ -39,6 +39,7 @@
> * public static methods call into the appropriate instance.
> *
> * @author Shannon Hickey
> + * @author Florian Brunner
> * @version 1.8 05/05/07
> */
> class DragRecognitionSupport {
> @@ -74,8 +75,7 @@
> * Returns whether or not the event is potentially part of a drag sequence.
> */
> public static boolean mousePressed(MouseEvent me) {
> - return ((DragRecognitionSupport)getDragRecognitionSupport()).
> - mousePressedImpl(me);
> + return getDragRecognitionSupport().mousePressedImpl(me);
> }
>
> /**
> @@ -83,16 +83,14 @@
> * that started the recognition. Otherwise, return null.
> */
> public static MouseEvent mouseReleased(MouseEvent me) {
> - return ((DragRecognitionSupport)getDragRecognitionSupport()).
> - mouseReleasedImpl(me);
> + return getDragRecognitionSupport().mouseReleasedImpl(me);
> }
>
> /**
> * Returns whether or not a drag gesture recognition is ongoing.
> */
> public static boolean mouseDragged(MouseEvent me, BeforeDrag bd) {
> - return ((DragRecognitionSupport)getDragRecognitionSupport()).
> - mouseDraggedImpl(me, bd);
> + return getDragRecognitionSupport().mouseDraggedImpl(me, bd);
> }
>
> private void clearState() {
> Index: classes/javax/swing/plaf/basic/LazyActionMap.java
> ===================================================================
> --- classes/javax/swing/plaf/basic/LazyActionMap.java (revision 250)
> +++ classes/javax/swing/plaf/basic/LazyActionMap.java (working copy)
> @@ -35,6 +35,7 @@
> *
> * @version 1.12, 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> */
> class LazyActionMap extends ActionMapUIResource {
> /**
> @@ -143,7 +144,7 @@
> Object loader = _loader;
>
> _loader = null;
> - Class klass = (Class)loader;
> + Class<?> klass = (Class<?>)loader;
> try {
> Method method = klass.getDeclaredMethod("loadActionMap",
> new Class[] { LazyActionMap.class });
> Index: classes/javax/swing/plaf/metal/DefaultMetalTheme.java
> ===================================================================
> --- classes/javax/swing/plaf/metal/DefaultMetalTheme.java (revision 250)
> +++ classes/javax/swing/plaf/metal/DefaultMetalTheme.java (working copy)
> @@ -88,6 +88,7 @@
> *
> * @version 1.37 05/05/07
> * @author Steve Wilson
> + * @author Florian Brunner
> */
> public class DefaultMetalTheme extends MetalTheme {
> /**
> @@ -388,9 +389,9 @@
> * that it is wrapped inside a <code>doPrivileged</code> call.
> */
> protected Font getPrivilegedFont(final int key) {
> - return (Font)java.security.AccessController.doPrivileged(
> - new java.security.PrivilegedAction() {
> - public Object run() {
> + return java.security.AccessController.doPrivileged(
> + new java.security.PrivilegedAction<Font>() {
> + public Font run() {
> return Font.getFont(getDefaultPropertyName(key));
> }
> }
> Index: classes/javax/swing/plaf/metal/MetalBumps.java
> ===================================================================
> --- classes/javax/swing/plaf/metal/MetalBumps.java (revision 250)
> +++ classes/javax/swing/plaf/metal/MetalBumps.java (working copy)
> @@ -37,6 +37,7 @@
> * @version 1.32 05/05/07
> * @author Tom Santos
> * @author Steve Wilson
> + * @author Florian Brunner
> */
>
>
> @@ -50,7 +51,7 @@
> protected Color shadowColor;
> protected Color backColor;
>
> - protected static Vector buffers = new Vector();
> + protected static Vector<BumpBuffer> buffers = new Vector<BumpBuffer>();
> protected BumpBuffer buffer;
>
> public MetalBumps( Dimension bumpArea ) {
> @@ -121,8 +122,8 @@
>
> public void paintIcon( Component c, Graphics g, int x, int y ) {
> GraphicsConfiguration gc = (g instanceof Graphics2D) ?
> - (GraphicsConfiguration)((Graphics2D)g).
> - getDeviceConfiguration() : null;
> + ((Graphics2D)g).getDeviceConfiguration()
> + : null;
>
> buffer = getBuffer(gc, topColor, shadowColor, backColor);
>
> Index: classes/javax/swing/plaf/metal/MetalFileChooserUI.java
> ===================================================================
> --- classes/javax/swing/plaf/metal/MetalFileChooserUI.java (revision 250)
> +++ classes/javax/swing/plaf/metal/MetalFileChooserUI.java (working copy)
> @@ -48,6 +48,7 @@
> *
> * @version 1.100 05/09/07
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public class MetalFileChooserUI extends BasicFileChooserUI {
>
> @@ -947,7 +948,7 @@
> * Data model for a type-face selection combo-box.
> */
> protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel {
> - Vector directories = new Vector();
> + Vector<File> directories = new Vector<File>();
> int[] depths = null;
> File selectedDirectory = null;
> JFileChooser chooser = getFileChooser();
> @@ -999,7 +1000,7 @@
> File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
> : canonical;
> File f = sf;
> - Vector path = new Vector(10);
> + Vector<File> path = new Vector<File>(10);
> do {
> path.addElement(f);
> } while ((f = f.getParentFile()) != null);
> @@ -1007,7 +1008,7 @@
> int pathCount = path.size();
> // Insert chain at appropriate place in vector
> for (int i = 0; i < pathCount; i++) {
> - f = (File)path.get(i);
> + f = path.get(i);
> if (directories.contains(f)) {
> int topIndex = directories.indexOf(f);
> for (int j = i-1; j >= 0; j--) {
> @@ -1026,12 +1027,12 @@
> private void calculateDepths() {
> depths = new int[directories.size()];
> for (int i = 0; i < depths.length; i++) {
> - File dir = (File)directories.get(i);
> + File dir = directories.get(i);
> File parent = dir.getParentFile();
> depths[i] = 0;
> if (parent != null) {
> for (int j = i-1; j >= 0; j--) {
> - if (parent.equals((File)directories.get(j))) {
> + if (parent.equals(directories.get(j))) {
> depths[i] = depths[j] + 1;
> break;
> }
> Index: classes/javax/swing/plaf/metal/MetalIconFactory.java
> ===================================================================
> --- classes/javax/swing/plaf/metal/MetalIconFactory.java (revision 250)
> +++ classes/javax/swing/plaf/metal/MetalIconFactory.java (working copy)
> @@ -58,6 +58,7 @@
> *
> * @version 1.70 05/05/07
> * @author Michael C. Albers
> + * @author Florian Brunner
> */
> public class MetalIconFactory implements Serializable {
>
> @@ -599,7 +600,7 @@
> }
>
> // Some calculations that are needed more than once later on.
> - int oneHalf = (int)(iconSize / 2); // 16 -> 8
> + int oneHalf = iconSize / 2; // 16 -> 8
>
> g.translate(x, y);
>
> @@ -1503,7 +1504,7 @@
>
> // PENDING: Replace this class with CachedPainter.
>
> - Vector images = new Vector(1, 1);
> + Vector<ImageGcPair> images = new Vector<ImageGcPair>(1, 1);
> ImageGcPair currentImageGcPair;
>
> class ImageGcPair {
> Index: classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
> ===================================================================
> --- classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java (revision 250)
> +++ classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java (working copy)
> @@ -42,6 +42,7 @@
> * @version 1.65 05/05/07
> * @author Steve Wilson
> * @author Brian Beck
> + * @author Florian Brunner
> * @since 1.3
> */
>
> @@ -192,7 +193,7 @@
> extends BasicInternalFrameTitlePane.PropertyChangeHandler
> {
> public void propertyChange(PropertyChangeEvent evt) {
> - String prop = (String)evt.getPropertyName();
> + String prop = evt.getPropertyName();
> if( prop.equals(JInternalFrame.IS_SELECTED_PROPERTY) ) {
> Boolean b = (Boolean)evt.getNewValue();
> iconButton.putClientProperty("paintActive", b);
> Index: classes/javax/swing/plaf/metal/MetalLookAndFeel.java
> ===================================================================
> --- classes/javax/swing/plaf/metal/MetalLookAndFeel.java (revision 250)
> +++ classes/javax/swing/plaf/metal/MetalLookAndFeel.java (working copy)
> @@ -82,6 +82,7 @@
> *
> * @version @(#)MetalLookAndFeel.java 1.213 07/06/07
> * @author Steve Wilson
> + * @author Florian Brunner
> */
> public class MetalLookAndFeel extends BasicLookAndFeel
> {
> @@ -2219,9 +2220,9 @@
> if (methodName == null) {
> return c.newInstance();
> }
> - Method method = (Method)AccessController.doPrivileged(
> - new PrivilegedAction() {
> - public Object run() {
> + Method method = AccessController.doPrivileged(
> + new PrivilegedAction<Method>() {
> + public Method run() {
> Method[] methods = c.getDeclaredMethods();
> for (int counter = methods.length - 1; counter >= 0;
> counter--) {
> @@ -2284,7 +2285,7 @@
> }
> }
>
> - static ReferenceQueue queue = new ReferenceQueue();
> + static ReferenceQueue<LookAndFeel> queue = new ReferenceQueue<LookAndFeel>();
>
> static void flushUnreferenced() {
> AATextListener aatl;
> @@ -2294,7 +2295,7 @@
> }
>
> static class AATextListener
> - extends WeakReference implements PropertyChangeListener {
> + extends WeakReference<LookAndFeel> implements PropertyChangeListener {
>
> private String key = SunToolkit.DESKTOPFONTHINTS;
>
> @@ -2305,7 +2306,7 @@
> }
>
> public void propertyChange(PropertyChangeEvent pce) {
> - LookAndFeel laf = (LookAndFeel)get();
> + LookAndFeel laf = get();
> if (laf == null || laf != UIManager.getLookAndFeel()) {
> dispose();
> return;
> Index: classes/javax/swing/plaf/metal/MetalRadioButtonUI.java
> ===================================================================
> --- classes/javax/swing/plaf/metal/MetalRadioButtonUI.java (revision 250)
> +++ classes/javax/swing/plaf/metal/MetalRadioButtonUI.java (working copy)
> @@ -51,6 +51,7 @@
> * @version 1.37 05/05/07
> * @author Michael C. Albers (Metal modifications)
> * @author Jeff Dinkins (original BasicRadioButtonCode)
> + * @author Florian Brunner
> */
> public class MetalRadioButtonUI extends BasicRadioButtonUI {
>
> @@ -165,15 +166,15 @@
> }
> } else if(model.isSelected()) {
> if(b.isRolloverEnabled() && model.isRollover()) {
> - altIcon = (Icon) b.getRolloverSelectedIcon();
> + altIcon = b.getRolloverSelectedIcon();
> if (altIcon == null) {
> - altIcon = (Icon) b.getSelectedIcon();
> + altIcon = b.getSelectedIcon();
> }
> } else {
> - altIcon = (Icon) b.getSelectedIcon();
> + altIcon = b.getSelectedIcon();
> }
> } else if(b.isRolloverEnabled() && model.isRollover()) {
> - altIcon = (Icon) b.getRolloverIcon();
> + altIcon = b.getRolloverIcon();
> }
>
> if(altIcon == null) {
> Index: classes/javax/swing/plaf/metal/MetalToolBarUI.java
> ===================================================================
> --- classes/javax/swing/plaf/metal/MetalToolBarUI.java (revision 250)
> +++ classes/javax/swing/plaf/metal/MetalToolBarUI.java (working copy)
> @@ -54,6 +54,7 @@
> *
> * @version 1.48 05/05/07
> * @author Jeff Shapiro
> + * @author Florian Brunner
> */
> public class MetalToolBarUI extends BasicToolBarUI
> {
> @@ -62,7 +63,7 @@
> * instances of JToolBars and JMenuBars and is used to find
> * JToolBars/JMenuBars that border each other.
> */
> - private static java.util.List components = new ArrayList();
> + private static java.util.List<WeakReference<JComponent>> components = new ArrayList<WeakReference<JComponent>>();
>
> /**
> * This protected field is implemenation specific. Do not access directly
> @@ -96,7 +97,7 @@
> // typed to throw an NPE.
> throw new NullPointerException("JComponent must be non-null");
> }
> - components.add(new WeakReference(c));
> + components.add(new WeakReference<JComponent>(c));
> }
>
> /**
> Index: classes/javax/swing/plaf/synth/DefaultSynthStyleFactory.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/DefaultSynthStyleFactory.java (revision 250)
> +++ classes/javax/swing/plaf/synth/DefaultSynthStyleFactory.java (working copy)
> @@ -40,6 +40,7 @@
> *
> * @version 1.15, 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> */
> class DefaultSynthStyleFactory extends SynthStyleFactory {
> /**
> @@ -64,7 +65,7 @@
> /**
> * Maps from a List (BakedArrayList to be precise) to the merged style.
> */
> - private Map _resolvedStyles;
> + private Map<BakedArrayList, SynthStyle> _resolvedStyles;
>
> /**
> * Used if there are no styles matching a widget.
> @@ -75,7 +76,7 @@
> DefaultSynthStyleFactory() {
> _tmpList = new BakedArrayList(5);
> _styles = new ArrayList<StyleAssociation>();
> - _resolvedStyles = new HashMap();
> + _resolvedStyles = new HashMap<BakedArrayList, SynthStyle>();
> }
>
> public synchronized void addStyle(DefaultSynthStyle style,
> @@ -139,7 +140,7 @@
> * Fetches any styles that match the passed into arguments into
> * <code>matches</code>.
> */
> - private void getMatchingStyles(java.util.List matches, JComponent c,
> + private void getMatchingStyles(java.util.List<SynthStyle> matches, JComponent c,
> Region id) {
> String idName = id.getLowerCaseName();
> String cName = c.getName();
> @@ -180,7 +181,7 @@
> if (styles.size() == 0) {
> return null;
> }
> - return (SynthStyle)_resolvedStyles.get(styles);
> + return _resolvedStyles.get(styles);
> }
>
> /**
> Index: classes/javax/swing/plaf/synth/ImagePainter.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/ImagePainter.java (revision 250)
> +++ classes/javax/swing/plaf/synth/ImagePainter.java (working copy)
> @@ -40,6 +40,7 @@
> *
> * @version 1.18, 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> */
> class ImagePainter extends SynthPainter {
> private static final StringBuffer CACHE_KEY =
> @@ -67,7 +68,7 @@
> Paint9Painter painter;
> if (cacheRef == null || (painter = cacheRef.get()) == null) {
> painter = new Paint9Painter(30);
> - cacheRef = new WeakReference(painter);
> + cacheRef = new WeakReference<Paint9Painter>(painter);
> AppContext.getAppContext().put(CACHE_KEY, cacheRef);
> }
> return painter;
> Index: classes/javax/swing/plaf/synth/Region.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/Region.java (revision 250)
> +++ classes/javax/swing/plaf/synth/Region.java (working copy)
> @@ -66,10 +66,11 @@
> * @version 1.37, 05/05/07
> * @since 1.5
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class Region {
> - private static final Map uiToRegionMap = new HashMap();
> - private static final Map lowerCaseNameMap = new HashMap();
> + private static final Map<String, Region> uiToRegionMap = new HashMap<String, Region>();
> + private static final Map<Region, String> lowerCaseNameMap = new HashMap<Region, String>();
>
> /**
> * ArrowButton's are special types of buttons that also render a
> @@ -452,7 +453,7 @@
>
>
> static Region getRegion(JComponent c) {
> - return (Region)uiToRegionMap.get(c.getUIClassID());
> + return uiToRegionMap.get(c.getUIClassID());
> }
>
> static void registerUIs(UIDefaults table) {
> @@ -522,7 +523,7 @@
> */
> String getLowerCaseName() {
> synchronized(lowerCaseNameMap) {
> - String lowerCaseName = (String)lowerCaseNameMap.get(this);
> + String lowerCaseName = lowerCaseNameMap.get(this);
> if (lowerCaseName == null) {
> lowerCaseName = getName().toLowerCase();
> lowerCaseNameMap.put(this, lowerCaseName);
> Index: classes/javax/swing/plaf/synth/SynthComboBoxUI.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthComboBoxUI.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthComboBoxUI.java (working copy)
> @@ -46,6 +46,7 @@
> *
> * @version 1.25, 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> */
> class SynthComboBoxUI extends BasicComboBoxUI implements
> PropertyChangeListener, SynthUI {
> @@ -337,7 +338,7 @@
> return oldValue;
> } else {
> // Must take the value from the editor and get the value and cast it to the new type.
> - Class cls = oldValue.getClass();
> + Class<?> cls = oldValue.getClass();
> try {
> Method method = cls.getMethod("valueOf", new Class[]{String.class});
> newValue = method.invoke(oldValue, new Object[] { editor.getText()});
> Index: classes/javax/swing/plaf/synth/SynthContext.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthContext.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthContext.java (working copy)
> @@ -38,9 +38,10 @@
> * @version 1.16, 05/05/07
> * @since 1.5
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class SynthContext {
> - private static final Map contextMap;
> + private static final Map<Class, List<SynthContext>> contextMap;
>
> private JComponent component;
> private Region region;
> @@ -49,7 +50,7 @@
>
>
> static {
> - contextMap = new HashMap();
> + contextMap = new HashMap<Class, List<SynthContext>>();
> }
>
>
> @@ -82,11 +83,10 @@
>
> static void releaseContext(SynthContext context) {
> synchronized(contextMap) {
> - java.util.List instances = (java.util.List)contextMap.get(
> - context.getClass());
> + List<SynthContext> instances = contextMap.get(context.getClass());
>
> if (instances == null) {
> - instances = new ArrayList(5);
> + instances = new ArrayList<SynthContext>(5);
> contextMap.put(context.getClass(), instances);
> }
> instances.add(context);
> Index: classes/javax/swing/plaf/synth/SynthEditorPaneUI.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthEditorPaneUI.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthEditorPaneUI.java (working copy)
> @@ -38,6 +38,7 @@
> * Synth look and feel.
> *
> * @author Shannon Hickey
> + * @author Florian Brunner
> * @version 1.16 05/05/07
> */
> class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
> @@ -70,7 +71,7 @@
> c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
> localTrue);
> }
> - updateStyle((JTextComponent)getComponent());
> + updateStyle(getComponent());
> }
>
> protected void uninstallDefaults() {
> Index: classes/javax/swing/plaf/synth/SynthGraphicsUtils.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthGraphicsUtils.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthGraphicsUtils.java (working copy)
> @@ -37,6 +37,7 @@
> * @version 1.27, 05/05/07
> * @since 1.5
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class SynthGraphicsUtils {
> // These are used in the text painting code to avoid allocating a bunch of
> @@ -417,7 +418,7 @@
> * the SynthIcon with a given SynthContext.
> */
> private static class SynthIconWrapper implements Icon {
> - private static final java.util.List CACHE = new java.util.ArrayList(1);
> + private static final java.util.List<SynthIconWrapper> CACHE = new java.util.ArrayList<SynthIconWrapper>(1);
>
> private SynthIcon synthIcon;
> private SynthContext context;
> @@ -426,8 +427,7 @@
> synchronized(CACHE) {
> int size = CACHE.size();
> if (size > 0) {
> - SynthIconWrapper wrapper = (SynthIconWrapper)CACHE.remove(
> - size - 1);
> + SynthIconWrapper wrapper = CACHE.remove(size - 1);
> wrapper.reset(icon, context);
> return wrapper;
> }
> Index: classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java (working copy)
> @@ -47,6 +47,7 @@
> * @author David Kloba
> * @author Joshua Outwater
> * @author Steve Wilson
> + * @author Florian Brunner
> */
> class SynthInternalFrameTitlePane extends BasicInternalFrameTitlePane
> implements SynthUI, PropertyChangeListener {
> @@ -198,18 +199,18 @@
>
> protected void addSystemMenuItems(JPopupMenu menu) {
> // PENDING: this should all be localizable!
> - JMenuItem mi = (JMenuItem)menu.add(restoreAction);
> + JMenuItem mi = menu.add(restoreAction);
> mi.setMnemonic('R');
> - mi = (JMenuItem)menu.add(moveAction);
> + mi = menu.add(moveAction);
> mi.setMnemonic('M');
> - mi = (JMenuItem)menu.add(sizeAction);
> + mi = menu.add(sizeAction);
> mi.setMnemonic('S');
> - mi = (JMenuItem)menu.add(iconifyAction);
> + mi = menu.add(iconifyAction);
> mi.setMnemonic('n');
> - mi = (JMenuItem)menu.add(maximizeAction);
> + mi = menu.add(maximizeAction);
> mi.setMnemonic('x');
> menu.add(new JSeparator());
> - mi = (JMenuItem)menu.add(closeAction);
> + mi = menu.add(closeAction);
> mi.setMnemonic('C');
> }
>
> Index: classes/javax/swing/plaf/synth/SynthLookAndFeel.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthLookAndFeel.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthLookAndFeel.java (working copy)
> @@ -63,6 +63,7 @@
> * @version 1.48, 05/24/05
> * @since 1.5
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class SynthLookAndFeel extends BasicLookAndFeel {
> /**
> @@ -108,7 +109,7 @@
> * Map of defaults table entries. This is populated via the load
> * method.
> */
> - private Map defaultsMap;
> + private Map<String, Object> defaultsMap;
>
> private Handler _handler;
>
> @@ -582,7 +583,7 @@
> }
>
> if (defaultsMap == null) {
> - defaultsMap = new HashMap();
> + defaultsMap = new HashMap<String, Object>();
> }
>
> new SynthParser().parse(input, (DefaultSynthStyleFactory) factory,
> @@ -612,7 +613,7 @@
> }
>
> if (defaultsMap == null) {
> - defaultsMap = new HashMap();
> + defaultsMap = new HashMap<String, Object>();
> }
>
> InputStream input = url.openStream();
> @@ -772,7 +773,7 @@
> */
> private static Object getAATextInfo() {
> String language = Locale.getDefault().getLanguage();
> - String desktop = (String)
> + String desktop =
> AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
>
> boolean isCjkLocale = (Locale.CHINESE.getLanguage().equals(language) ||
> @@ -787,7 +788,7 @@
> return aaTextInfo;
> }
>
> - private static ReferenceQueue queue = new ReferenceQueue();
> + private static ReferenceQueue<LookAndFeel> queue = new ReferenceQueue<LookAndFeel>();
>
> private static void flushUnreferenced() {
> AATextListener aatl;
> @@ -797,7 +798,7 @@
> }
>
> private static class AATextListener
> - extends WeakReference implements PropertyChangeListener {
> + extends WeakReference<LookAndFeel> implements PropertyChangeListener {
> private String key = SunToolkit.DESKTOPFONTHINTS;
>
> AATextListener(LookAndFeel laf) {
> @@ -813,7 +814,7 @@
> return;
> }
>
> - LookAndFeel laf = (LookAndFeel) get();
> + LookAndFeel laf = get();
> if (laf == null || laf != UIManager.getLookAndFeel()) {
> dispose();
> return;
> Index: classes/javax/swing/plaf/synth/SynthMenuItemUI.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthMenuItemUI.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthMenuItemUI.java (working copy)
> @@ -48,6 +48,7 @@
> * @author David Karlton
> * @author Arnaud Weber
> * @author Fredrik Lagerblad
> + * @author Florian Brunner
> */
> class SynthMenuItemUI extends BasicMenuItemUI implements
> PropertyChangeListener, SynthUI {
> @@ -107,7 +108,7 @@
> Icon checkIcon, Icon arrowIcon, int defaultTextIconGap,
> String acceleratorDelimiter) {
> JMenuItem b = (JMenuItem) c;
> - Icon icon = (Icon) b.getIcon();
> + Icon icon = b.getIcon();
> String text = b.getText();
> KeyStroke accelerator = b.getAccelerator();
> String acceleratorText = "";
> @@ -307,15 +308,15 @@
> if(b.getIcon() != null) {
> Icon icon;
> if(!model.isEnabled()) {
> - icon = (Icon) b.getDisabledIcon();
> + icon = b.getDisabledIcon();
> } else if(model.isPressed() && model.isArmed()) {
> - icon = (Icon) b.getPressedIcon();
> + icon = b.getPressedIcon();
> if(icon == null) {
> // Use default icon
> - icon = (Icon) b.getIcon();
> + icon = b.getIcon();
> }
> } else {
> - icon = (Icon) b.getIcon();
> + icon = b.getIcon();
> }
>
> if (icon!=null) {
> Index: classes/javax/swing/plaf/synth/SynthParser.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthParser.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthParser.java (working copy)
> @@ -68,6 +68,8 @@
> import com.sun.beans.ObjectHandler;
>
> /**
> + * @author unattributed
> + * @author Florian Brunner
> * @version 1.23, 09/12/05
> */
> class SynthParser extends HandlerBase {
> @@ -139,7 +141,7 @@
> * Array of state infos for the current style. These are pushed to the
> * style when </style> is received.
> */
> - private java.util.List _stateInfos;
> + private java.util.List<ParsedSynthStyle.StateInfo> _stateInfos;
>
> /**
> * Current style.
> @@ -154,7 +156,7 @@
> /**
> * Bindings for the current InputMap
> */
> - private java.util.List _inputMapBindings;
> + private java.util.List<String> _inputMapBindings;
>
> /**
> * ID for the input map. This is cached as
> @@ -180,30 +182,30 @@
> /**
> * List of ColorTypes. This is populated in startColorType.
> */
> - private java.util.List _colorTypes;
> + private java.util.List<ColorType> _colorTypes;
>
> /**
> * defaultsPropertys are placed here.
> */
> - private Map _defaultsMap;
> + private Map<String, Object> _defaultsMap;
>
> /**
> * List of SynthStyle.Painters that will be applied to the current style.
> */
> - private java.util.List _stylePainters;
> + private java.util.List<ParsedSynthStyle.PainterInfo> _stylePainters;
>
> /**
> * List of SynthStyle.Painters that will be applied to the current state.
> */
> - private java.util.List _statePainters;
> + private java.util.List<ParsedSynthStyle.PainterInfo> _statePainters;
>
> SynthParser() {
> _mapping = new HashMap<String,Object>();
> - _stateInfos = new ArrayList();
> - _colorTypes = new ArrayList();
> + _stateInfos = new ArrayList<ParsedSynthStyle.StateInfo>();
> + _colorTypes = new ArrayList<ColorType>();
> _inputMapBindings = new ArrayList();
> - _stylePainters = new ArrayList();
> - _statePainters = new ArrayList();
> + _stylePainters = new ArrayList<ParsedSynthStyle.PainterInfo>();
> + _statePainters = new ArrayList<ParsedSynthStyle.PainterInfo>();
> }
>
> /**
> @@ -222,7 +224,7 @@
> public void parse(InputStream inputStream,
> DefaultSynthStyleFactory factory,
> URL urlResourceBase, Class<?> classResourceBase,
> - Map defaultsMap)
> + Map<String, Object> defaultsMap)
> throws ParseException, IllegalArgumentException {
> if (inputStream == null || factory == null ||
> (urlResourceBase == null && classResourceBase == null)) {
> @@ -426,15 +428,12 @@
> private void endStyle() throws SAXException {
> int size = _stylePainters.size();
> if (size > 0) {
> - _style.setPainters((ParsedSynthStyle.PainterInfo[])
> - _stylePainters.toArray(new ParsedSynthStyle.
> - PainterInfo[size]));
> + _style.setPainters(_stylePainters.toArray(new ParsedSynthStyle.PainterInfo[size]));
> _stylePainters.clear();
> }
> size = _stateInfos.size();
> if (size > 0) {
> - _style.setStateInfo((ParsedSynthStyle.StateInfo[])_stateInfos.
> - toArray(new ParsedSynthStyle.StateInfo[size]));
> + _style.setStateInfo(_stateInfos.toArray(new ParsedSynthStyle.StateInfo[size]));
> _stateInfos.clear();
> }
> _style = null;
> @@ -504,9 +503,7 @@
> private void endState() throws SAXException {
> int size = _statePainters.size();
> if (size > 0) {
> - _stateInfo.setPainters((ParsedSynthStyle.PainterInfo[])
> - _statePainters.toArray(new ParsedSynthStyle.
> - PainterInfo[size]));
> + _stateInfo.setPainters(_statePainters.toArray(new ParsedSynthStyle.PainterInfo[size]));
> _statePainters.clear();
> }
> _stateInfo = null;
> @@ -687,8 +684,7 @@
> int max = 0;
> for (int counter = _colorTypes.size() - 1; counter >= 0;
> counter--) {
> - max = Math.max(max, ((ColorType)_colorTypes.get(counter)).
> - getID());
> + max = Math.max(max, _colorTypes.get(counter).getID());
> }
> if (colors == null || colors.length <= max) {
> Color[] newColors = new Color[max + 1];
> @@ -699,7 +695,7 @@
> }
> for (int counter = _colorTypes.size() - 1; counter >= 0;
> counter--) {
> - colors[((ColorType)_colorTypes.get(counter)).getID()] = color;
> + colors[_colorTypes.get(counter).getID()] = color;
> }
> _stateInfo.setColors(colors);
> }
> @@ -708,7 +704,7 @@
> private void startProperty(AttributeList attributes,
> Object property) throws SAXException {
> Object value = null;
> - Object key = null;
> + String key = null;
> // Type of the value: 0=idref, 1=boolean, 2=dimension, 3=insets,
> // 4=integer,5=string
> int iType = 0;
> @@ -791,7 +787,7 @@
> }
> else if (_stateInfo != null) {
> if (_stateInfo.getData() == null) {
> - _stateInfo.setData(new HashMap());
> + _stateInfo.setData(new HashMap<String, Object>());
> }
> _stateInfo.getData().put(key, value);
> }
> @@ -1030,7 +1026,7 @@
> }
> }
>
> - private void addPainterOrMerge(java.util.List painters, String method,
> + private void addPainterOrMerge(java.util.List<ParsedSynthStyle.PainterInfo> painters, String method,
> SynthPainter painter, int direction) {
> ParsedSynthStyle.PainterInfo painterInfo;
> painterInfo = new ParsedSynthStyle.PainterInfo(method,
> Index: classes/javax/swing/plaf/synth/SynthSliderUI.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthSliderUI.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthSliderUI.java (working copy)
> @@ -56,6 +56,7 @@
> *
> * @version 1.36, 05/09/07
> * @author Joshua Outwater
> + * @author Florian Brunner
> */
> class SynthSliderUI extends BasicSliderUI implements PropertyChangeListener,
> SynthUI {
> @@ -545,7 +546,7 @@
> trackBorder;
> int trackLength = trackBottom - trackTop;
> double valueRange = (double)max - (double)min;
> - double pixelsPerValue = (double)trackLength / (double)valueRange;
> + double pixelsPerValue = (double)trackLength / valueRange;
> int yPosition;
>
> if (!drawInverted()) {
> Index: classes/javax/swing/plaf/synth/SynthSplitPaneUI.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthSplitPaneUI.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthSplitPaneUI.java (working copy)
> @@ -42,6 +42,7 @@
> *
> * @version 1.23, 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> */
> class SynthSplitPaneUI extends BasicSplitPaneUI implements
> PropertyChangeListener, SynthUI {
> @@ -49,13 +50,13 @@
> * Keys to use for forward focus traversal when the JComponent is
> * managing focus.
> */
> - private static Set managingFocusForwardTraversalKeys;
> + private static Set<KeyStroke> managingFocusForwardTraversalKeys;
>
> /**
> * Keys to use for backward focus traversal when the JComponent is
> * managing focus.
> */
> - private static Set managingFocusBackwardTraversalKeys;
> + private static Set<KeyStroke> managingFocusBackwardTraversalKeys;
>
> /**
> * Style for the JSplitPane.
> @@ -97,7 +98,7 @@
>
> // focus forward traversal key
> if (managingFocusForwardTraversalKeys==null) {
> - managingFocusForwardTraversalKeys = new HashSet();
> + managingFocusForwardTraversalKeys = new HashSet<KeyStroke>();
> managingFocusForwardTraversalKeys.add(
> KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
> }
> @@ -105,7 +106,7 @@
> managingFocusForwardTraversalKeys);
> // focus backward traversal key
> if (managingFocusBackwardTraversalKeys==null) {
> - managingFocusBackwardTraversalKeys = new HashSet();
> + managingFocusBackwardTraversalKeys = new HashSet<KeyStroke>();
> managingFocusBackwardTraversalKeys.add(
> KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
> }
> Index: classes/javax/swing/plaf/synth/SynthStyle.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthStyle.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthStyle.java (working copy)
> @@ -49,12 +49,13 @@
> * @version 1.44, 05/05/07
> * @since 1.5
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public abstract class SynthStyle {
> /**
> * Contains the default values for certain properties.
> */
> - private static Map DEFAULT_VALUES;
> + private static Map<Object, Object> DEFAULT_VALUES;
>
> /**
> * Shared SynthGraphics.
> @@ -716,7 +717,7 @@
> private static Object getDefaultValue(Object key) {
> synchronized(SynthStyle.class) {
> if (DEFAULT_VALUES == null) {
> - DEFAULT_VALUES = new HashMap();
> + DEFAULT_VALUES = new HashMap<Object, Object>();
> populateDefaultValues();
> }
> Object value = DEFAULT_VALUES.get(key);
> Index: classes/javax/swing/plaf/synth/SynthTextAreaUI.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthTextAreaUI.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthTextAreaUI.java (working copy)
> @@ -49,6 +49,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Shannon Hickey
> + * @author Florian Brunner
> * @version 1.16 05/05/07
> */
> class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI {
> @@ -67,7 +68,7 @@
> protected void installDefaults() {
> // Installs the text cursor on the component
> super.installDefaults();
> - updateStyle((JTextComponent)getComponent());
> + updateStyle(getComponent());
> }
>
> protected void uninstallDefaults() {
> Index: classes/javax/swing/plaf/synth/SynthTextFieldUI.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthTextFieldUI.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthTextFieldUI.java (working copy)
> @@ -51,6 +51,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Shannon Hickey
> + * @author Florian Brunner
> * @version 1.19 05/05/07
> */
> class SynthTextFieldUI
> @@ -233,7 +234,7 @@
> protected void installDefaults() {
> // Installs the text cursor on the component
> super.installDefaults();
> - updateStyle((JTextComponent)getComponent());
> + updateStyle(getComponent());
> getComponent().addFocusListener(this);
> }
>
> Index: classes/javax/swing/plaf/synth/SynthTreeUI.java
> ===================================================================
> --- classes/javax/swing/plaf/synth/SynthTreeUI.java (revision 250)
> +++ classes/javax/swing/plaf/synth/SynthTreeUI.java (working copy)
> @@ -44,6 +44,7 @@
> *
> * @version 1.40, 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> */
> class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
> SynthUI {
> @@ -524,7 +525,7 @@
> // Don't paint the renderer if editing this row.
> boolean selected = tree.isRowSelected(row);
>
> - JTree.DropLocation dropLocation = (JTree.DropLocation)tree.getDropLocation();
> + JTree.DropLocation dropLocation = tree.getDropLocation();
> boolean isDrop = dropLocation != null
> && dropLocation.getChildIndex() == -1
> && path == dropLocation.getPath();
> Index: classes/javax/swing/PopupFactory.java
> ===================================================================
> --- classes/javax/swing/PopupFactory.java (revision 250)
> +++ classes/javax/swing/PopupFactory.java (working copy)
> @@ -53,6 +53,8 @@
> *
> * @see Popup
> *
> + * @author unattributed
> + * @author Florian Brunner
> * @version 1.26 02/22/05
> * @since 1.4
> */
> @@ -381,13 +383,13 @@
> * <code>Window</code> to a <code>List</code> of
> * <code>HeavyWeightPopup</code>s.
> */
> - private static Map getHeavyWeightPopupCache() {
> + private static Map<Window, List<HeavyWeightPopup>> getHeavyWeightPopupCache() {
> synchronized (HeavyWeightPopup.class) {
> - Map cache = (Map)SwingUtilities.appContextGet(
> + Map<Window, List<HeavyWeightPopup>> cache = (Map<Window, List<HeavyWeightPopup>>)SwingUtilities.appContextGet(
> heavyWeightPopupCacheKey);
>
> if (cache == null) {
> - cache = new HashMap(2);
> + cache = new HashMap<Window, List<HeavyWeightPopup>>(2);
> SwingUtilities.appContextPut(heavyWeightPopupCacheKey,
> cache);
> }
> @@ -400,13 +402,13 @@
> */
> private static void recycleHeavyWeightPopup(HeavyWeightPopup popup) {
> synchronized (HeavyWeightPopup.class) {
> - List cache;
> - Object window = SwingUtilities.getWindowAncestor(
> + List<HeavyWeightPopup> cache;
> + Window window = SwingUtilities.getWindowAncestor(
> popup.getComponent());
> - Map heavyPopupCache = getHeavyWeightPopupCache();
> + Map<Window, List<HeavyWeightPopup>> heavyPopupCache = getHeavyWeightPopupCache();
>
> if (window instanceof Popup.DefaultFrame ||
> - !((Window)window).isVisible()) {
> + !window.isVisible()) {
> // If the Window isn't visible, we don't cache it as we
> // likely won't ever get a windowClosed event to clean up.
> // We also don't cache DefaultFrames as this indicates
> @@ -415,12 +417,12 @@
> popup._dispose();
> return;
> } else if (heavyPopupCache.containsKey(window)) {
> - cache = (List)heavyPopupCache.get(window);
> + cache = heavyPopupCache.get(window);
> } else {
> - cache = new ArrayList();
> + cache = new ArrayList<HeavyWeightPopup>();
> heavyPopupCache.put(window, cache);
> // Clean up if the Window is closed
> - final Window w = (Window)window;
> + final Window w = window;
>
> w.addWindowListener(new WindowAdapter() {
> public void windowClosed(WindowEvent e) {
> @@ -644,11 +646,11 @@
> /**
> * Returns the cache to use for heavy weight popups.
> */
> - private static List getLightWeightPopupCache() {
> - List cache = (List)SwingUtilities.appContextGet(
> + private static List<LightWeightPopup> getLightWeightPopupCache() {
> + List<LightWeightPopup> cache = (List<LightWeightPopup>)SwingUtilities.appContextGet(
> lightWeightPopupCacheKey);
> if (cache == null) {
> - cache = new ArrayList();
> + cache = new ArrayList<LightWeightPopup>();
> SwingUtilities.appContextPut(lightWeightPopupCacheKey, cache);
> }
> return cache;
> @@ -659,7 +661,7 @@
> */
> private static void recycleLightWeightPopup(LightWeightPopup popup) {
> synchronized (LightWeightPopup.class) {
> - List lightPopupCache = getLightWeightPopupCache();
> + List<LightWeightPopup> lightPopupCache = getLightWeightPopupCache();
> if (lightPopupCache.size() < MAX_CACHE_SIZE) {
> lightPopupCache.add(popup);
> }
> @@ -803,12 +805,12 @@
> /**
> * Returns the cache to use for medium weight popups.
> */
> - private static List getMediumWeightPopupCache() {
> - List cache = (List)SwingUtilities.appContextGet(
> + private static List<MediumWeightPopup> getMediumWeightPopupCache() {
> + List<MediumWeightPopup> cache = (List<MediumWeightPopup>)SwingUtilities.appContextGet(
> mediumWeightPopupCacheKey);
>
> if (cache == null) {
> - cache = new ArrayList();
> + cache = new ArrayList<MediumWeightPopup>();
> SwingUtilities.appContextPut(mediumWeightPopupCacheKey, cache);
> }
> return cache;
> @@ -819,7 +821,7 @@
> */
> private static void recycleMediumWeightPopup(MediumWeightPopup popup) {
> synchronized (MediumWeightPopup.class) {
> - List mediumPopupCache = getMediumWeightPopupCache();
> + List<MediumWeightPopup> mediumPopupCache = getMediumWeightPopupCache();
> if (mediumPopupCache.size() < MAX_CACHE_SIZE) {
> mediumPopupCache.add(popup);
> }
> Index: classes/javax/swing/ProgressMonitor.java
> ===================================================================
> --- classes/javax/swing/ProgressMonitor.java (revision 250)
> +++ classes/javax/swing/ProgressMonitor.java (working copy)
> @@ -76,7 +76,8 @@
> *
> * @see ProgressMonitorInputStream
> * @author James Gosling
> - * @author Lynn Monsanto (accessibility)
> + * @author Lynn Monsanto (accessibility)
> + * @author Florian Brunner
> * @version 1.43 05/05/07
> */
> public class ProgressMonitor extends Object implements Accessible
> @@ -187,7 +188,7 @@
> }
> if (window instanceof SwingUtilities.SharedOwnerFrame) {
> WindowListener ownerShutdownListener =
> - (WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
> + SwingUtilities.getSharedOwnerFrameShutdownListener();
> dialog.addWindowListener(ownerShutdownListener);
> }
> Container contentPane = dialog.getContentPane();
> @@ -274,7 +275,7 @@
> if (dT >= millisToDecideToPopup) {
> int predictedCompletionTime;
> if (nv > min) {
> - predictedCompletionTime = (int)((long)dT *
> + predictedCompletionTime = (int)(dT *
> (max - min) /
> (nv - min));
> }
> Index: classes/javax/swing/RepaintManager.java
> ===================================================================
> --- classes/javax/swing/RepaintManager.java (revision 250)
> +++ classes/javax/swing/RepaintManager.java (working copy)
> @@ -54,6 +54,7 @@
> *
> * @version 1.76 05/09/07
> * @author Arnaud Weber
> + * @author Florian Brunner
> */
> public class RepaintManager
> {
> @@ -573,7 +574,7 @@
> */
> private synchronized boolean extendDirtyRegion(
> Component c, int x, int y, int w, int h) {
> - Rectangle r = (Rectangle)dirtyComponents.get(c);
> + Rectangle r = dirtyComponents.get(c);
> if (r != null) {
> // A non-null r implies c is already marked as dirty,
> // and that the parent is valid. Therefore we can
> @@ -591,7 +592,7 @@
> public Rectangle getDirtyRegion(JComponent aComponent) {
> Rectangle r = null;
> synchronized(this) {
> - r = (Rectangle)dirtyComponents.get(aComponent);
> + r = dirtyComponents.get(aComponent);
> }
> if(r == null)
> return new Rectangle(0,0,0,0);
> @@ -819,7 +820,7 @@
>
> dx = rootDx = 0;
> dy = rootDy = 0;
> - tmp.setBounds((Rectangle) dirtyComponents.get(dirtyComponent));
> + tmp.setBounds(dirtyComponents.get(dirtyComponent));
>
> // System.out.println("Collect dirty component for bound " + tmp +
> // "component bounds is " + cBounds);;
> @@ -866,7 +867,7 @@
> Rectangle r;
> tmp.setLocation(tmp.x + rootDx - dx,
> tmp.y + rootDy - dy);
> - r = (Rectangle)dirtyComponents.get(rootDirtyComponent);
> + r = dirtyComponents.get(rootDirtyComponent);
> SwingUtilities.computeUnion(tmp.x,tmp.y,tmp.width,tmp.height,r);
> }
>
> @@ -1011,7 +1012,7 @@
> Iterator gcs = volatileMap.keySet().iterator();
> while (gcs.hasNext()) {
> GraphicsConfiguration gc = (GraphicsConfiguration)gcs.next();
> - VolatileImage image = (VolatileImage)volatileMap.get(gc);
> + VolatileImage image = volatileMap.get(gc);
> if (image.getWidth() > width || image.getHeight() > height) {
> image.flush();
> gcs.remove();
> Index: classes/javax/swing/SortingFocusTraversalPolicy.java
> ===================================================================
> --- classes/javax/swing/SortingFocusTraversalPolicy.java (revision 250)
> +++ classes/javax/swing/SortingFocusTraversalPolicy.java (working copy)
> @@ -54,6 +54,7 @@
> * policy is used to perform the search operation.
> *
> * @author David Mendenhall
> + * @author Florian Brunner
> * @version 1.16, 05/05/07
> *
> * @see java.util.Comparator
> @@ -80,7 +81,7 @@
> * sorted list should be reused if possible.
> */
> private Container cachedRoot;
> - private List cachedCycle;
> + private List<Component> cachedCycle;
>
> // Delegate our fitness test to ContainerOrder so that we only have to
> // code the algorithm once.
> @@ -104,8 +105,8 @@
> }
>
> private void enumerateAndSortCycle(Container focusCycleRoot,
> - List cycle, Map defaults) {
> - List defaultRoots = null;
> + List<Component> cycle, Map<Integer, Component> defaults) {
> + List<Container> defaultRoots = null;
>
> if (!focusCycleRoot.isShowing()) {
> return;
> @@ -121,13 +122,12 @@
> // Create a list of all default Components which should be added
> // to the list
> if (addDefaultComponents) {
> - defaultRoots = new ArrayList();
> - for (Iterator iter = cycle.iterator(); iter.hasNext(); ) {
> - Component comp = (Component)iter.next();
> + defaultRoots = new ArrayList<Container>();
> + for (Component comp : cycle) {
> if ((comp instanceof Container) &&
> ((Container)comp).isFocusCycleRoot())
> {
> - defaultRoots.add(comp);
> + defaultRoots.add((Container) comp);
> }
> }
> Collections.sort(defaultRoots, comparator);
> @@ -160,13 +160,13 @@
> index = -index - 2;
> }
>
> - defaults.put(new Integer(index), defComp);
> + defaults.put(index, defComp);
> }
> }
> }
> }
>
> - private void enumerateCycle(Container container, List cycle) {
> + private void enumerateCycle(Container container, List<Component> cycle) {
> if (!(container.isVisible() && container.isDisplayable())) {
> return;
> }
> @@ -257,8 +257,8 @@
> aComponent = ftp;
> }
>
> - List cycle = new ArrayList();
> - Map defaults = new HashMap();
> + List<Component> cycle = new ArrayList<Component>();
> + Map<Integer, Component> defaults = new HashMap<Integer, Component>();
> enumerateAndSortCycle(aContainer, cycle, defaults);
>
> int index;
> @@ -286,7 +286,7 @@
> }
> }
>
> - Component defComp = (Component)defaults.get(new Integer(index));
> + Component defComp = defaults.get(new Integer(index));
> if (defComp != null) {
> return defComp;
> }
> @@ -309,7 +309,7 @@
> return null;
> }
> } else {
> - Component comp = (Component)cycle.get(index);
> + Component comp = cycle.get(index);
> if (accept(comp)) {
> return comp;
> } else if (comp instanceof Container && ((Container)comp).isFocusTraversalPolicyProvider()) {
> @@ -370,8 +370,8 @@
> }
>
>
> - List cycle = new ArrayList();
> - Map defaults = new HashMap();
> + List<Component> cycle = new ArrayList<Component>();
> + Map<Integer, Component> defaults = new HashMap<Integer, Component>();
> enumerateAndSortCycle(aContainer, cycle, defaults);
>
> if (log.isLoggable(Level.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent);
> @@ -396,7 +396,7 @@
> if (log.isLoggable(Level.FINE)) log.fine("### Index is " + index);
>
> if (index >= 0) {
> - Component defComp = (Component)defaults.get(new Integer(index));
> + Component defComp = defaults.get(new Integer(index));
> if (defComp != null && cycle.get(index) != aContainer) {
> if (log.isLoggable(Level.FINE)) log.fine("### Returning default " + defComp.getName() + " at " + index);
> return defComp;
> @@ -415,7 +415,7 @@
>
> return retval;
> } else {
> - Component comp = (Component)cycle.get(index);
> + Component comp = cycle.get(index);
> if (accept(comp)) {
> return comp;
> } else if (comp instanceof Container && ((Container)comp).isFocusTraversalPolicyProvider()) {
> @@ -438,7 +438,7 @@
> * @throws IllegalArgumentException if aContainer is null
> */
> public Component getFirstComponent(Container aContainer) {
> - List cycle;
> + List<Component> cycle;
>
> if (log.isLoggable(Level.FINE)) log.fine("### Getting first component in " + aContainer.getName());
> if (aContainer == null) {
> @@ -448,7 +448,7 @@
> if (this.cachedRoot == aContainer) {
> cycle = this.cachedCycle;
> } else {
> - cycle = new ArrayList();
> + cycle = new ArrayList<Component>();
> enumerateAndSortCycle(aContainer, cycle, null);
> }
>
> @@ -458,7 +458,7 @@
> }
>
> for (int i= 0; i < cycle.size(); i++) {
> - Component comp = (Component)cycle.get(i);
> + Component comp = cycle.get(i);
> if (accept(comp)) {
> return comp;
> } else if (comp instanceof Container && !(comp == aContainer) && ((Container)comp).isFocusTraversalPolicyProvider()) {
> @@ -480,7 +480,7 @@
> * @throws IllegalArgumentException if aContainer is null
> */
> public Component getLastComponent(Container aContainer) {
> - List cycle;
> + List<Component> cycle;
> if (log.isLoggable(Level.FINE)) log.fine("### Getting last component in " + aContainer.getName());
>
> if (aContainer == null) {
> @@ -490,7 +490,7 @@
> if (this.cachedRoot == aContainer) {
> cycle = this.cachedCycle;
> } else {
> - cycle = new ArrayList();
> + cycle = new ArrayList<Component>();
> enumerateAndSortCycle(aContainer, cycle, null);
> }
>
> @@ -502,7 +502,7 @@
> if (log.isLoggable(Level.FINE)) log.fine("### Cycle is " + cycle);
>
> for (int i= cycle.size()-1; i >= 0; i--) {
> - Component comp = (Component)cycle.get(i);
> + Component comp = cycle.get(i);
> if (accept(comp)) {
> return comp;
> } else if (comp instanceof Container && !(comp == aContainer) && ((Container)comp).isFocusTraversalPolicyProvider()) {
> Index: classes/javax/swing/SpringLayout.java
> ===================================================================
> --- classes/javax/swing/SpringLayout.java (revision 250)
> +++ classes/javax/swing/SpringLayout.java (working copy)
> @@ -183,14 +183,15 @@
> * @author Philip Milne
> * @author Scott Violet
> * @author Joe Winchester
> + * @author Florian Brunner
> * @since 1.4
> */
> public class SpringLayout implements LayoutManager2 {
> - private Map componentConstraints = new HashMap();
> + private Map<Component, Constraints> componentConstraints = new HashMap<Component, Constraints>();
>
> private Spring cyclicReference = Spring.constant(Spring.UNSET);
> - private Set cyclicSprings;
> - private Set acyclicSprings;
> + private Set<Spring> cyclicSprings;
> + private Set<Spring> acyclicSprings;
>
>
> /**
> @@ -882,8 +883,8 @@
> public SpringLayout() {}
>
> private void resetCyclicStatuses() {
> - cyclicSprings = new HashSet();
> - acyclicSprings = new HashSet();
> + cyclicSprings = new HashSet<Spring>();
> + acyclicSprings = new HashSet<Spring>();
> }
>
> private void setParent(Container p) {
> @@ -1146,7 +1147,7 @@
> * @return the constraints for the specified component
> */
> public Constraints getConstraints(Component c) {
> - Constraints result = (Constraints)componentConstraints.get(c);
> + Constraints result = componentConstraints.get(c);
> if (result == null) {
> if (c instanceof javax.swing.JComponent) {
> Object cp = ((javax.swing.JComponent)c).getClientProperty(SpringLayout.class);
> Index: classes/javax/swing/SwingUtilities.java
> ===================================================================
> --- classes/javax/swing/SwingUtilities.java (revision 250)
> +++ classes/javax/swing/SwingUtilities.java (working copy)
> @@ -52,6 +52,7 @@
> *
> * @version 1.154 05/05/07
> * @author unknown
> + * @author Florian Brunner
> */
> public class SwingUtilities implements SwingConstants
> {
> @@ -1870,7 +1871,7 @@
> }
>
>
> - static Class loadSystemClass(String className) throws ClassNotFoundException {
> + static Class<?> loadSystemClass(String className) throws ClassNotFoundException {
> return Class.forName(className, true, Thread.currentThread().
> getContextClassLoader());
> }
> Index: classes/javax/swing/SwingWorker.java
> ===================================================================
> --- classes/javax/swing/SwingWorker.java (revision 250)
> +++ classes/javax/swing/SwingWorker.java (working copy)
> @@ -214,6 +214,7 @@
> * {@link java.util.concurrent.Executor} for execution.
> *
> * @author Igor Kushnirskiy
> + * @author Florian Brunner
> * @version 1.14 05/05/07
> *
> * @param <T> the result type returned by this {@code SwingWorker's}
> @@ -875,7 +876,7 @@
> }
> private static class DoSubmitAccumulativeRunnable
> extends AccumulativeRunnable<Runnable> implements ActionListener {
> - private final static int DELAY = (int) (1000 / 30);
> + private final static int DELAY = 1000 / 30;
> @Override
> protected void run(List<Runnable> args) {
> for (Runnable runnable : args) {
> Index: classes/javax/swing/table/AbstractTableModel.java
> ===================================================================
> --- classes/javax/swing/table/AbstractTableModel.java (revision 250)
> +++ classes/javax/swing/table/AbstractTableModel.java (working copy)
> @@ -57,6 +57,7 @@
> * @version 1.48 05/05/07
> * @author Alan Chung
> * @author Philip Milne
> + * @author Florian Brunner
> */
> public abstract class AbstractTableModel implements TableModel, Serializable
> {
> @@ -177,8 +178,7 @@
> * @since 1.4
> */
> public TableModelListener[] getTableModelListeners() {
> - return (TableModelListener[])listenerList.getListeners(
> - TableModelListener.class);
> + return listenerList.getListeners(TableModelListener.class);
> }
>
> //
> Index: classes/javax/swing/table/DefaultTableColumnModel.java
> ===================================================================
> --- classes/javax/swing/table/DefaultTableColumnModel.java (revision 250)
> +++ classes/javax/swing/table/DefaultTableColumnModel.java (working copy)
> @@ -51,6 +51,7 @@
> * @version 1.58 05/05/07
> * @author Alan Chung
> * @author Philip Milne
> + * @author Florian Brunner
> * @see JTable
> */
> public class DefaultTableColumnModel implements TableColumnModel,
> @@ -191,7 +192,7 @@
> fireColumnMoved(new TableColumnModelEvent(this, columnIndex, newIndex));
> return;
> }
> - aColumn = (TableColumn)tableColumns.elementAt(columnIndex);
> + aColumn = tableColumns.elementAt(columnIndex);
>
> tableColumns.removeElementAt(columnIndex);
> boolean selected = selectionModel.isSelectedIndex(columnIndex);
> @@ -292,7 +293,7 @@
> * at <code>columnIndex</code>
> */
> public TableColumn getColumn(int columnIndex) {
> - return (TableColumn)tableColumns.elementAt(columnIndex);
> + return tableColumns.elementAt(columnIndex);
> }
>
> /**
> @@ -505,8 +506,7 @@
> * @since 1.4
> */
> public TableColumnModelListener[] getColumnModelListeners() {
> - return (TableColumnModelListener[])listenerList.getListeners(
> - TableColumnModelListener.class);
> + return listenerList.getListeners(TableColumnModelListener.class);
> }
>
> //
> Index: classes/javax/swing/table/DefaultTableModel.java
> ===================================================================
> --- classes/javax/swing/table/DefaultTableModel.java (revision 250)
> +++ classes/javax/swing/table/DefaultTableModel.java (working copy)
> @@ -27,7 +27,6 @@
>
> import java.io.Serializable;
> import java.util.Vector;
> -import java.util.Enumeration;
> import javax.swing.event.TableModelEvent;
>
>
> @@ -56,6 +55,7 @@
> *
> * @version 1.49 05/05/07
> * @author Philip Milne
> + * @author Florian Brunner
> *
> * @see TableModel
> * @see #getDataVector
> @@ -394,13 +394,13 @@
> return (j == 0) ? i : gcd(j, i%j);
> }
>
> - private static void rotate(Vector v, int a, int b, int shift) {
> + private static void rotate(Vector<Vector<Object>> v, int a, int b, int shift) {
> int size = b - a;
> int r = size - shift;
> int g = gcd(size, r);
> for(int i = 0; i < g; i++) {
> int to = i;
> - Object tmp = v.elementAt(a + to);
> + Vector<Object> tmp = v.elementAt(a + to);
> for(int from = (to + r) % size; from != i; from = (to + r) % size) {
> v.setElementAt(v.elementAt(a + from), a + to);
> to = from;
> @@ -558,7 +558,7 @@
> justifyRows(0, getRowCount());
> int newColumn = getColumnCount() - 1;
> for(int i = 0; i < columnSize; i++) {
> - Vector row = (Vector)dataVector.elementAt(i);
> + Vector<Object> row = (Vector<Object>) dataVector.elementAt(i);
> row.setElementAt(columnData.elementAt(i), newColumn);
> }
> }
> @@ -663,7 +663,7 @@
> * column was given
> */
> public void setValueAt(Object aValue, int row, int column) {
> - Vector rowVector = (Vector)dataVector.elementAt(row);
> + Vector<Object> rowVector = (Vector<Object>) dataVector.elementAt(row);
> rowVector.setElementAt(aValue, column);
> fireTableCellUpdated(row, column);
> }
> @@ -682,7 +682,7 @@
> if (anArray == null) {
> return null;
> }
> - Vector v = new Vector(anArray.length);
> + Vector<Object> v = new Vector<Object>(anArray.length);
> for (int i=0; i < anArray.length; i++) {
> v.addElement(anArray[i]);
> }
> @@ -699,7 +699,7 @@
> if (anArray == null) {
> return null;
> }
> - Vector v = new Vector(anArray.length);
> + Vector<Vector<Object>> v = new Vector<Vector<Object>>(anArray.length);
> for (int i=0; i < anArray.length; i++) {
> v.addElement(convertToVector(anArray[i]));
> }
> Index: classes/javax/swing/text/AbstractDocument.java
> ===================================================================
> --- classes/javax/swing/text/AbstractDocument.java (revision 250)
> +++ classes/javax/swing/text/AbstractDocument.java (working copy)
> @@ -96,6 +96,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.163 05/05/07
> */
> public abstract class AbstractDocument implements Document, Serializable {
> @@ -125,7 +126,7 @@
> if (defaultI18NProperty == null) {
> // determine default setting for i18n support
> Object o = java.security.AccessController.doPrivileged(
> - new java.security.PrivilegedAction() {
> + new java.security.PrivilegedAction<Object>() {
> public Object run() {
> return System.getProperty(I18NProperty);
> }
> @@ -164,7 +165,7 @@
> */
> public Dictionary<Object,Object> getDocumentProperties() {
> if (documentProperties == null) {
> - documentProperties = new Hashtable(2);
> + documentProperties = new Hashtable<Object, Object>(2);
> }
> return documentProperties;
> }
> @@ -468,8 +469,7 @@
> * @since 1.4
> */
> public DocumentListener[] getDocumentListeners() {
> - return (DocumentListener[])listenerList.getListeners(
> - DocumentListener.class);
> + return listenerList.getListeners(DocumentListener.class);
> }
>
> /**
> @@ -509,8 +509,7 @@
> * @since 1.4
> */
> public UndoableEditListener[] getUndoableEditListeners() {
> - return (UndoableEditListener[])listenerList.getListeners(
> - UndoableEditListener.class);
> + return listenerList.getListeners(UndoableEditListener.class);
> }
>
> /**
> @@ -1052,7 +1051,7 @@
> byte levels[] = calculateBidiLevels( firstPStart, lastPEnd );
>
>
> - Vector newElements = new Vector();
> + Vector<Element> newElements = new Vector<Element>();
>
> // Calculate the first span of characters in the affected range with
> // the same bidi level. If this level is the same as the level of the
> @@ -2461,7 +2460,7 @@
> if(nchildren == 0)
> return null;
>
> - Vector tempVector = new Vector(nchildren);
> + Vector<AbstractElement> tempVector = new Vector<AbstractElement>(nchildren);
>
> for(int counter = 0; counter < nchildren; counter++)
> tempVector.addElement(children[counter]);
> @@ -2750,7 +2749,7 @@
> // if the number of changes gets too great, start using
> // a hashtable for to locate the change for a given element.
> if ((changeLookup == null) && (edits.size() > 10)) {
> - changeLookup = new Hashtable();
> + changeLookup = new Hashtable<Element, ElementChange>();
> int n = edits.size();
> for (int i = 0; i < n; i++) {
> Object o = edits.elementAt(i);
> @@ -2919,7 +2918,7 @@
> */
> public DocumentEvent.ElementChange getChange(Element elem) {
> if (changeLookup != null) {
> - return (DocumentEvent.ElementChange) changeLookup.get(elem);
> + return changeLookup.get(elem);
> }
> int n = edits.size();
> for (int i = 0; i < n; i++) {
> @@ -2938,7 +2937,7 @@
>
> private int offset;
> private int length;
> - private Hashtable changeLookup;
> + private Hashtable<Element, ElementChange> changeLookup;
> private DocumentEvent.EventType type;
>
> }
> Index: classes/javax/swing/text/AsyncBoxView.java
> ===================================================================
> --- classes/javax/swing/text/AsyncBoxView.java (revision 250)
> +++ classes/javax/swing/text/AsyncBoxView.java (working copy)
> @@ -45,6 +45,7 @@
> * so that the model is stable while being accessed.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.24 05/05/07
> * @since 1.3
> */
> @@ -59,7 +60,7 @@
> */
> public AsyncBoxView(Element elem, int axis) {
> super(elem);
> - stats = new ArrayList();
> + stats = new ArrayList<ChildState>();
> this.axis = axis;
> locator = new ChildLocator();
> flushTask = new FlushTask();
> @@ -198,7 +199,7 @@
> protected ChildState getChildState(int index) {
> synchronized(stats) {
> if ((index >= 0) && (index < stats.size())) {
> - return (ChildState) stats.get(index);
> + return stats.get(index);
> }
> return null;
> }
> @@ -358,7 +359,7 @@
> synchronized(stats) {
> // remove the replaced state records
> for (int i = 0; i < length; i++) {
> - ChildState cs = (ChildState)stats.remove(offset);
> + ChildState cs = stats.remove(offset);
> float csSpan = cs.getMajorSpan();
>
> cs.getChildView().setParent(null);
> @@ -864,7 +865,7 @@
> /**
> * The children and their layout statistics.
> */
> - java.util.List stats;
> + java.util.List<ChildState> stats;
>
> /**
> * Current span along the major axis. This
> Index: classes/javax/swing/text/ComponentView.java
> ===================================================================
> --- classes/javax/swing/text/ComponentView.java (revision 250)
> +++ classes/javax/swing/text/ComponentView.java (working copy)
> @@ -65,6 +65,7 @@
> * views of a shared model.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.60 05/05/07
> */
> public class ComponentView extends View {
> @@ -481,7 +482,7 @@
> return yalign;
> }
>
> - public java.util.Set getFocusTraversalKeys(int id) {
> + public java.util.Set<AWTKeyStroke> getFocusTraversalKeys(int id) {
> return KeyboardFocusManager.getCurrentKeyboardFocusManager().
> getDefaultFocusTraversalKeys(id);
> }
> @@ -503,3 +504,4 @@
>
> }
>
> +
> Index: classes/javax/swing/text/DefaultCaret.java
> ===================================================================
> --- classes/javax/swing/text/DefaultCaret.java (revision 250)
> +++ classes/javax/swing/text/DefaultCaret.java (working copy)
> @@ -103,6 +103,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.154 05/05/07
> * @see Caret
> */
> @@ -775,8 +776,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
> /**
> @@ -1917,3 +1917,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/text/DefaultFormatter.java
> ===================================================================
> --- classes/javax/swing/text/DefaultFormatter.java (revision 250)
> +++ classes/javax/swing/text/DefaultFormatter.java (working copy)
> @@ -54,6 +54,8 @@
> *
> * @see javax.swing.JFormattedTextField.AbstractFormatter
> *
> + * @author unattributed
> + * @author Florian Brunner
> * @version 1.20 05/05/07
> * @since 1.4
> */
> @@ -69,7 +71,7 @@
> private boolean commitOnEdit;
>
> /** Class used to create new instances. */
> - private Class valueClass;
> + private Class<?> valueClass;
>
> /** NavigationFilter that forwards calls back to DefaultFormatter. */
> private NavigationFilter navigationFilter;
> @@ -232,7 +234,7 @@
> * @return Object representation of text
> */
> public Object stringToValue(String string) throws ParseException {
> - Class vc = getValueClass();
> + Class<?> vc = getValueClass();
> JFormattedTextField ftf = getFormattedTextField();
>
> if (vc == null && ftf != null) {
> Index: classes/javax/swing/text/DefaultHighlighter.java
> ===================================================================
> --- classes/javax/swing/text/DefaultHighlighter.java (revision 250)
> +++ classes/javax/swing/text/DefaultHighlighter.java (working copy)
> @@ -34,6 +34,7 @@
> * painter that renders in a solid color.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.47 05/21/07
> * @see Highlighter
> */
> @@ -57,7 +58,7 @@
> // PENDING(prinz) - should cull ranges not visible
> int len = highlights.size();
> for (int i = 0; i < len; i++) {
> - HighlightInfo info = (HighlightInfo) highlights.elementAt(i);
> + HighlightInfo info = highlights.elementAt(i);
> if (!(info instanceof LayeredHighlightInfo)) {
> // Avoid allocing unless we need it.
> Rectangle a = component.getBounds();
> @@ -67,7 +68,7 @@
> a.width -= insets.left + insets.right;
> a.height -= insets.top + insets.bottom;
> for (; i < len; i++) {
> - info = (HighlightInfo)highlights.elementAt(i);
> + info = highlights.elementAt(i);
> if (!(info instanceof LayeredHighlightInfo)) {
> Highlighter.HighlightPainter p = info.getPainter();
> p.paint(g, info.getStartOffset(), info.getEndOffset(),
> @@ -160,7 +161,7 @@
> int p0 = -1;
> int p1 = -1;
> for (int i = 0; i < len; i++) {
> - HighlightInfo hi = (HighlightInfo)highlights.elementAt(i);
> + HighlightInfo hi = highlights.elementAt(i);
> if (hi instanceof LayeredHighlightInfo) {
> LayeredHighlightInfo info = (LayeredHighlightInfo)hi;
> minX = Math.min(minX, info.x);
> @@ -196,7 +197,7 @@
> int p0 = Integer.MAX_VALUE;
> int p1 = 0;
> for (int i = 0; i < len; i++) {
> - HighlightInfo info = (HighlightInfo) highlights.elementAt(i);
> + HighlightInfo info = highlights.elementAt(i);
> p0 = Math.min(p0, info.p0.getOffset());
> p1 = Math.max(p1, info.p1.getOffset());
> }
> @@ -334,7 +335,7 @@
>
> private final static Highlighter.Highlight[] noHighlights =
> new Highlighter.Highlight[0];
> - private Vector highlights = new Vector(); // Vector<HighlightInfo>
> + private Vector<HighlightInfo> highlights = new Vector<HighlightInfo>(); // Vector<HighlightInfo>
> private JTextComponent component;
> private boolean drawsLayeredHighlights;
> private SafeDamager safeDamager = new SafeDamager();
> @@ -574,8 +575,8 @@
> * call.
> */
> class SafeDamager implements Runnable {
> - private Vector p0 = new Vector(10);
> - private Vector p1 = new Vector(10);
> + private Vector<Position> p0 = new Vector<Position>(10);
> + private Vector<Position> p1 = new Vector<Position>(10);
> private Document lastDoc = null;
>
> /**
> @@ -590,8 +591,8 @@
> int len = p0.size();
> for (int i = 0; i < len; i++){
> mapper.damageRange(component,
> - ((Position)p0.get(i)).getOffset(),
> - ((Position)p1.get(i)).getOffset());
> + (p0.get(i)).getOffset(),
> + (p1.get(i)).getOffset());
> }
> }
> }
> Index: classes/javax/swing/text/DefaultStyledDocument.java
> ===================================================================
> --- classes/javax/swing/text/DefaultStyledDocument.java (revision 250)
> +++ classes/javax/swing/text/DefaultStyledDocument.java (working copy)
> @@ -70,6 +70,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.133 05/05/07
> * @see Document
> * @see AbstractDocument
> @@ -85,7 +86,7 @@
> */
> public DefaultStyledDocument(Content c, StyleContext styles) {
> super(c, styles);
> - listeningStyles = new Vector();
> + listeningStyles = new Vector<Style>();
> buffer = new ElementBuffer(createDefaultRoot());
> Style defaultStyle = styles.getStyle(StyleContext.DEFAULT_STYLE);
> setLogicalStyle(0, defaultStyle);
> @@ -656,7 +657,7 @@
>
> try {
> Segment s = new Segment();
> - Vector parseBuffer = new Vector();
> + Vector<ElementSpec> parseBuffer = new Vector<ElementSpec>();
> ElementSpec lastStartSpec = null;
> boolean insertingAfterNewline = false;
> short lastStartDirection = ElementSpec.OriginateDirection;
> @@ -671,8 +672,7 @@
> offset, endOffset);
> for(int counter = parseBuffer.size() - 1; counter >= 0;
> counter--) {
> - ElementSpec spec = (ElementSpec)parseBuffer.
> - elementAt(counter);
> + ElementSpec spec = parseBuffer.elementAt(counter);
> if(spec.getType() == ElementSpec.StartTagType) {
> lastStartSpec = spec;
> break;
> @@ -710,7 +710,7 @@
> n - lastOffset));
> }
>
> - ElementSpec first = (ElementSpec) parseBuffer.firstElement();
> + ElementSpec first = parseBuffer.firstElement();
>
> int docLength = getLength();
>
> @@ -751,7 +751,7 @@
> // direction isn't originate, and the element at endOffset
> // is a leaf.
> if(insertingAtBoundry && endOffset < docLength) {
> - ElementSpec last = (ElementSpec) parseBuffer.lastElement();
> + ElementSpec last = parseBuffer.lastElement();
> if(last.getType() == ElementSpec.ContentType &&
> last.getDirection() != ElementSpec.JoinPreviousDirection &&
> ((lastStartSpec == null && (paragraph == pParagraph ||
> @@ -773,7 +773,7 @@
> else if(!insertingAtBoundry && lastStartSpec != null &&
> lastStartSpec.getDirection() ==
> ElementSpec.JoinFractureDirection) {
> - ElementSpec last = (ElementSpec) parseBuffer.lastElement();
> + ElementSpec last = parseBuffer.lastElement();
> if(last.getType() == ElementSpec.ContentType &&
> last.getDirection() != ElementSpec.JoinPreviousDirection &&
> attr.isEqual(cattr)) {
> @@ -806,7 +806,7 @@
> * necessarily create the last start spec).
> */
> short createSpecsForInsertAfterNewline(Element paragraph,
> - Element pParagraph, AttributeSet pattr, Vector parseBuffer,
> + Element pParagraph, AttributeSet pattr, Vector<ElementSpec> parseBuffer,
> int offset, int endOffset) {
> // Need to find the common parent of pParagraph and paragraph.
> if(paragraph.getParentElement() == pParagraph.getParentElement()) {
> @@ -826,8 +826,8 @@
> else {
> // Will only happen for text with more than 2 levels.
> // Find the common parent of a paragraph and pParagraph
> - Vector leftParents = new Vector();
> - Vector rightParents = new Vector();
> + Vector<Element> leftParents = new Vector<Element>();
> + Vector<Element> rightParents = new Vector<Element>();
> Element e = pParagraph;
> while(e != null) {
> leftParents.addElement(e);
> @@ -851,8 +851,8 @@
> ElementSpec spec = null;
> for(int counter = rightParents.size() - 1;
> counter >= 0; counter--) {
> - spec = new ElementSpec(((Element)rightParents.
> - elementAt(counter)).getAttributes(),
> + spec = new ElementSpec(rightParents.
> + elementAt(counter).getAttributes(),
> ElementSpec.StartTagType);
> if(counter > 0)
> spec.setDirection(ElementSpec.JoinNextDirection);
> @@ -1008,7 +1008,7 @@
> if (listenerList.getListenerCount(DocumentListener.class) == 0) {
> for (int counter = listeningStyles.size() - 1; counter >= 0;
> counter--) {
> - ((Style)listeningStyles.elementAt(counter)).
> + listeningStyles.elementAt(counter).
> removeChangeListener(styleChangeListener);
> }
> listeningStyles.removeAllElements();
> @@ -1078,7 +1078,7 @@
>
> private void readObject(ObjectInputStream s)
> throws ClassNotFoundException, IOException {
> - listeningStyles = new Vector();
> + listeningStyles = new Vector<Style>();
> s.defaultReadObject();
> // Reinstall style listeners.
> if (styleContextChangeListener == null &&
> @@ -1102,7 +1102,7 @@
> protected ElementBuffer buffer;
>
> /** Styles listening to. */
> - private transient Vector listeningStyles;
> + private transient Vector<Style> listeningStyles;
>
> /** Listens to Styles. */
> private transient ChangeListener styleChangeListener;
> @@ -1402,8 +1402,8 @@
> */
> public ElementBuffer(Element root) {
> this.root = root;
> - changes = new Vector();
> - path = new Stack();
> + changes = new Vector<ElemChanges>();
> + path = new Stack<ElemChanges>();
> }
>
> /**
> @@ -1455,7 +1455,7 @@
> elem = child;
> index = elem.getElementIndex(0);
> }
> - ElemChanges ec = (ElemChanges) path.peek();
> + ElemChanges ec = path.peek();
> Element child = ec.parent.getElement(ec.index);
> ec.added.addElement(createLeafElement(ec.parent,
> child.getAttributes(), getLength(),
> @@ -1647,7 +1647,7 @@
> index = e.getElementIndex(offs);
> }
>
> - ElemChanges ec = (ElemChanges) path.peek();
> + ElemChanges ec = path.peek();
> Element child = ec.parent.getElement(ec.index);
> // make sure there is something to do... if the
> // offset is already at a boundary then there is
> @@ -1723,7 +1723,7 @@
> void endEdits(DefaultDocumentEvent de) {
> int n = changes.size();
> for (int i = 0; i < n; i++) {
> - ElemChanges ec = (ElemChanges) changes.elementAt(i);
> + ElemChanges ec = changes.elementAt(i);
> Element[] removed = new Element[ec.removed.size()];
> ec.removed.copyInto(removed);
> Element[] added = new Element[ec.added.size()];
> @@ -1768,12 +1768,12 @@
> this.endOffset = offset + length;
> pos = offset;
> if (changes == null) {
> - changes = new Vector();
> + changes = new Vector<ElemChanges>();
> } else {
> changes.removeAllElements();
> }
> if (path == null) {
> - path = new Stack();
> + path = new Stack<ElemChanges>();
> } else {
> path.removeAllElements();
> }
> @@ -1800,7 +1800,7 @@
> }
>
> void pop() {
> - ElemChanges ec = (ElemChanges) path.peek();
> + ElemChanges ec = path.peek();
> path.pop();
> if ((ec.added.size() > 0) || (ec.removed.size() > 0)) {
> changes.addElement(ec);
> @@ -1809,7 +1809,7 @@
> if(e.getElementCount() == 0) {
> // if we pushed a branch element that didn't get
> // used, make sure its not marked as having been added.
> - ec = (ElemChanges) path.peek();
> + ec = path.peek();
> ec.added.removeElement(e);
> }
> }
> @@ -1823,7 +1823,7 @@
> }
>
> void insertElement(ElementSpec es) {
> - ElemChanges ec = (ElemChanges) path.peek();
> + ElemChanges ec = path.peek();
> switch(es.getType()) {
> case ElementSpec.StartTagType:
> switch(es.getDirection()) {
> @@ -1931,7 +1931,7 @@
> int index0 = elem.getElementIndex(rmOffs0);
> int index1 = elem.getElementIndex(rmOffs1);
> push(elem, index0);
> - ElemChanges ec = (ElemChanges)path.peek();
> + ElemChanges ec = path.peek();
>
> // if the range is contained by one element,
> // we just forward the request
> @@ -2069,7 +2069,7 @@
> if (rj.getStartOffset() == rmOffs1) {
> rj = null;
> }
> - Vector children = new Vector();
> + Vector<Element> children = new Vector<Element>();
>
> // transfer the left
> for (int i = 0; i < ljIndex; i++) {
> @@ -2143,7 +2143,7 @@
> }
> Element e = createBranchElement(parent, clonee.getAttributes());
> int n = clonee.getElementCount();
> - ArrayList childrenList = new ArrayList(n);
> + ArrayList<Element> childrenList = new ArrayList<Element>(n);
> for (int i = 0; i < n; i++) {
> Element elem = clonee.getElement(i);
> if (elem.getStartOffset() < rmOffs0 || elem.getEndOffset() > rmOffs1) {
> @@ -2151,7 +2151,7 @@
> }
> }
> Element[] children = new Element[childrenList.size()];
> - children = (Element[])childrenList.toArray(children);
> + children = childrenList.toArray(children);
> ((BranchElement)e).replace(0, 0, children);
> return e;
> }
> @@ -2356,7 +2356,7 @@
> */
> void fractureDeepestLeaf(ElementSpec[] specs) {
> // Split the bottommost leaf. It will be recreated elsewhere.
> - ElemChanges ec = (ElemChanges) path.peek();
> + ElemChanges ec = path.peek();
> Element child = ec.parent.getElement(ec.index);
> // Inserts at offset 0 do not need to recreate child (it would
> // have a length of 0!).
> @@ -2381,7 +2381,7 @@
> */
> void insertFirstContent(ElementSpec[] specs) {
> ElementSpec firstSpec = specs[0];
> - ElemChanges ec = (ElemChanges) path.peek();
> + ElemChanges ec = path.peek();
> Element child = ec.parent.getElement(ec.index);
> int firstEndOffset = offset + firstSpec.getLength();
> boolean isOnlyContent = (specs.length == 1);
> @@ -2464,8 +2464,8 @@
> transient int offset;
> transient int length;
> transient int endOffset;
> - transient Vector changes; // Vector<ElemChanges>
> - transient Stack path; // Stack<ElemChanges>
> + transient Vector<ElemChanges> changes; // Vector<ElemChanges>
> + transient Stack<ElemChanges> path; // Stack<ElemChanges>
> transient boolean insertOp;
>
> transient boolean recreateLeafs; // For insert.
> @@ -2495,8 +2495,8 @@
> this.parent = parent;
> this.index = index;
> this.isFracture = isFracture;
> - added = new Vector();
> - removed = new Vector();
> + added = new Vector<Element>();
> + removed = new Vector<Element>();
> }
>
> public String toString() {
> @@ -2505,8 +2505,8 @@
>
> Element parent;
> int index;
> - Vector added;
> - Vector removed;
> + Vector<Element> added;
> + Vector<Element> removed;
> boolean isFracture;
> }
>
> @@ -2612,7 +2612,7 @@
> /* This has an implicit reference to the handler object. */
> private class DocReference extends WeakReference<DefaultStyledDocument> {
>
> - DocReference(DefaultStyledDocument d, ReferenceQueue q) {
> + DocReference(DefaultStyledDocument d, ReferenceQueue<DefaultStyledDocument> q) {
> super(d, q);
> }
>
> @@ -2625,19 +2625,19 @@
> }
>
> /** Class-specific reference queues. */
> - private final static Map<Class, ReferenceQueue> queueMap
> - = new HashMap<Class, ReferenceQueue>();
> + private final static Map<Class, ReferenceQueue<DefaultStyledDocument>> queueMap
> + = new HashMap<Class, ReferenceQueue<DefaultStyledDocument>>();
>
> /** A weak reference to the document object. */
> private DocReference doc;
>
> AbstractChangeHandler(DefaultStyledDocument d) {
> Class c = getClass();
> - ReferenceQueue q;
> + ReferenceQueue<DefaultStyledDocument> q;
> synchronized (queueMap) {
> q = queueMap.get(c);
> if (q == null) {
> - q = new ReferenceQueue();
> + q = new ReferenceQueue<DefaultStyledDocument>();
> queueMap.put(c, q);
> }
> }
> @@ -2745,3 +2745,4 @@
>
>
>
> +
> Index: classes/javax/swing/text/ElementIterator.java
> ===================================================================
> --- classes/javax/swing/text/ElementIterator.java (revision 250)
> +++ classes/javax/swing/text/ElementIterator.java (working copy)
> @@ -65,6 +65,7 @@
> * }
> *
> * @author Sunita Mani
> + * @author Florian Brunner
> * @version 1.21 05/05/07
> *
> */
> @@ -73,7 +74,7 @@
>
>
> private Element root;
> - private Stack elementStack = null;
> + private Stack<StackItem> elementStack = null;
>
> /**
> * The StackItem class stores the element
> @@ -149,9 +150,9 @@
> try {
> ElementIterator it = new ElementIterator(root);
> if (elementStack != null) {
> - it.elementStack = new Stack();
> + it.elementStack = new Stack<StackItem>();
> for (int i = 0; i < elementStack.size(); i++) {
> - StackItem item = (StackItem)elementStack.elementAt(i);
> + StackItem item = elementStack.elementAt(i);
> StackItem clonee = (StackItem)item.clone();
> it.elementStack.push(clonee);
> }
> @@ -174,7 +175,7 @@
> return null;
> }
>
> - elementStack = new Stack();
> + elementStack = new Stack<StackItem>();
> if (root.getElementCount() != 0) {
> elementStack.push(new StackItem(root));
> }
> @@ -210,7 +211,7 @@
> get a handle to the element on top of the stack.
> */
> if (! elementStack.empty()) {
> - StackItem item = (StackItem)elementStack.peek();
> + StackItem item = elementStack.peek();
> Element elem = item.getElement();
> int index = item.getIndex();
> // self reference
> @@ -248,7 +249,7 @@
>
> // get a handle to the element on top of the stack
>
> - StackItem item = (StackItem)elementStack.peek();
> + StackItem item = elementStack.peek();
> Element elem = item.getElement();
> int index = item.getIndex();
>
> @@ -273,7 +274,7 @@
> if (!elementStack.isEmpty()) {
> /* Increment the child index for the item that
> is now on top of the stack. */
> - StackItem top = (StackItem)elementStack.peek();
> + StackItem top = elementStack.peek();
> top.incrementIndex();
> /* We now want to return its next child, therefore
> call next() recursively. */
> @@ -301,7 +302,7 @@
>
> // get a handle to the element on top of the stack
> //
> - StackItem item = (StackItem)elementStack.peek();
> + StackItem item = elementStack.peek();
> Element elem = item.getElement();
> int index = item.getIndex();
>
> @@ -321,8 +322,8 @@
> /* We need to return either the item
> below the top item or one of the
> former's children. */
> - Object top = elementStack.pop();
> - item = (StackItem)elementStack.peek();
> + StackItem top = elementStack.pop();
> + item = elementStack.peek();
>
> // restore the top item.
> elementStack.push(top);
> Index: classes/javax/swing/text/FlowView.java
> ===================================================================
> --- classes/javax/swing/text/FlowView.java (revision 250)
> +++ classes/javax/swing/text/FlowView.java (working copy)
> @@ -46,6 +46,7 @@
> * </ul>
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.60 05/05/07
> * @see View
> * @since 1.3
> @@ -185,9 +186,9 @@
> final int faxis = getFlowAxis();
> int newSpan;
> if (faxis == X_AXIS) {
> - newSpan = (int)width;
> + newSpan = width;
> } else {
> - newSpan = (int)height;
> + newSpan = height;
> }
> if (layoutSpan != newSpan) {
> layoutChanged(faxis);
> @@ -198,7 +199,7 @@
> // repair the flow if necessary
> if (! isLayoutValid(faxis)) {
> final int heightAxis = getAxis();
> - int oldFlowHeight = (int)((heightAxis == X_AXIS)? getWidth() : getHeight());
> + int oldFlowHeight = (heightAxis == X_AXIS)? getWidth() : getHeight();
> strategy.layout(this);
> int newFlowHeight = (int) getPreferredSpan(heightAxis);
> if (oldFlowHeight != newFlowHeight) {
> Index: classes/javax/swing/text/GapContent.java
> ===================================================================
> --- classes/javax/swing/text/GapContent.java (revision 250)
> +++ classes/javax/swing/text/GapContent.java (working copy)
> @@ -57,6 +57,7 @@
> * mark, and decreases the cost of keeping the mark updated.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.21 12/03/01
> */
> public class GapContent extends GapVector implements AbstractDocument.Content, Serializable {
> @@ -84,7 +85,7 @@
>
> marks = new MarkVector();
> search = new MarkData(0);
> - queue = new ReferenceQueue();
> + queue = new ReferenceQueue<StickyPosition>();
> }
>
> /**
> @@ -263,13 +264,13 @@
> * it. The update table holds only a reference
> * to this data.
> */
> - final class MarkData extends WeakReference {
> + final class MarkData extends WeakReference<StickyPosition> {
>
> MarkData(int index) {
> super(null);
> this.index = index;
> }
> - MarkData(int index, StickyPosition position, ReferenceQueue queue) {
> + MarkData(int index, StickyPosition position, ReferenceQueue<? super StickyPosition> queue) {
> super(position, queue);
> this.index = index;
> }
> @@ -288,7 +289,7 @@
> }
>
> StickyPosition getPosition() {
> - return (StickyPosition)get();
> + return get();
> }
> int index;
> }
> @@ -330,7 +331,7 @@
> */
> private transient int unusedMarks = 0;
>
> - private transient ReferenceQueue queue;
> + private transient ReferenceQueue<StickyPosition> queue;
>
> final static int GROWTH_SIZE = 1024 * 512;
>
> @@ -692,7 +693,7 @@
> s.defaultReadObject();
> marks = new MarkVector();
> search = new MarkData(0);
> - queue = new ReferenceQueue();
> + queue = new ReferenceQueue<StickyPosition>();
> }
>
>
> @@ -738,7 +739,7 @@
> endIndex = findMarkAdjustIndex(endOffset + (g1 - g0) + 1);
> }
>
> - Vector placeIn = (v == null) ? new Vector(Math.max(1, endIndex -
> + Vector<UndoPosRef> placeIn = (v == null) ? new Vector<UndoPosRef>(Math.max(1, endIndex -
> startIndex)) : v;
>
> for (int counter = startIndex; counter < endIndex; counter++) {
> @@ -955,3 +956,4 @@
> }
>
>
> +
> Index: classes/javax/swing/text/html/AccessibleHTML.java
> ===================================================================
> --- classes/javax/swing/text/html/AccessibleHTML.java (revision 250)
> +++ classes/javax/swing/text/html/AccessibleHTML.java (working copy)
> @@ -41,6 +41,7 @@
> *
> * @version 1.21 05/05/07
> * @author Lynn Monsanto
> + * @author Florian Brunner
> */
> class AccessibleHTML implements Accessible {
>
> @@ -1967,7 +1968,7 @@
> public int [] getSelectedAccessibleRows() {
> if (validateIfNecessary()) {
> int nRows = getAccessibleRowCount();
> - Vector vec = new Vector();
> + Vector<Integer> vec = new Vector<Integer>();
>
> for (int i = 0; i < nRows; i++) {
> if (isAccessibleRowSelected(i)) {
> @@ -1976,7 +1977,7 @@
> }
> int retval[] = new int[vec.size()];
> for (int i = 0; i < retval.length; i++) {
> - retval[i] = ((Integer)vec.elementAt(i)).intValue();
> + retval[i] = vec.elementAt(i).intValue();
> }
> return retval;
> }
> @@ -1992,7 +1993,7 @@
> public int [] getSelectedAccessibleColumns() {
> if (validateIfNecessary()) {
> int nColumns = getAccessibleRowCount();
> - Vector vec = new Vector();
> + Vector<Integer> vec = new Vector<Integer>();
>
> for (int i = 0; i < nColumns; i++) {
> if (isAccessibleColumnSelected(i)) {
> @@ -2001,7 +2002,7 @@
> }
> int retval[] = new int[vec.size()];
> for (int i = 0; i < retval.length; i++) {
> - retval[i] = ((Integer)vec.elementAt(i)).intValue();
> + retval[i] = vec.elementAt(i).intValue();
> }
> return retval;
> }
> @@ -2135,15 +2136,15 @@
> // Header information is modeled as a Hashtable of
> // ArrayLists where each Hashtable entry represents
> // a row containing one or more headers.
> - private Hashtable headers = new Hashtable();
> + private Hashtable<Integer, java.util.List<TableCellElementInfo>> headers = new Hashtable<Integer, java.util.List<TableCellElementInfo>>();
> private int rowCount = 0;
> private int columnCount = 0;
>
> public void addHeader(TableCellElementInfo cellInfo, int rowNumber) {
> Integer rowInteger = new Integer(rowNumber);
> - ArrayList list = (ArrayList)headers.get(rowInteger);
> + java.util.List<TableCellElementInfo> list = headers.get(rowInteger);
> if (list == null) {
> - list = new ArrayList();
> + list = new ArrayList<TableCellElementInfo>();
> headers.put(rowInteger, list);
> }
> list.add(cellInfo);
> @@ -2644,7 +2645,7 @@
> /**
> * The children of this ElementInfo.
> */
> - private ArrayList children;
> + private ArrayList<ElementInfo> children;
> /**
> * The Element this ElementInfo is providing information for.
> */
> @@ -2778,7 +2779,7 @@
> */
> protected void addChild(ElementInfo child) {
> if (children == null) {
> - children = new ArrayList();
> + children = new ArrayList<ElementInfo>();
> }
> children.add(child);
> }
> @@ -2929,7 +2930,7 @@
> canBeValid = first;
> if (children != null) {
> for (int counter = 0; counter < children.size(); counter++) {
> - ((ElementInfo)children.get(counter)).invalidate(false);
> + children.get(counter).invalidate(false);
> }
> children = null;
> }
> Index: classes/javax/swing/text/html/CSS.java
> ===================================================================
> --- classes/javax/swing/text/html/CSS.java (revision 250)
> +++ classes/javax/swing/text/html/CSS.java (working copy)
> @@ -111,6 +111,7 @@
> *
> * @author Timothy Prinzing
> * @author Scott Violet
> + * @author Florian Brunner
> * @version 1.74 05/05/07
> * @see StyleSheet
> */
> @@ -435,16 +436,16 @@
> public CSS() {
> baseFontSize = baseFontSizeIndex + 1;
> // setup the css conversion table
> - valueConvertor = new Hashtable();
> + valueConvertor = new Hashtable<Object, Object>();
> valueConvertor.put(CSS.Attribute.FONT_SIZE, new FontSize());
> valueConvertor.put(CSS.Attribute.FONT_FAMILY, new FontFamily());
> valueConvertor.put(CSS.Attribute.FONT_WEIGHT, new FontWeight());
> valueConvertor.put(CSS.Attribute.BORDER_STYLE, new BorderStyle());
> - Object cv = new ColorValue();
> + CssValue cv = new ColorValue();
> valueConvertor.put(CSS.Attribute.COLOR, cv);
> valueConvertor.put(CSS.Attribute.BACKGROUND_COLOR, cv);
> valueConvertor.put(CSS.Attribute.BORDER_COLOR, cv);
> - Object lv = new LengthValue();
> + CssValue lv = new LengthValue();
> valueConvertor.put(CSS.Attribute.MARGIN_TOP, lv);
> valueConvertor.put(CSS.Attribute.MARGIN_BOTTOM, lv);
> valueConvertor.put(CSS.Attribute.MARGIN_LEFT, lv);
> @@ -457,23 +458,23 @@
> valueConvertor.put(CSS.Attribute.PADDING_BOTTOM, lv);
> valueConvertor.put(CSS.Attribute.PADDING_LEFT, lv);
> valueConvertor.put(CSS.Attribute.PADDING_RIGHT, lv);
> - Object bv = new BorderWidthValue(null, 0);
> + CssValue bv = new BorderWidthValue(null, 0);
> valueConvertor.put(CSS.Attribute.BORDER_WIDTH, lv);
> valueConvertor.put(CSS.Attribute.BORDER_TOP_WIDTH, bv);
> valueConvertor.put(CSS.Attribute.BORDER_BOTTOM_WIDTH, bv);
> valueConvertor.put(CSS.Attribute.BORDER_LEFT_WIDTH, bv);
> valueConvertor.put(CSS.Attribute.BORDER_RIGHT_WIDTH, bv);
> - Object nlv = new LengthValue(true);
> + CssValue nlv = new LengthValue(true);
> valueConvertor.put(CSS.Attribute.TEXT_INDENT, nlv);
> valueConvertor.put(CSS.Attribute.WIDTH, lv);
> valueConvertor.put(CSS.Attribute.HEIGHT, lv);
> valueConvertor.put(CSS.Attribute.BORDER_SPACING, lv);
> - Object sv = new StringValue();
> + CssValue sv = new StringValue();
> valueConvertor.put(CSS.Attribute.FONT_STYLE, sv);
> valueConvertor.put(CSS.Attribute.TEXT_DECORATION, sv);
> valueConvertor.put(CSS.Attribute.TEXT_ALIGN, sv);
> valueConvertor.put(CSS.Attribute.VERTICAL_ALIGN, sv);
> - Object valueMapper = new CssValueMapper();
> + CssValue valueMapper = new CssValueMapper();
> valueConvertor.put(CSS.Attribute.LIST_STYLE_TYPE,
> valueMapper);
> valueConvertor.put(CSS.Attribute.BACKGROUND_IMAGE,
> @@ -484,7 +485,7 @@
> valueMapper);
> valueConvertor.put(CSS.Attribute.BACKGROUND_ATTACHMENT,
> valueMapper);
> - Object generic = new CssValue();
> + CssValue generic = new CssValue();
> int n = CSS.Attribute.allAttributes.length;
> for (int i = 0; i < n; i++) {
> CSS.Attribute key = CSS.Attribute.allAttributes[i];
> @@ -583,7 +584,7 @@
> * Maps from a StyleConstants to a CSS Attribute.
> */
> Attribute styleConstantsKeyToCSSKey(StyleConstants sc) {
> - return (Attribute)styleConstantToCssMap.get(sc);
> + return styleConstantToCssMap.get(sc);
> }
>
> /**
> @@ -605,8 +606,7 @@
> */
> Object cssValueToStyleConstantsValue(StyleConstants key, Object value) {
> if (value instanceof CssValue) {
> - return ((CssValue)value).toStyleConstants((StyleConstants)key,
> - null);
> + return ((CssValue)value).toStyleConstants(key, null);
> }
> return null;
> }
> @@ -778,8 +778,8 @@
> return cssAttrSet;
> }
>
> - private static final Hashtable attributeMap = new Hashtable();
> - private static final Hashtable valueMap = new Hashtable();
> + private static final Hashtable<String, Attribute> attributeMap = new Hashtable<String, Attribute>();
> + private static final Hashtable<String, Value> valueMap = new Hashtable<String, Value>();
>
> /**
> * The hashtable and the static initalization block below,
> @@ -791,18 +791,18 @@
> * Therefore, the value associated with each HTML.Attribute.
> * key ends up being an array of CSS.Attribute.* objects.
> */
> - private static final Hashtable htmlAttrToCssAttrMap = new Hashtable(20);
> + private static final Hashtable<HTML.Attribute, CSS.Attribute[]> htmlAttrToCssAttrMap = new Hashtable<HTML.Attribute, CSS.Attribute[]>(20);
>
> /**
> * The hashtable and static initialization that follows sets
> * up a translation from StyleConstants (i.e. the <em>well known</em>
> * attributes) to the associated CSS attributes.
> */
> - private static final Hashtable styleConstantToCssMap = new Hashtable(17);
> + private static final Hashtable<Object, Attribute> styleConstantToCssMap = new Hashtable<Object, Attribute>(17);
> /** Maps from HTML value to a CSS value. Used in internal mapping. */
> - private static final Hashtable htmlValueToCssValueMap = new Hashtable(8);
> + private static final Hashtable<String, Value> htmlValueToCssValueMap = new Hashtable<String, Value>(8);
> /** Maps from CSS value (string) to internal value. */
> - private static final Hashtable cssValueToInternalValueMap = new Hashtable(13);
> + private static final Hashtable<String, Value> cssValueToInternalValueMap = new Hashtable<String, Value>(13);
>
> static {
> // load the attribute map
> @@ -971,7 +971,7 @@
> * doesn't represent a valid attribute key
> */
> public static final Attribute getAttribute(String name) {
> - return (Attribute) attributeMap.get(name);
> + return attributeMap.get(name);
> }
>
> /**
> @@ -987,7 +987,7 @@
> * not mean that it doesn't represent a valid CSS value
> */
> static final Value getValue(String name) {
> - return (Value) valueMap.get(name);
> + return valueMap.get(name);
> }
>
>
> @@ -1231,7 +1231,7 @@
> static String[] parseStrings(String value) {
> int current, last;
> int length = (value == null) ? 0 : value.length();
> - Vector temp = new Vector(4);
> + Vector<String> temp = new Vector<String>(4);
>
> current = 0;
> while (current < length) {
> @@ -1384,7 +1384,7 @@
> * @return CSS.Attribute[]
> */
> private CSS.Attribute[] getCssAttribute(HTML.Attribute hAttr) {
> - return (CSS.Attribute[])htmlAttrToCssAttrMap.get(hAttr);
> + return htmlAttrToCssAttrMap.get(hAttr);
> }
>
> /**
> @@ -2531,8 +2531,8 @@
> * to an AttributeSet or returned to the developer.
> */
> static class LengthUnit implements Serializable {
> - static Hashtable lengthMapping = new Hashtable(6);
> - static Hashtable w3cLengthMapping = new Hashtable(6);
> + static Hashtable<String, Float> lengthMapping = new Hashtable<String, Float>(6);
> + static Hashtable<String, Float> w3cLengthMapping = new Hashtable<String, Float>(6);
> static {
> lengthMapping.put("pt", new Float(1f));
> // Not sure about 1.3, determined by experiementation.
> @@ -2574,7 +2574,7 @@
> }
> if (length >= 2) {
> units = value.substring(length - 2, length);
> - Float scale = (Float)lengthMapping.get(units);
> + Float scale = lengthMapping.get(units);
> if (scale != null) {
> try {
> this.value = Float.valueOf(value.substring(0,
> @@ -3216,7 +3216,7 @@
> s.defaultReadObject();
> // Reconstruct the hashtable.
> int numValues = s.readInt();
> - valueConvertor = new Hashtable(Math.max(1, numValues));
> + valueConvertor = new Hashtable<Object, Object>(Math.max(1, numValues));
> while (numValues-- > 0) {
> Object key = s.readObject();
> Object value = s.readObject();
> @@ -3257,7 +3257,7 @@
> //
>
> /** Maps from CSS key to CssValue. */
> - private transient Hashtable valueConvertor;
> + private transient Hashtable<Object, Object> valueConvertor;
>
> /** Size used for relative units. */
> private int baseFontSize;
> Index: classes/javax/swing/text/html/HTML.java
> ===================================================================
> --- classes/javax/swing/text/html/HTML.java (revision 250)
> +++ classes/javax/swing/text/html/HTML.java (working copy)
> @@ -36,6 +36,7 @@
> *
> * @author Timothy Prinzing
> * @author Sunita Mani
> + * @author Florian Brunner
> *
> * @version 1.49 05/05/07
> */
> @@ -537,10 +538,10 @@
> // that the hashtable grew to was determined, and then that very size
> // is used.
> //
> - private static final Hashtable tagHashtable = new Hashtable(73);
> + private static final Hashtable<String, Tag> tagHashtable = new Hashtable<String, Tag>(73);
>
> /** Maps from StyleConstant key to HTML.Tag. */
> - private static final Hashtable scMapping = new Hashtable(8);
> + private static final Hashtable<Object, Tag> scMapping = new Hashtable<Object, Tag>(8);
>
> static {
>
> @@ -614,7 +615,7 @@
> * <code>null</code> if not found
> */
> static Tag getTagForStyleConstantsKey(StyleConstants sc) {
> - return (Tag)scMapping.get(sc);
> + return scMapping.get(sc);
> }
>
> /**
> @@ -647,7 +648,7 @@
> public static final String NULL_ATTRIBUTE_VALUE = "#DEFAULT";
>
> // size determined similar to size of tagHashtable
> - private static final Hashtable attHashtable = new Hashtable(77);
> + private static final Hashtable<String, Attribute> attHashtable = new Hashtable<String, Attribute>(77);
>
> static {
>
> Index: classes/javax/swing/text/html/HTMLDocument.java
> ===================================================================
> --- classes/javax/swing/text/html/HTMLDocument.java (revision 250)
> +++ classes/javax/swing/text/html/HTMLDocument.java (working copy)
> @@ -272,6 +272,7 @@
> * @author Timothy Prinzing
> * @author Scott Violet
> * @author Sunita Mani
> + * @author Florian Brunner
> * @version 1.187 05/05/07
> */
> public class HTMLDocument extends DefaultStyledDocument {
> @@ -869,7 +870,7 @@
> putProperty(MAP_PROPERTY, maps);
> }
> if (maps instanceof Hashtable) {
> - ((Hashtable)maps).put("#" + name, map);
> + ((Hashtable<String, Map>)maps).put("#" + name, map);
> }
> }
> }
> @@ -1760,7 +1761,7 @@
> * Used to store button groups for radio buttons in
> * a form.
> */
> - private HashMap radioButtonGroupsMap;
> + private HashMap<String, ButtonGroup> radioButtonGroupsMap;
>
> /**
> * Document property for the number of tokens to buffer
> @@ -1916,7 +1917,7 @@
> AttributeSet a = (AttributeSet)
> elem.getAttributes().getAttribute(tag);
> if (a == null) {
> - a = (AttributeSet)elem.getAttributes();
> + a = elem.getAttributes();
> }
> return a;
> }
> @@ -2194,7 +2195,7 @@
> isStyleCSS = "text/css".equals(getDefaultStyleSheetType());
> this.offset = offset;
> threshold = HTMLDocument.this.getTokenThreshold();
> - tagMap = new Hashtable(57);
> + tagMap = new Hashtable<HTML.Tag, TagAction>(57);
> TagAction na = new TagAction();
> TagAction ba = new BlockAction();
> TagAction pa = new ParagraphAction();
> @@ -2497,7 +2498,7 @@
> }
>
> private Element[] getPathTo(int offset) {
> - Stack elements = new Stack();
> + Stack<Element> elements = new Stack<Element>();
> Element e = getDefaultRootElement();
> int index;
> while (!e.isLeaf()) {
> @@ -2611,7 +2612,7 @@
> else {
> styleAttributes = null;
> }
> - TagAction action = (TagAction) tagMap.get(t);
> + TagAction action = tagMap.get(t);
>
> if (action != null) {
> action.start(t, a);
> @@ -2641,7 +2642,7 @@
> addSpecialElement(HTML.Tag.COMMENT, sas);
> }
>
> - TagAction action = (TagAction)tagMap.get(HTML.Tag.COMMENT);
> + TagAction action = tagMap.get(HTML.Tag.COMMENT);
> if (action != null) {
> action.start(HTML.Tag.COMMENT, new SimpleAttributeSet());
> action.end(HTML.Tag.COMMENT);
> @@ -2662,7 +2663,7 @@
> comments = new Vector();
> putProperty(AdditionalComments, comments);
> }
> - ((Vector)comments).addElement(comment);
> + ((Vector<String>)comments).addElement(comment);
> }
>
> /**
> @@ -2682,7 +2683,7 @@
> inBlock--;
> }
> }
> - TagAction action = (TagAction) tagMap.get(t);
> + TagAction action = tagMap.get(t);
> if (action != null) {
> action.end(t);
> }
> @@ -2708,7 +2709,7 @@
> styleAttributes = null;
> }
>
> - TagAction action = (TagAction) tagMap.get(t);
> + TagAction action = tagMap.get(t);
> if (action != null) {
> action.start(t, a);
> action.end(t);
> @@ -2803,7 +2804,7 @@
> // might be defined in the FORM.
> // for new group new ButtonGroup will be created (fix for 4529702)
> // group name is a key in radioButtonGroupsMap
> - radioButtonGroupsMap = new HashMap();
> + radioButtonGroupsMap = new HashMap<String, ButtonGroup>();
> }
>
> public void end(HTML.Tag t) {
> @@ -3016,7 +3017,7 @@
> if (rel.equals("stylesheet") ||
> rel.equals("alternate stylesheet")) {
> if (styles == null) {
> - styles = new Vector(3);
> + styles = new Vector<Object>(3);
> }
> styles.addElement(t);
> styles.addElement(a.copyAttributes());
> @@ -3056,7 +3057,7 @@
> public void start(HTML.Tag t, MutableAttributeSet a) {
> if (inHead) {
> if (styles == null) {
> - styles = new Vector(3);
> + styles = new Vector<Object>(3);
> }
> styles.addElement(t);
> styles.addElement(a.getAttribute(HTML.Attribute.TYPE));
> @@ -3281,7 +3282,7 @@
> String name = (String) a.getAttribute(HTML.Attribute.NAME);
> String value = (String) a.getAttribute(HTML.Attribute.VALUE);
> if ((name != null) && (value != null)) {
> - ElementSpec objSpec = (ElementSpec) parseBuffer.lastElement();
> + ElementSpec objSpec = parseBuffer.lastElement();
> MutableAttributeSet objAttr = (MutableAttributeSet) objSpec.getAttributes();
> objAttr.addAttribute(name, value);
> }
> @@ -3461,9 +3462,9 @@
> if (type.equals("radio")) {
> String name = (String) attr.getAttribute(HTML.Attribute.NAME);
> if ( radioButtonGroupsMap == null ) { //fix for 4772743
> - radioButtonGroupsMap = new HashMap();
> + radioButtonGroupsMap = new HashMap<String, ButtonGroup>();
> }
> - ButtonGroup radioButtonGroup = (ButtonGroup)radioButtonGroupsMap.get(name);
> + ButtonGroup radioButtonGroup = radioButtonGroupsMap.get(name);
> if (radioButtonGroup == null) {
> radioButtonGroup = new ButtonGroup();
> radioButtonGroupsMap.put(name,radioButtonGroup);
> @@ -3605,7 +3606,7 @@
> // an open/close with no content will be removed, so we
> // add a space of content to keep the element being formed.
> ElementSpec prev = (parseBuffer.size() > 0) ?
> - (ElementSpec) parseBuffer.lastElement() : null;
> + parseBuffer.lastElement() : null;
> if (prev != null && prev.getType() == ElementSpec.StartTagType) {
> char[] one = new char[1];
> one[0] = ' ';
> @@ -3738,7 +3739,7 @@
> // This attemps to clean it up.
> int removeCounter = insertTagDepthDelta;
> while (removeCounter < 0 && size >= 0 &&
> - ((ElementSpec)parseBuffer.elementAt(size - 1)).
> + parseBuffer.elementAt(size - 1).
> getType() == ElementSpec.EndTagType) {
> parseBuffer.removeElementAt(--size);
> removeCounter++;
> @@ -3752,7 +3753,7 @@
> // an extra \n in the middle of content.
> int index = 0;
> if (pushDepth > 0) {
> - if (((ElementSpec)parseBuffer.elementAt(0)).getType() ==
> + if (parseBuffer.elementAt(0).getType() ==
> ElementSpec.ContentType) {
> index++;
> }
> @@ -3760,19 +3761,19 @@
> index += (popDepth + pushDepth);
> int cCount = 0;
> int cStart = index;
> - while (index < size && ((ElementSpec)parseBuffer.elementAt
> - (index)).getType() == ElementSpec.ContentType) {
> + while (index < size && parseBuffer.elementAt
> + (index).getType() == ElementSpec.ContentType) {
> index++;
> cCount++;
> }
> if (cCount > 1) {
> - while (index < size && ((ElementSpec)parseBuffer.elementAt
> - (index)).getType() == ElementSpec.EndTagType) {
> + while (index < size && parseBuffer.elementAt
> + (index).getType() == ElementSpec.EndTagType) {
> index++;
> }
> if (index == size) {
> - char[] lastText = ((ElementSpec)parseBuffer.elementAt
> - (cStart + cCount - 1)).getArray();
> + char[] lastText = parseBuffer.elementAt
> + (cStart + cCount - 1).getArray();
> if (lastText.length == 1 && lastText[0] == NEWLINE[0]){
> index = cStart + cCount - 1;
> while (size > index) {
> @@ -3786,8 +3787,7 @@
> // Make sure there is in fact a newline
> for (int counter = parseBuffer.size() - 1; counter >= 0;
> counter--) {
> - ElementSpec spec = (ElementSpec)parseBuffer.
> - elementAt(counter);
> + ElementSpec spec = parseBuffer.elementAt(counter);
> if (spec.getType() == ElementSpec.ContentType) {
> if (spec.getArray()[spec.getLength() - 1] != '\n') {
> SimpleAttributeSet attrs =new SimpleAttributeSet();
> @@ -4032,7 +4032,7 @@
> * indicating the type (may be null), and the elements following
> * it until the next HTML.Tag are the rules as Strings.
> */
> - Vector styles;
> + Vector<Object> styles;
> /** True if inside the head tag. */
> boolean inHead = false;
> /** Set to true if the style language is text/css. Since this is
> @@ -4049,10 +4049,10 @@
> */
> Option option;
>
> - protected Vector<ElementSpec> parseBuffer = new Vector(); // Vector<ElementSpec>
> + protected Vector<ElementSpec> parseBuffer = new Vector<ElementSpec>(); // Vector<ElementSpec>
> protected MutableAttributeSet charAttr = new TaggedAttributeSet();
> - Stack charAttrStack = new Stack();
> - Hashtable tagMap;
> + Stack<AttributeSet> charAttrStack = new Stack<AttributeSet>();
> + Hashtable<HTML.Tag, TagAction> tagMap;
> int inBlock = 0;
>
> /**
> Index: classes/javax/swing/text/html/HTMLEditorKit.java
> ===================================================================
> --- classes/javax/swing/text/html/HTMLEditorKit.java (revision 250)
> +++ classes/javax/swing/text/html/HTMLEditorKit.java (working copy)
> @@ -158,6 +158,7 @@
> * </dl>
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.142 05/05/07
> */
> public class HTMLEditorKit extends StyledEditorKit implements Accessible {
> @@ -1274,7 +1275,7 @@
> }
> if (cachedViewPort == null) {
> viewPort.addComponentListener(this);
> - cachedViewPort = new WeakReference(viewPort);
> + cachedViewPort = new WeakReference<JViewport>(viewPort);
> }
>
> componentVisibleWidth = viewPort.getExtentSize().width;
> Index: classes/javax/swing/text/html/HTMLWriter.java
> ===================================================================
> --- classes/javax/swing/text/html/HTMLWriter.java (revision 250)
> +++ classes/javax/swing/text/html/HTMLWriter.java (working copy)
> @@ -38,6 +38,7 @@
> * This is a writer for HTMLDocuments.
> *
> * @author Sunita Mani
> + * @author Florian Brunner
> * @version 1.26, 02/02/00
> */
>
> @@ -47,7 +48,7 @@
> * Stores all elements for which end tags have to
> * be emitted.
> */
> - private Stack blockElementStack = new Stack();
> + private Stack<Element> blockElementStack = new Stack<Element>();
> private boolean inContent = false;
> private boolean inPre = false;
> /** When inPre is true, this will indicate the end offset of the pre
> @@ -63,12 +64,12 @@
> * character level attributes. Examples include
> * <b>, <i>, <font>, and <a>.
> */
> - private Vector tags = new Vector(10);
> + private Vector<HTML.Tag> tags = new Vector<HTML.Tag>(10);
>
> /**
> * Values for the tags.
> */
> - private Vector tagValues = new Vector(10);
> + private Vector<Object> tagValues = new Vector<Object>(10);
>
> /**
> * Used when writing out content.
> @@ -78,7 +79,7 @@
> /*
> * This is used in closeOutUnwantedEmbeddedTags.
> */
> - private Vector tagsToRemove = new Vector(10);
> + private Vector<HTML.Tag> tagsToRemove = new Vector<HTML.Tag>(10);
>
> /**
> * Set to true after the head has been output.
> @@ -170,7 +171,7 @@
> item on top of the stack, is the parent of the
> next.
> */
> - Element top = (Element)blockElementStack.peek();
> + Element top = blockElementStack.peek();
> while (top != next.getParentElement()) {
> /*
> pop() will return top.
> @@ -184,7 +185,7 @@
> }
> endTag(top);
> }
> - top = (Element)blockElementStack.peek();
> + top = blockElementStack.peek();
> }
> } else if (current.getParentElement() == next.getParentElement()) {
> /*
> @@ -192,7 +193,7 @@
> is correct. But, we need to make sure that if current is
> on the stack, we pop it off, and put out its end tag.
> */
> - Element top = (Element)blockElementStack.peek();
> + Element top = blockElementStack.peek();
> if (top == current) {
> blockElementStack.pop();
> endTag(top);
> @@ -220,7 +221,7 @@
> endTag(current);
> }
> while (!blockElementStack.empty()) {
> - current = (Element)blockElementStack.pop();
> + current = blockElementStack.pop();
> if (!synthesizedElement(current)) {
> AttributeSet attrs = current.getAttributes();
> if (!matchNameAttribute(attrs, HTML.Tag.PRE) &&
> @@ -770,7 +771,7 @@
> int size = tags.size();
> // First, find all the tags that need to be removed.
> for (int i = size - 1; i >= 0; i--) {
> - t = (HTML.Tag)tags.elementAt(i);
> + t = tags.elementAt(i);
> tValue = tagValues.elementAt(i);
> if ((attr == null) || noMatchForTagInAttributes(attr, t, tValue)) {
> firstIndex = i;
> @@ -781,7 +782,7 @@
> // Then close them out.
> boolean removeAll = ((size - firstIndex) == tagsToRemove.size());
> for (int i = size - 1; i >= firstIndex; i--) {
> - t = (HTML.Tag)tags.elementAt(i);
> + t = tags.elementAt(i);
> if (removeAll || tagsToRemove.contains(t)) {
> tags.removeElementAt(i);
> tagValues.removeElementAt(i);
> @@ -795,7 +796,7 @@
> // as we closed them out, but they should remain open.
> size = tags.size();
> for (int i = firstIndex; i < size; i++) {
> - t = (HTML.Tag)tags.elementAt(i);
> + t = tags.elementAt(i);
> write('<');
> write(t.toString());
> Object o = tagValues.elementAt(i);
> Index: classes/javax/swing/text/html/Map.java
> ===================================================================
> --- classes/javax/swing/text/html/Map.java (revision 250)
> +++ classes/javax/swing/text/html/Map.java (working copy)
> @@ -36,16 +36,17 @@
> * you can test if a point falls inside the map via the contains method.
> *
> * @author Scott Violet
> + * @author Florian Brunner
> * @version 1.16 05/05/07
> */
> class Map implements Serializable {
> /** Name of the Map. */
> private String name;
> /** An array of AttributeSets. */
> - private Vector areaAttributes;
> + private Vector<AttributeSet> areaAttributes;
> /** An array of RegionContainments, will slowly grow to match the
> * length of areaAttributes as needed. */
> - private Vector areas;
> + private Vector<RegionContainment> areas;
>
> public Map() {
> }
> @@ -69,7 +70,7 @@
> return;
> }
> if (areaAttributes == null) {
> - areaAttributes = new Vector(2);
> + areaAttributes = new Vector<AttributeSet>(2);
> }
> areaAttributes.addElement(as.copyAttributes());
> }
> @@ -82,8 +83,7 @@
> int numAreas = (areas != null) ? areas.size() : 0;
> for (int counter = areaAttributes.size() - 1; counter >= 0;
> counter--) {
> - if (((AttributeSet)areaAttributes.elementAt(counter)).
> - isEqual(as)){
> + if (areaAttributes.elementAt(counter).isEqual(as)){
> areaAttributes.removeElementAt(counter);
> if (counter < numAreas) {
> areas.removeElementAt(counter);
> @@ -122,17 +122,16 @@
> int numAreas = (areas != null) ? areas.size() : 0;
>
> if (areas == null) {
> - areas = new Vector(numAttributes);
> + areas = new Vector<RegionContainment>(numAttributes);
> }
> for (int counter = 0; counter < numAttributes; counter++) {
> if (counter >= numAreas) {
> areas.addElement(createRegionContainment
> - ((AttributeSet)areaAttributes.elementAt(counter)));
> + (areaAttributes.elementAt(counter)));
> }
> - RegionContainment rc = (RegionContainment)areas.
> - elementAt(counter);
> + RegionContainment rc = areas.elementAt(counter);
> if (rc != null && rc.contains(x, y, width, height)) {
> - return (AttributeSet)areaAttributes.elementAt(counter);
> + return areaAttributes.elementAt(counter);
> }
> }
> }
> Index: classes/javax/swing/text/html/MinimalHTMLWriter.java
> ===================================================================
> --- classes/javax/swing/text/html/MinimalHTMLWriter.java (revision 250)
> +++ classes/javax/swing/text/html/MinimalHTMLWriter.java (working copy)
> @@ -63,6 +63,7 @@
> * </pre>
> *
> * @author Sunita Mani
> + * @author Florian Brunner
> * @version 1.21, 05/05/07
> */
>
> @@ -98,7 +99,7 @@
> * Maps from style name as held by the Document, to the archived
> * style name (style name written out). These may differ.
> */
> - private Hashtable styleNameMapping;
> + private Hashtable<String, String> styleNameMapping;
>
> /**
> * Creates a new MinimalHTMLWriter.
> @@ -135,7 +136,7 @@
> *
> */
> public void write() throws IOException, BadLocationException {
> - styleNameMapping = new Hashtable();
> + styleNameMapping = new Hashtable<String, String>();
> writeStartTag("<html>");
> writeHeader();
> writeBody();
> @@ -716,7 +717,7 @@
> if (styleNameMapping == null) {
> return style;
> }
> - String retValue = (String)styleNameMapping.get(style);
> + String retValue = styleNameMapping.get(style);
> return (retValue == null) ? style : retValue;
> }
>
> Index: classes/javax/swing/text/html/OptionListModel.java
> ===================================================================
> --- classes/javax/swing/text/html/OptionListModel.java (revision 250)
> +++ classes/javax/swing/text/html/OptionListModel.java (working copy)
> @@ -41,8 +41,9 @@
> * It also stores the initial state of the JList, to ensure an
> * accurate reset, if the user requests a reset of the form.
> *
> - @author Sunita Mani
> - @version 1.18 05/05/07
> + * @author Sunita Mani
> + * @author Florian Brunner
> + * @version 1.18 05/05/07
> */
>
> class OptionListModel extends DefaultListModel implements ListSelectionModel, Serializable {
> @@ -109,8 +110,7 @@
> * @since 1.4
> */
> public ListSelectionListener[] getListSelectionListeners() {
> - return (ListSelectionListener[])listenerList.getListeners(
> - ListSelectionListener.class);
> + return listenerList.getListeners(ListSelectionListener.class);
> }
>
> /**
> @@ -572,3 +572,4 @@
> }
>
>
> +
> Index: classes/javax/swing/text/html/parser/AttributeList.java
> ===================================================================
> --- classes/javax/swing/text/html/parser/AttributeList.java (revision 250)
> +++ classes/javax/swing/text/html/parser/AttributeList.java (working copy)
> @@ -42,6 +42,7 @@
> *
> * @see Element
> * @author Arthur Van Hoff
> + * @author Florian Brunner
> * @version 1.18 05/05/07
> *
> */
> @@ -130,7 +131,7 @@
> /**
> * Create a hashtable of attribute types.
> */
> - static Hashtable attributeTypes = new Hashtable();
> + static Hashtable<Object, Object> attributeTypes = new Hashtable<Object, Object>();
>
> static void defineAttributeType(String nm, int val) {
> Integer num = new Integer(val);
> Index: classes/javax/swing/text/html/parser/DTD.java
> ===================================================================
> --- classes/javax/swing/text/html/parser/DTD.java (revision 250)
> +++ classes/javax/swing/text/html/parser/DTD.java (working copy)
> @@ -52,6 +52,7 @@
> * @see ContentModel
> * @see Parser
> * @author Arthur van Hoff
> + * @author Florian Brunner
> * @version 1.30 05/05/07
> */
> public
> @@ -105,7 +106,7 @@
> * <code>name</code> <code>String</code>
> */
> public Entity getEntity(String name) {
> - return (Entity)entityHash.get(name);
> + return entityHash.get(name);
> }
>
> /**
> @@ -114,7 +115,7 @@
> * <code>ch</code> character
> */
> public Entity getEntity(int ch) {
> - return (Entity)entityHash.get(new Integer(ch));
> + return entityHash.get(new Integer(ch));
> }
>
> /**
> @@ -138,7 +139,7 @@
> * <code>name</code>, which may be newly created
> */
> public Element getElement(String name) {
> - Element e = (Element)elementHash.get(name);
> + Element e = elementHash.get(name);
> if (e == null) {
> e = new Element(name, elements.size());
> elements.addElement(e);
> @@ -155,7 +156,7 @@
> * <code>index</code>
> */
> public Element getElement(int index) {
> - return (Element)elements.elementAt(index);
> + return elements.elementAt(index);
> }
>
> /**
> @@ -171,7 +172,7 @@
> * if not found
> */
> public Entity defineEntity(String name, int type, char data[]) {
> - Entity ent = (Entity)entityHash.get(name);
> + Entity ent = entityHash.get(name);
> if (ent == null) {
> ent = new Entity(name, type, data);
> entityHash.put(name, ent);
> @@ -286,9 +287,9 @@
> * @return the new <code>AttributeList</code>
> */
> protected AttributeList defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts) {
> - Vector vals = null;
> + Vector<String> vals = null;
> if (values != null) {
> - vals = new Vector();
> + vals = new Vector<String>();
> for (StringTokenizer s = new StringTokenizer(values, "|") ; s.hasMoreTokens() ;) {
> String str = s.nextToken();
> if (str.length() > 0) {
> @@ -319,7 +320,7 @@
> /**
> * The hashtable of DTDs.
> */
> - static Hashtable dtdHash = new Hashtable();
> + static Hashtable<String, DTD> dtdHash = new Hashtable<String, DTD>();
>
> public static void putDTDHash(String name, DTD dtd) {
> dtdHash.put(name, dtd);
> @@ -335,7 +336,7 @@
> */
> public static DTD getDTD(String name) throws IOException {
> name = name.toLowerCase();
> - DTD dtd = (DTD)dtdHash.get(name);
> + DTD dtd = dtdHash.get(name);
> if (dtd == null)
> dtd = new DTD(name);
>
> @@ -433,10 +434,10 @@
> int modifier = in.readByte();
> short valueId = in.readShort();
> String value = (valueId == -1) ? null : names[valueId];
> - Vector values = null;
> + Vector<String> values = null;
> short numValues = in.readShort();
> if (numValues > 0) {
> - values = new Vector(numValues);
> + values = new Vector<String>(numValues);
> for (int i = 0; i < numValues; i++) {
> values.addElement(names[in.readShort()]);
> }
> Index: classes/javax/swing/text/html/parser/Element.java
> ===================================================================
> --- classes/javax/swing/text/html/parser/Element.java (revision 250)
> +++ classes/javax/swing/text/html/parser/Element.java (working copy)
> @@ -39,6 +39,7 @@
> * @see AttributeList
> * @version 1.16, 05/05/07
> * @author Arthur van Hoff
> + * @author Florian Brunner
> */
> public final
> class Element implements DTDConstants, Serializable {
> @@ -160,7 +161,7 @@
> }
>
>
> - static Hashtable contentTypes = new Hashtable();
> + static Hashtable<String, Integer> contentTypes = new Hashtable<String, Integer>();
>
> static {
> contentTypes.put("CDATA", new Integer(CDATA));
> @@ -170,7 +171,7 @@
> }
>
> public static int name2type(String nm) {
> - Integer val = (Integer)contentTypes.get(nm);
> + Integer val = contentTypes.get(nm);
> return (val != null) ? val.intValue() : 0;
> }
> }
> Index: classes/javax/swing/text/html/parser/Entity.java
> ===================================================================
> --- classes/javax/swing/text/html/parser/Entity.java (revision 250)
> +++ classes/javax/swing/text/html/parser/Entity.java (working copy)
> @@ -40,6 +40,7 @@
> * @see DTD
> * @version 1.17, 05/05/07
> * @author Arthur van Hoff
> + * @author Florian Brunner
> */
> public final
> class Entity implements DTDConstants {
> @@ -108,7 +109,7 @@
> }
>
>
> - static Hashtable entityTypes = new Hashtable();
> + static Hashtable<String, Integer> entityTypes = new Hashtable<String, Integer>();
>
> static {
> entityTypes.put("PUBLIC", new Integer(PUBLIC));
> @@ -134,8 +135,9 @@
> * to "CDATA", if none exists
> */
> public static int name2type(String nm) {
> - Integer i = (Integer)entityTypes.get(nm);
> + Integer i = entityTypes.get(nm);
> return (i == null) ? CDATA : i.intValue();
> }
> }
>
> +
> Index: classes/javax/swing/text/html/parser/Parser.java
> ===================================================================
> --- classes/javax/swing/text/html/parser/Parser.java (revision 250)
> +++ classes/javax/swing/text/html/parser/Parser.java (working copy)
> @@ -77,6 +77,7 @@
> * @version 1.55, 05/21/07
> * @author Arthur van Hoff
> * @author Sunita Mani
> + * @author Florian Brunner
> */
> public
> class Parser implements DTDConstants {
> @@ -650,7 +651,7 @@
>
> if (!strict) {
> ContentModel content = stack.contentModel();
> - Vector elemVec = new Vector();
> + Vector<Element> elemVec = new Vector<Element>();
> if (content != null) {
> content.getElements(elemVec);
> for (Enumeration v = elemVec.elements(); v.hasMoreElements();) {
> Index: classes/javax/swing/text/html/parser/ResourceLoader.java
> ===================================================================
> --- classes/javax/swing/text/html/parser/ResourceLoader.java (revision 250)
> +++ classes/javax/swing/text/html/parser/ResourceLoader.java (working copy)
> @@ -39,22 +39,23 @@
> * is called from ParserDelegator.getResourceAsStream.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.13 05/05/07
> */
> -class ResourceLoader implements java.security.PrivilegedAction {
> +class ResourceLoader implements java.security.PrivilegedAction<InputStream> {
>
> ResourceLoader(String name) {
> this.name = name;
> }
>
> - public Object run() {
> - Object o = ParserDelegator.class.getResourceAsStream(name);
> + public InputStream run() {
> + InputStream o = ParserDelegator.class.getResourceAsStream(name);
> return o;
> }
>
> public static InputStream getResourceAsStream(String name) {
> - java.security.PrivilegedAction a = new ResourceLoader(name);
> - return (InputStream) java.security.AccessController.doPrivileged(a);
> + java.security.PrivilegedAction<InputStream> a = new ResourceLoader(name);
> + return java.security.AccessController.doPrivileged(a);
> }
>
> private String name;
> Index: classes/javax/swing/text/html/parser/TagStack.java
> ===================================================================
> --- classes/javax/swing/text/html/parser/TagStack.java (revision 250)
> +++ classes/javax/swing/text/html/parser/TagStack.java (working copy)
> @@ -43,6 +43,7 @@
> * @see ContentModelState
> * @version 1.17, 05/05/07
> * @author Arthur van Hoff
> + * @author Florian Brunner
> */
> final
> class TagStack implements DTDConstants {
> @@ -130,7 +131,7 @@
> * are part of the inclusions listed in DTD for the element
> * currently on the TagStack.
> */
> - boolean included(Vector elemVec, DTD dtd) {
> + boolean included(Vector<Element> elemVec, DTD dtd) {
>
> for (int i = 0 ; i < inclusions.size(); i++) {
> if (inclusions.get(i)) {
> @@ -221,3 +222,4 @@
> }
>
>
> +
> Index: classes/javax/swing/text/html/ResourceLoader.java
> ===================================================================
> --- classes/javax/swing/text/html/ResourceLoader.java (revision 250)
> +++ classes/javax/swing/text/html/ResourceLoader.java (working copy)
> @@ -39,22 +39,23 @@
> * is called from HTMLEditorKit.getResourceAsStream.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.14 05/05/07
> */
> -class ResourceLoader implements java.security.PrivilegedAction {
> +class ResourceLoader implements java.security.PrivilegedAction<InputStream> {
>
> ResourceLoader(String name) {
> this.name = name;
> }
>
> - public Object run() {
> - Object o = HTMLEditorKit.class.getResourceAsStream(name);
> + public InputStream run() {
> + InputStream o = HTMLEditorKit.class.getResourceAsStream(name);
> return o;
> }
>
> public static InputStream getResourceAsStream(String name) {
> - java.security.PrivilegedAction a = new ResourceLoader(name);
> - return (InputStream) java.security.AccessController.doPrivileged(a);
> + java.security.PrivilegedAction<InputStream> a = new ResourceLoader(name);
> + return java.security.AccessController.doPrivileged(a);
> }
>
> private String name;
> Index: classes/javax/swing/text/html/StyleSheet.java
> ===================================================================
> --- classes/javax/swing/text/html/StyleSheet.java (revision 250)
> +++ classes/javax/swing/text/html/StyleSheet.java (working copy)
> @@ -125,6 +125,7 @@
> * @author Sunita Mani
> * @author Sara Swanson
> * @author Jill Nakata
> + * @author Florian Brunner
> * @version 1.97 05/05/07
> */
> public class StyleSheet extends StyleContext {
> @@ -165,7 +166,7 @@
> public StyleSheet() {
> super();
> selectorMapping = new SelectorMapping(0);
> - resolvedStyles = new Hashtable();
> + resolvedStyles = new Hashtable<String, ResolvedStyle>();
> if (css == null) {
> css = new CSS();
> }
> @@ -191,7 +192,7 @@
>
> try {
> // Build an array of all the parent elements.
> - Vector searchContext = sb.getVector();
> + Vector<Element> searchContext = (Vector<Element>)sb.getVector();
>
> for (Element p = e; p != null; p = p.getParentElement()) {
> searchContext.addElement(p);
> @@ -206,7 +207,7 @@
>
> // >= 1 as the HTML.Tag for the 0th element is passed in.
> for (int counter = n - 1; counter >= 1; counter--) {
> - e = (Element)searchContext.elementAt(counter);
> + e = searchContext.elementAt(counter);
> attr = e.getAttributes();
> name = attr.getAttribute(StyleConstants.NameAttribute);
> eName = name.toString();
> @@ -226,7 +227,7 @@
> cacheLookup.append(' ');
> }
> cacheLookup.append(t.toString());
> - e = (Element)searchContext.elementAt(0);
> + e = searchContext.elementAt(0);
> attr = e.getAttributes();
> if (e.isLeaf()) {
> // For leafs, we use the second tier attributes.
> @@ -393,7 +394,7 @@
> public void addStyleSheet(StyleSheet ss) {
> synchronized(this) {
> if (linkedStyleSheets == null) {
> - linkedStyleSheets = new Vector();
> + linkedStyleSheets = new Vector<StyleSheet>();
> }
> if (!linkedStyleSheets.contains(ss)) {
> int index = 0;
> @@ -1077,7 +1078,7 @@
> String[] getSimpleSelectors(String selector) {
> selector = cleanSelectorString(selector);
> SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
> - Vector selectors = sb.getVector();
> + Vector<String> selectors = (Vector<String>)sb.getVector();
> int lastIndex = 0;
> int length = selector.length();
> while (lastIndex != -1) {
> @@ -1281,15 +1282,14 @@
> * such that <code>elements</code> will remain ordered by
> * specificity.
> */
> - private void addSortedStyle(SelectorMapping mapping, Vector elements) {
> + private void addSortedStyle(SelectorMapping mapping, Vector<SelectorMapping> elements) {
> int size = elements.size();
>
> if (size > 0) {
> int specificity = mapping.getSpecificity();
>
> for (int counter = 0; counter < size; counter++) {
> - if (specificity >= ((SelectorMapping)elements.elementAt
> - (counter)).getSpecificity()) {
> + if (specificity >= elements.elementAt(counter).getSpecificity()) {
> elements.insertElementAt(mapping, counter);
> return;
> }
> @@ -1304,10 +1304,10 @@
> * any child mappings for any of the Elements in <code>elements</code>.
> */
> private synchronized void getStyles(SelectorMapping parentMapping,
> - Vector styles,
> + Vector<SelectorMapping> styles,
> String[] tags, String[] ids, String[] classes,
> int index, int numElements,
> - Hashtable alreadyChecked) {
> + Hashtable<SelectorMapping, SelectorMapping> alreadyChecked) {
> // Avoid desending the same mapping twice.
> if (alreadyChecked.contains(parentMapping)) {
> return;
> @@ -1368,8 +1368,8 @@
> String[] tags,
> String[] ids, String[] classes) {
> SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
> - Vector tempVector = sb.getVector();
> - Hashtable tempHashtable = sb.getHashtable();
> + Vector<SelectorMapping> tempVector = (Vector<SelectorMapping>)sb.getVector();
> + Hashtable<SelectorMapping, SelectorMapping> tempHashtable = (Hashtable<SelectorMapping, SelectorMapping>)sb.getHashtable();
> // Determine all the Styles that are appropriate, placing them
> // in tempVector
> try {
> @@ -1419,13 +1419,12 @@
> int numStyles = tempVector.size();
> AttributeSet[] attrs = new AttributeSet[numStyles + numLinkedSS];
> for (int counter = 0; counter < numStyles; counter++) {
> - attrs[counter] = ((SelectorMapping)tempVector.
> - elementAt(counter)).getStyle();
> + attrs[counter] = tempVector.elementAt(counter).getStyle();
> }
> // Get the AttributeSet from linked style sheets.
> for (int counter = 0; counter < numLinkedSS; counter++) {
> - AttributeSet attr = ((StyleSheet)linkedStyleSheets.
> - elementAt(counter)).getRule(selector);
> + AttributeSet attr = linkedStyleSheets.
> + elementAt(counter).getRule(selector);
> if (attr == null) {
> attrs[counter + numStyles] = SimpleAttributeSet.EMPTY;
> }
> @@ -1515,7 +1514,7 @@
> private Style createResolvedStyle(String selector) {
> SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
> // Will contain the tags, ids, and classes, in that order.
> - Vector elements = sb.getVector();
> + Vector<String> elements = (Vector<String>)sb.getVector();
> try {
> boolean done;
> int dotIndex = 0;
> @@ -1641,9 +1640,9 @@
> String[] classes = new String[numTags];
> for (int index = 0, eIndex = total - 3; index < numTags;
> index++, eIndex -= 3) {
> - tags[index] = (String)elements.elementAt(eIndex);
> - classes[index] = (String)elements.elementAt(eIndex + 1);
> - ids[index] = (String)elements.elementAt(eIndex + 2);
> + tags[index] = elements.elementAt(eIndex);
> + classes[index] = elements.elementAt(eIndex + 1);
> + ids[index] = elements.elementAt(eIndex + 2);
> }
> return createResolvedStyle(selector, tags, ids, classes);
> }
> @@ -1683,7 +1682,7 @@
> private static class SearchBuffer {
> /** A stack containing instances of SearchBuffer. Used in getting
> * rules. */
> - static Stack searchBuffers = new Stack();
> + static Stack<SearchBuffer> searchBuffers = new Stack<SearchBuffer>();
> // A set of temporary variables that can be used in whatever way.
> Vector vector = null;
> StringBuffer stringBuffer = null;
> @@ -1697,7 +1696,7 @@
> SearchBuffer sb;
> try {
> if(!searchBuffers.empty()) {
> - sb = (SearchBuffer)searchBuffers.pop();
> + sb = searchBuffers.pop();
> } else {
> sb = new SearchBuffer();
> }
> @@ -1725,7 +1724,7 @@
>
> Vector getVector() {
> if (vector == null) {
> - vector = new Vector();
> + vector = new Vector<Object>();
> }
> return vector;
> }
> @@ -2644,7 +2643,7 @@
> // implementation.
> Document doc = v.getDocument();
> SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
> - Vector muxList = sb.getVector();
> + Vector<AttributeSet> muxList = (Vector<AttributeSet>)sb.getVector();
> try {
> if (doc instanceof HTMLDocument) {
> StyleSheet styles = StyleSheet.this;
> @@ -3078,10 +3077,10 @@
> SelectorMapping retValue = null;
>
> if (children != null) {
> - retValue = (SelectorMapping)children.get(selector);
> + retValue = children.get(selector);
> }
> else if (create) {
> - children = new HashMap(7);
> + children = new HashMap<String, SelectorMapping>(7);
> }
> if (retValue == null && create) {
> int specificity = getChildSpecificity(selector);
> @@ -3140,7 +3139,7 @@
> * Any sub selectors. Key will be String, and value will be
> * another SelectorMapping.
> */
> - private HashMap children;
> + private HashMap<String, SelectorMapping> children;
> }
>
>
> @@ -3157,11 +3156,11 @@
>
> /** Maps from selector (as a string) to Style that includes all
> * relevant styles. */
> - private Hashtable resolvedStyles;
> + private Hashtable<String, ResolvedStyle> resolvedStyles;
>
> /** Vector of StyleSheets that the rules are to reference.
> */
> - private Vector linkedStyleSheets;
> + private Vector<StyleSheet> linkedStyleSheets;
>
> /** Where the style sheet was found. Used for relative imports. */
> private URL base;
> @@ -3298,7 +3297,7 @@
> public void endRule() {
> int n = selectors.size();
> for (int i = 0; i < n; i++) {
> - String[] selector = (String[]) selectors.elementAt(i);
> + String[] selector = selectors.elementAt(i);
> if (selector.length > 0) {
> StyleSheet.this.addRule(selector, declaration, isLink);
> }
> @@ -3315,8 +3314,8 @@
> }
>
>
> - Vector selectors = new Vector();
> - Vector selectorTokens = new Vector();
> + Vector<String[]> selectors = new Vector<String[]>();
> + Vector<String> selectorTokens = new Vector<String>();
> /** Name of the current property. */
> String propertyName;
> MutableAttributeSet declaration = new SimpleAttributeSet();
> Index: classes/javax/swing/text/html/TableView.java
> ===================================================================
> --- classes/javax/swing/text/html/TableView.java (revision 250)
> +++ classes/javax/swing/text/html/TableView.java (working copy)
> @@ -37,6 +37,7 @@
> * HTML table view.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.47 05/05/07
> * @see View
> */
> @@ -49,7 +50,7 @@
> */
> public TableView(Element elem) {
> super(elem, View.Y_AXIS);
> - rows = new Vector();
> + rows = new Vector<View>();
> gridValid = false;
> captionIndex = -1;
> totalColumnRequirements = new SizeRequirements();
> @@ -991,7 +992,7 @@
> RowIterator rowIterator = new RowIterator();
> ColumnIterator colIterator = new ColumnIterator();
>
> - Vector rows;
> + Vector<View> rows;
>
> // whether to display comments inside table or not.
> boolean skipComments = false;
> Index: classes/javax/swing/text/InternationalFormatter.java
> ===================================================================
> --- classes/javax/swing/text/InternationalFormatter.java (revision 250)
> +++ classes/javax/swing/text/InternationalFormatter.java (working copy)
> @@ -27,6 +27,7 @@
> import java.awt.event.ActionEvent;
> import java.io.*;
> import java.text.*;
> +import java.text.AttributedCharacterIterator.Attribute;
> import java.util.*;
> import javax.swing.*;
> import javax.swing.text.*;
> @@ -90,6 +91,8 @@
> * @see java.text.Format
> * @see java.lang.Comparable
> *
> + * @author unattributed
> + * @author Florian Brunner
> * @version 1.7 04/09/01
> * @since 1.4
> */
> @@ -353,13 +356,13 @@
> updateMask();
> }
>
> - Map attrs = getAttributes(offset);
> + Map<Attribute, Object> attrs = getAttributes(offset);
>
> if (attrs != null && attrs.size() > 0) {
> - ArrayList al = new ArrayList();
> + ArrayList<Attribute> al = new ArrayList<Attribute>();
>
> al.addAll(attrs.keySet());
> - return (Format.Field[])al.toArray(EMPTY_FIELD_ARRAY);
> + return al.toArray(EMPTY_FIELD_ARRAY);
> }
> return EMPTY_FIELD_ARRAY;
> }
> @@ -441,7 +444,7 @@
> /**
> * Returns a Set of the attribute identifiers at <code>index</code>.
> */
> - Map getAttributes(int index) {
> + Map<Attribute, Object> getAttributes(int index) {
> if (isValidMask()) {
> AttributedCharacterIterator iterator = getIterator();
>
> Index: classes/javax/swing/text/JTextComponent.java
> ===================================================================
> --- classes/javax/swing/text/JTextComponent.java (revision 250)
> +++ classes/javax/swing/text/JTextComponent.java (working copy)
> @@ -291,6 +291,7 @@
> *
> * @author Timothy Prinzing
> * @author Igor Kushnirskiy (printing support)
> + * @author Florian Brunner
> * @version 1.235 05/05/07
> * @see Document
> * @see DocumentEvent
> @@ -386,7 +387,7 @@
> * @since 1.4
> */
> public CaretListener[] getCaretListeners() {
> - return (CaretListener[])listenerList.getListeners(CaretListener.class);
> + return listenerList.getListeners(CaretListener.class);
> }
>
> /**
> @@ -1170,14 +1171,14 @@
> * @param actions the set of actions
> */
> public static void loadKeymap(Keymap map, KeyBinding[] bindings, Action[] actions) {
> - Hashtable h = new Hashtable();
> + Hashtable<String, Action> h = new Hashtable<String, Action>();
> for (int i = 0; i < actions.length; i++) {
> Action a = actions[i];
> String value = (String)a.getValue(Action.NAME);
> h.put((value!=null ? value:""), a);
> }
> for (int i = 0; i < bindings.length; i++) {
> - Action a = (Action) h.get(bindings[i].actionName);
> + Action a = h.get(bindings[i].actionName);
> if (a != null) {
> map.addActionForKeyStroke(bindings[i].key, a);
> }
> @@ -1191,11 +1192,11 @@
> * invoked from within a <code>doPrivileged</code>, and it is also
> * assumed <code>klass</code> extends <code>JTextComponent</code>.
> */
> - private static Boolean isProcessInputMethodEventOverridden(Class klass) {
> + private static Boolean isProcessInputMethodEventOverridden(Class<?> klass) {
> if (klass == JTextComponent.class) {
> return Boolean.FALSE;
> }
> - Boolean retValue = (Boolean)overrideMap.get(klass.getName());
> + Boolean retValue = overrideMap.get(klass.getName());
>
> if (retValue != null) {
> return retValue;
> @@ -3908,7 +3909,7 @@
> * Maps from class name to Boolean indicating if
> * <code>processInputMethodEvent</code> has been overriden.
> */
> - private static Map overrideMap;
> + private static Map<String, Boolean> overrideMap;
>
> /**
> * Returns a string representation of this <code>JTextComponent</code>.
> @@ -4070,7 +4071,7 @@
> DefaultKeymap(String nm, Keymap parent) {
> this.nm = nm;
> this.parent = parent;
> - bindings = new Hashtable();
> + bindings = new Hashtable<KeyStroke, Action>();
> }
>
> /**
> @@ -4100,7 +4101,7 @@
> }
>
> public Action getAction(KeyStroke key) {
> - Action a = (Action) bindings.get(key);
> + Action a = bindings.get(key);
> if ((a == null) && (parent != null)) {
> a = parent.getAction(key);
> }
> @@ -4131,15 +4132,14 @@
> }
> KeyStroke[] retValue = null;
> // Determine local bindings first.
> - Vector keyStrokes = null;
> - for (Enumeration enum_ = bindings.keys();
> - enum_.hasMoreElements();) {
> - Object key = enum_.nextElement();
> - if (bindings.get(key) == a) {
> + Vector<KeyStroke> keyStrokes = null;
> + Set<KeyStroke> keyStrokeSet = bindings.keySet();
> + for (KeyStroke keyStroke : keyStrokeSet) {
> + if (bindings.get(keyStroke) == a) {
> if (keyStrokes == null) {
> - keyStrokes = new Vector();
> + keyStrokes = new Vector<KeyStroke>();
> }
> - keyStrokes.addElement(key);
> + keyStrokes.addElement(keyStroke);
> }
> }
> // See if the parent has any.
> @@ -4158,7 +4158,7 @@
> }
> if (rCount > 0 && rCount < pStrokes.length) {
> if (keyStrokes == null) {
> - keyStrokes = new Vector();
> + keyStrokes = new Vector<KeyStroke>();
> }
> for (int counter = pStrokes.length - 1; counter >= 0;
> counter--) {
> @@ -4223,7 +4223,7 @@
>
> String nm;
> Keymap parent;
> - Hashtable bindings;
> + Hashtable<KeyStroke, Action> bindings;
> Action defaultAction;
> }
>
> @@ -4928,16 +4928,16 @@
> //
> private boolean isProcessInputMethodEventOverridden() {
> if (overrideMap == null) {
> - overrideMap = Collections.synchronizedMap(new HashMap());
> + overrideMap = Collections.synchronizedMap(new HashMap<String, Boolean>());
> }
> - Boolean retValue = (Boolean)overrideMap.get(getClass().getName());
> + Boolean retValue = overrideMap.get(getClass().getName());
>
> if (retValue != null) {
> return retValue.booleanValue();
> }
> - Boolean ret = (Boolean)AccessController.doPrivileged(new
> - PrivilegedAction() {
> - public Object run() {
> + Boolean ret = AccessController.doPrivileged(new
> + PrivilegedAction<Boolean>() {
> + public Boolean run() {
> return isProcessInputMethodEventOverridden(
> JTextComponent.this.getClass());
> }
> @@ -5043,3 +5043,4 @@
> }
>
>
> +
> Index: classes/javax/swing/text/LayoutQueue.java
> ===================================================================
> --- classes/javax/swing/text/LayoutQueue.java (revision 250)
> +++ classes/javax/swing/text/LayoutQueue.java (working copy)
> @@ -30,13 +30,14 @@
> * A queue of text layout tasks.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.13 05/05/07
> * @see AsyncBoxView
> * @since 1.3
> */
> public class LayoutQueue {
>
> - Vector tasks;
> + Vector<Runnable> tasks;
> Thread worker;
>
> static LayoutQueue defaultQueue;
> @@ -45,7 +46,7 @@
> * Construct a layout queue.
> */
> public LayoutQueue() {
> - tasks = new Vector();
> + tasks = new Vector<Runnable>();
> }
>
> /**
> @@ -91,7 +92,7 @@
> return null;
> }
> }
> - Runnable work = (Runnable) tasks.firstElement();
> + Runnable work = tasks.firstElement();
> tasks.removeElementAt(0);
> return work;
> }
> Index: classes/javax/swing/text/MaskFormatter.java
> ===================================================================
> --- classes/javax/swing/text/MaskFormatter.java (revision 250)
> +++ classes/javax/swing/text/MaskFormatter.java (working copy)
> @@ -148,6 +148,8 @@
> * has been added to the <code>java.beans</code> package.
> * Please see {@link java.beans.XMLEncoder}.
> *
> + * @author unattributed
> + * @author Florian Brunner
> * @version 1.19 05/05/07
> * @since 1.4
> */
> @@ -499,8 +501,8 @@
> */
> private void updateInternalMask() throws ParseException {
> String mask = getMask();
> - ArrayList fixed = new ArrayList();
> - ArrayList temp = fixed;
> + ArrayList<MaskCharacter> fixed = new ArrayList<MaskCharacter>();
> + ArrayList<MaskCharacter> temp = fixed;
>
> if (mask != null) {
> for (int counter = 0, maxCounter = mask.length();
> Index: classes/javax/swing/text/NumberFormatter.java
> ===================================================================
> --- classes/javax/swing/text/NumberFormatter.java (revision 250)
> +++ classes/javax/swing/text/NumberFormatter.java (working copy)
> @@ -88,6 +88,9 @@
> * has been added to the <code>java.beans</code> package.
> * Please see {@link java.beans.XMLEncoder}.
> *
> + * @author unattributed
> + * @author Florian Brunner
> + *
> * @version 1.4 03/05/01
> * @since 1.4
> */
> @@ -461,7 +464,7 @@
> }
> }
> if (string != null) {
> - Class valueClass = getValueClass();
> + Class<?> valueClass = getValueClass();
>
> if (valueClass == null) {
> valueClass = value.getClass();
> Index: classes/javax/swing/text/PlainDocument.java
> ===================================================================
> --- classes/javax/swing/text/PlainDocument.java (revision 250)
> +++ classes/javax/swing/text/PlainDocument.java (working copy)
> @@ -54,6 +54,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.51 05/05/07
> * @see Document
> * @see AbstractDocument
> @@ -319,7 +320,7 @@
> }
>
> private AbstractElement defaultRoot;
> - private Vector added = new Vector(); // Vector<Element>
> - private Vector removed = new Vector(); // Vector<Element>
> + private Vector<Element> added = new Vector<Element>(); // Vector<Element>
> + private Vector<Element> removed = new Vector<Element>(); // Vector<Element>
> private transient Segment s;
> }
> Index: classes/javax/swing/text/rtf/MockAttributeSet.java
> ===================================================================
> --- classes/javax/swing/text/rtf/MockAttributeSet.java (revision 250)
> +++ classes/javax/swing/text/rtf/MockAttributeSet.java (working copy)
> @@ -32,10 +32,15 @@
>
> /* This AttributeSet is made entirely out of tofu and Ritz Crackers
> and yet has a remarkably attribute-set-like interface! */
> +/**
> + *
> + * @author unattributed
> + * @author Florian Brunner
> + */
> class MockAttributeSet
> implements AttributeSet, MutableAttributeSet
> {
> - public Dictionary backing;
> + public Dictionary<Object, Object> backing;
>
> public boolean isEmpty()
> {
> Index: classes/javax/swing/text/rtf/RTFAttributes.java
> ===================================================================
> --- classes/javax/swing/text/rtf/RTFAttributes.java (revision 250)
> +++ classes/javax/swing/text/rtf/RTFAttributes.java (working copy)
> @@ -31,12 +31,17 @@
> import java.util.*;
> import java.io.IOException;
>
> +/**
> + *
> + * @author unattributed
> + * @author Florian Brunner
> + */
> class RTFAttributes
> {
> static RTFAttribute attributes[];
>
> static {
> - Vector a = new Vector();
> + Vector<RTFAttribute> a = new Vector<RTFAttribute>();
> int CHR = RTFAttribute.D_CHARACTER;
> int PGF = RTFAttribute.D_PARAGRAPH;
> int SEC = RTFAttribute.D_SECTION;
> @@ -131,9 +136,9 @@
> attributes = attrs;
> }
>
> - static Dictionary attributesByKeyword()
> + static Dictionary<String, RTFAttribute> attributesByKeyword()
> {
> - Dictionary d = new Hashtable(attributes.length);
> + Dictionary<String, RTFAttribute> d = new Hashtable<String, RTFAttribute>(attributes.length);
> int i, m;
>
> m = attributes.length;
> Index: classes/javax/swing/text/rtf/RTFGenerator.java
> ===================================================================
> --- classes/javax/swing/text/rtf/RTFGenerator.java (revision 250)
> +++ classes/javax/swing/text/rtf/RTFGenerator.java (working copy)
> @@ -42,6 +42,9 @@
> * <p>Note that this is a lossy conversion since RTF's model of
> * text does not exactly correspond with LightText's.
> *
> + * @author unattributed
> + * @author Florian Brunner
> + *
> * @see LTAttributedText
> * @see LTRTFFilter
> * @see LTTextAcceptor
> @@ -52,11 +55,11 @@
> {
> /* These dictionaries map Colors, font names, or Style objects
> to Integers */
> - Dictionary colorTable;
> + Dictionary<Object, Integer> colorTable;
> int colorCount;
> - Dictionary fontTable;
> + Dictionary<String, Integer> fontTable;
> int fontCount;
> - Dictionary styleTable;
> + Dictionary<AttributeSet, Integer> styleTable;
> int styleCount;
>
> /* where all the text is going */
> @@ -106,7 +109,7 @@
>
> Dictionary textKeywordDictionary = RTFReader.textKeywords;
> Enumeration keys = textKeywordDictionary.keys();
> - Vector tempPairs = new Vector();
> + Vector<CharacterKeywordPair> tempPairs = new Vector<CharacterKeywordPair>();
> while(keys.hasMoreElements()) {
> CharacterKeywordPair pair = new CharacterKeywordPair();
> pair.keyword = (String)keys.nextElement();
> @@ -141,14 +144,14 @@
>
> public RTFGenerator(OutputStream to)
> {
> - colorTable = new Hashtable();
> + colorTable = new Hashtable<Object, Integer>();
> colorTable.put(defaultRTFColor, new Integer(0));
> colorCount = 1;
>
> - fontTable = new Hashtable();
> + fontTable = new Hashtable<String, Integer>();
> fontCount = 0;
>
> - styleTable = new Hashtable();
> + styleTable = new Hashtable<AttributeSet, Integer>();
> /* TODO: put default style in style table */
> styleCount = 0;
>
> @@ -205,7 +208,7 @@
> private void tallyStyles(AttributeSet a) {
> while (a != null) {
> if (a instanceof Style) {
> - Integer aNum = (Integer)styleTable.get(a);
> + Integer aNum = styleTable.get(a);
> if (aNum == null) {
> styleCount = styleCount + 1;
> aNum = new Integer(styleCount);
> @@ -233,7 +236,7 @@
> {
> while(a != null) {
> if (a instanceof Style) {
> - Integer aNum = (Integer)styleTable.get(a);
> + Integer aNum = styleTable.get(a);
> if (aNum != null) {
> if (domain == null ||
> domain.equals(a.getAttribute(Constants.StyleType)))
> @@ -331,7 +334,7 @@
> String font;
> while(fonts.hasMoreElements()) {
> font = (String)fonts.nextElement();
> - Integer num = (Integer)(fontTable.get(font));
> + Integer num = fontTable.get(font);
> sortedFontTable[num.intValue()] = font;
> }
> writeBegingroup();
> @@ -352,7 +355,7 @@
> Color color;
> while(colors.hasMoreElements()) {
> color = (Color)colors.nextElement();
> - Integer num = (Integer)(colorTable.get(color));
> + Integer num = colorTable.get(color);
> sortedColorTable[num.intValue()] = color;
> }
> writeBegingroup();
> @@ -377,7 +380,7 @@
> Enumeration styles = styleTable.keys();
> while(styles.hasMoreElements()) {
> Style style = (Style)styles.nextElement();
> - int styleNumber = ((Integer)styleTable.get(style)).intValue();
> + int styleNumber = styleTable.get(style).intValue();
> writeBegingroup();
> String styleType = (String)style.getAttribute(Constants.StyleType);
> if (styleType == null)
> @@ -406,7 +409,7 @@
>
> basis = style.getResolveParent();
> if (basis != null && basis instanceof Style) {
> - Integer basedOn = (Integer)styleTable.get(basis);
> + Integer basedOn = styleTable.get(basis);
> if (basedOn != null) {
> writeControlWord("sbasedon", basedOn.intValue());
> }
> @@ -414,7 +417,7 @@
>
> Style nextStyle = (Style)style.getAttribute(Constants.StyleNext);
> if (nextStyle != null) {
> - Integer nextNum = (Integer)styleTable.get(nextStyle);
> + Integer nextNum = styleTable.get(nextStyle);
> if (nextNum != null) {
> writeControlWord("snext", nextNum.intValue());
> }
> Index: classes/javax/swing/text/rtf/RTFParser.java
> ===================================================================
> --- classes/javax/swing/text/rtf/RTFParser.java (revision 250)
> +++ classes/javax/swing/text/rtf/RTFParser.java (working copy)
> @@ -35,6 +35,9 @@
> * Normally programmers will only use <b>RTFFilter</b>, a subclass of this class that knows what to
> * do with the tokens this class parses.
> *
> + * @author unattributed
> + * @author Florian Brunner
> + *
> * @see AbstractFilter
> * @see RTFFilter
> */
> @@ -92,7 +95,7 @@
> // table of non-text characters in rtf
> static final boolean rtfSpecialsTable[];
> static {
> - rtfSpecialsTable = (boolean[])noSpecialsTable.clone();
> + rtfSpecialsTable = noSpecialsTable.clone();
> rtfSpecialsTable['\n'] = true;
> rtfSpecialsTable['\r'] = true;
> rtfSpecialsTable['{'] = true;
> @@ -332,3 +335,4 @@
>
> }
>
> +
> Index: classes/javax/swing/text/rtf/RTFReader.java
> ===================================================================
> --- classes/javax/swing/text/rtf/RTFReader.java (revision 250)
> +++ classes/javax/swing/text/rtf/RTFReader.java (working copy)
> @@ -43,6 +43,9 @@
> * in order to guarantee that all of the text has been sent to
> * the text acceptor.
> *
> + * @author unattributed
> + * @author Florian Brunner
> + *
> * @see RTFParser
> * @see java.io.OutputStream
> */
> @@ -54,7 +57,7 @@
> /** Miscellaneous information about the parser's state. This
> * dictionary is saved and restored when an RTF group begins
> * or ends. */
> - Dictionary parserState; /* Current parser state */
> + Dictionary<Object, Object> parserState; /* Current parser state */
> /** This is the "dst" item from parserState. rtfDestination
> * is the current rtf destination. It is cached in an instance
> * variable for speed. */
> @@ -63,7 +66,7 @@
> MutableAttributeSet documentAttributes;
>
> /** This Dictionary maps Integer font numbers to String font names. */
> - Dictionary fontTable;
> + Dictionary<Integer, String> fontTable;
> /** This array maps color indices to Color objects. */
> Color[] colorTable;
> /** This array maps character style numbers to Style objects. */
> @@ -96,9 +99,9 @@
> /* this should be final, but there's a bug in javac... */
> /** textKeywords maps RTF keywords to single-character strings,
> * for those keywords which simply insert some text. */
> - static Dictionary textKeywords = null;
> + static Dictionary<String, String> textKeywords = null;
> static {
> - textKeywords = new Hashtable();
> + textKeywords = new Hashtable<String, String>();
> textKeywords.put("\\", "\\");
> textKeywords.put("{", "{");
> textKeywords.put("}", "}");
> @@ -129,10 +132,10 @@
> static final String TabAlignmentKey = "tab_alignment";
> static final String TabLeaderKey = "tab_leader";
>
> - static Dictionary characterSets;
> + static Dictionary<String, char[]> characterSets;
> static boolean useNeXTForAnsi = false;
> static {
> - characterSets = new Hashtable();
> + characterSets = new Hashtable<String, char[]>();
> }
>
> /* TODO: per-font font encodings ( \fcharset control word ) ? */
> @@ -148,8 +151,8 @@
> int i;
>
> target = destination;
> - parserState = new Hashtable();
> - fontTable = new Hashtable();
> + parserState = new Hashtable<Object, Object>();
> + fontTable = new Hashtable<Integer, String>();
>
> rtfversion = -1;
>
> @@ -220,7 +223,7 @@
> Object oldSaveState = parserState.get("_savedState");
> if (oldSaveState != null)
> parserState.remove("_savedState");
> - Dictionary saveState = (Dictionary)((Hashtable)parserState).clone();
> + Dictionary<String, Object> saveState = (Dictionary<String, Object>)((Hashtable)parserState).clone();
> if (oldSaveState != null)
> saveState.put("_savedState", oldSaveState);
> parserState.put("_savedState", saveState);
> @@ -242,7 +245,7 @@
> skippingCharacters = 0;
> }
>
> - Dictionary restoredState = (Dictionary)parserState.get("_savedState");
> + Dictionary<Object, Object> restoredState = (Dictionary<Object, Object>)parserState.get("_savedState");
> Destination restoredDestination = (Destination)restoredState.get("dst");
> if (restoredDestination != rtfDestination) {
> rtfDestination.close(); /* allow the destination to clean up */
> @@ -558,12 +561,12 @@
> {
> char[] set;
>
> - set = (char [])characterSets.get(name);
> + set = characterSets.get(name);
> if (set == null) {
> InputStream charsetStream;
> - charsetStream = (InputStream)java.security.AccessController.
> - doPrivileged(new java.security.PrivilegedAction() {
> - public Object run() {
> + charsetStream = java.security.AccessController.
> + doPrivileged(new java.security.PrivilegedAction<InputStream>() {
> + public InputStream run() {
> return RTFReader.class.getResourceAsStream
> ("charsets/" + name + ".txt");
> }
> @@ -686,7 +689,7 @@
> class FonttblDestination implements Destination
> {
> int nextFontNumber;
> - Object fontNumberKey = null;
> + Integer fontNumberKey = null;
> String nextFontFamily;
>
> public void handleBinaryBlob(byte[] data)
> @@ -761,14 +764,14 @@
> class ColortblDestination implements Destination
> {
> int red, green, blue;
> - Vector proTemTable;
> + Vector<Color> proTemTable;
>
> public ColortblDestination()
> {
> red = 0;
> green = 0;
> blue = 0;
> - proTemTable = new Vector();
> + proTemTable = new Vector<Color>();
> }
>
> public void handleText(String text)
> @@ -823,11 +826,11 @@
> extends DiscardingDestination
> implements Destination
> {
> - Dictionary definedStyles;
> + Dictionary<Integer, StyleDefiningDestination> definedStyles;
>
> public StylesheetDestination()
> {
> - definedStyles = new Hashtable();
> + definedStyles = new Hashtable<Integer, StyleDefiningDestination>();
> }
>
> public void begingroup()
> @@ -837,10 +840,10 @@
>
> public void close()
> {
> - Vector chrStyles, pgfStyles, secStyles;
> - chrStyles = new Vector();
> - pgfStyles = new Vector();
> - secStyles = new Vector();
> + Vector<Style> chrStyles, pgfStyles, secStyles;
> + chrStyles = new Vector<Style>();
> + pgfStyles = new Vector<Style>();
> + secStyles = new Vector<Style>();
> Enumeration styles = definedStyles.elements();
> while(styles.hasMoreElements()) {
> StyleDefiningDestination style;
> @@ -849,7 +852,7 @@
> defined = style.realize();
> warning("Style "+style.number+" ("+style.styleName+"): "+defined);
> String stype = (String)defined.getAttribute(Constants.StyleType);
> - Vector toSet;
> + Vector<Style> toSet;
> if (stype.equals(Constants.STSection)) {
> toSet = secStyles;
> } else if (stype.equals(Constants.STCharacter)) {
> @@ -989,7 +992,7 @@
>
> if (basedOn != STYLENUMBER_NONE) {
> StyleDefiningDestination styleDest;
> - styleDest = (StyleDefiningDestination)definedStyles.get(Integer.valueOf(basedOn));
> + styleDest = definedStyles.get(Integer.valueOf(basedOn));
> if (styleDest != null && styleDest != this) {
> basis = styleDest.realize();
> }
> @@ -1016,7 +1019,7 @@
>
> if (nextStyle != STYLENUMBER_NONE) {
> StyleDefiningDestination styleDest;
> - styleDest = (StyleDefiningDestination)definedStyles.get(Integer.valueOf(nextStyle));
> + styleDest = definedStyles.get(Integer.valueOf(nextStyle));
> if (styleDest != null) {
> next = styleDest.realize();
> }
> @@ -1267,12 +1270,12 @@
> parserState.remove("tab_leader");
>
> TabStop newStop = new TabStop(tabPosition, tabAlignment, tabLeader);
> - Dictionary tabs;
> + Dictionary<Object, Object> tabs;
> Integer stopCount;
>
> - tabs = (Dictionary)parserState.get("_tabs");
> + tabs = (Dictionary<Object, Object>)parserState.get("_tabs");
> if (tabs == null) {
> - tabs = new Hashtable();
> + tabs = new Hashtable<Object, Object>();
> parserState.put("_tabs", tabs);
> stopCount = Integer.valueOf(1);
> } else {
> @@ -1369,7 +1372,7 @@
> /* note setFontFamily() can not handle a null font */
> String fontFamily;
> if (fontnum != null)
> - fontFamily = (String)fontTable.get(fontnum);
> + fontFamily = fontTable.get(fontnum);
> else
> fontFamily = null;
> if (fontFamily != null)
> @@ -1647,3 +1650,4 @@
> }
>
>
> +
> Index: classes/javax/swing/text/SegmentCache.java
> ===================================================================
> --- classes/javax/swing/text/SegmentCache.java (revision 250)
> +++ classes/javax/swing/text/SegmentCache.java (working copy)
> @@ -38,6 +38,8 @@
> * segmentCache.releaseSegment(segment);
> * </pre>
> *
> + * @author unattributed
> + * @author Florian Brunner
> * @version 1.12 05/05/07
> */
> class SegmentCache {
> @@ -49,7 +51,7 @@
> /**
> * A list of the currently unused Segments.
> */
> - private List segments;
> + private List<Segment> segments;
>
>
> /**
> @@ -81,7 +83,7 @@
> * Creates and returns a SegmentCache.
> */
> public SegmentCache() {
> - segments = new ArrayList(11);
> + segments = new ArrayList<Segment>(11);
> }
>
> /**
> @@ -93,7 +95,7 @@
> int size = segments.size();
>
> if (size > 0) {
> - return (Segment)segments.remove(size - 1);
> + return segments.remove(size - 1);
> }
> }
> return new CachedSegment();
> Index: classes/javax/swing/text/SimpleAttributeSet.java
> ===================================================================
> --- classes/javax/swing/text/SimpleAttributeSet.java (revision 250)
> +++ classes/javax/swing/text/SimpleAttributeSet.java (working copy)
> @@ -47,6 +47,7 @@
> *
> * @version 1.49 07/08/07
> * @author Tim Prinzing
> + * @author Florian Brunner
> */
> public class SimpleAttributeSet implements MutableAttributeSet, Serializable, Cloneable
> {
> @@ -57,7 +58,7 @@
> */
> public static final AttributeSet EMPTY = new EmptyAttributeSet();
>
> - private transient Hashtable table = new Hashtable(3);
> + private transient Hashtable<Object, Object> table = new Hashtable<Object, Object>(3);
>
> /**
> * Creates a new attribute set.
> @@ -74,7 +75,7 @@
> addAttributes(source);
> }
>
> - private SimpleAttributeSet(Hashtable table) {
> + private SimpleAttributeSet(Hashtable<Object, Object> table) {
> this.table = table;
> }
>
> @@ -279,7 +280,7 @@
> SimpleAttributeSet attr;
> try {
> attr = (SimpleAttributeSet) super.clone();
> - attr.table = (Hashtable) table.clone();
> + attr.table = (Hashtable<Object, Object>) table.clone();
> } catch (CloneNotSupportedException cnse) {
> attr = null;
> }
> @@ -342,7 +343,7 @@
> private void readObject(ObjectInputStream s)
> throws ClassNotFoundException, IOException {
> s.defaultReadObject();
> - table = new Hashtable(3);
> + table = new Hashtable<Object, Object>(3);
> StyleContext.readAttributeSet(s, this);
> }
>
> Index: classes/javax/swing/text/StringContent.java
> ===================================================================
> --- classes/javax/swing/text/StringContent.java (revision 250)
> +++ classes/javax/swing/text/StringContent.java (working copy)
> @@ -49,6 +49,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.51 05/05/07
> */
> public final class StringContent implements AbstractDocument.Content, Serializable {
> @@ -175,7 +176,7 @@
> // some small documents won't have any sticky positions
> // at all, so the buffer is created lazily.
> if (marks == null) {
> - marks = new Vector();
> + marks = new Vector<PosRec>();
> }
> return new StickyPosition(offset);
> }
> @@ -227,7 +228,7 @@
> }
> int n = marks.size();
> for (int i = 0; i < n; i++) {
> - PosRec mark = (PosRec) marks.elementAt(i);
> + PosRec mark = marks.elementAt(i);
> if (mark.unused) {
> // this record is no longer used, get rid of it
> marks.removeElementAt(i);
> @@ -242,7 +243,7 @@
> synchronized void updateMarksForRemove(int offset, int length) {
> int n = marks.size();
> for (int i = 0; i < n; i++) {
> - PosRec mark = (PosRec) marks.elementAt(i);
> + PosRec mark = marks.elementAt(i);
> if (mark.unused) {
> // this record is no longer used, get rid of it
> marks.removeElementAt(i);
> @@ -275,9 +276,9 @@
> int length) {
> int n = marks.size();
> int end = offset + length;
> - Vector placeIn = (v == null) ? new Vector() : v;
> + Vector<Object> placeIn = (v == null) ? new Vector<Object>() : v;
> for (int i = 0; i < n; i++) {
> - PosRec mark = (PosRec) marks.elementAt(i);
> + PosRec mark = marks.elementAt(i);
> if (mark.unused) {
> // this record is no longer used, get rid of it
> marks.removeElementAt(i);
> @@ -313,7 +314,7 @@
> private static final char[] empty = new char[0];
> private char[] data;
> private int count;
> - transient Vector marks;
> + transient Vector<PosRec> marks;
>
> /**
> * holds the data for a mark... separately from
> Index: classes/javax/swing/text/StyleContext.java
> ===================================================================
> --- classes/javax/swing/text/StyleContext.java (revision 250)
> +++ classes/javax/swing/text/StyleContext.java (working copy)
> @@ -61,6 +61,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.88 05/05/07
> */
> public class StyleContext implements Serializable, AbstractDocument.AttributeContext {
> @@ -247,7 +248,7 @@
> */
> public Font getFont(String family, int style, int size) {
> fontSearch.setValue(family, style, size);
> - Font f = (Font) fontTable.get(fontSearch);
> + Font f = fontTable.get(fontSearch);
> if (f == null) {
> // haven't seen this one yet.
> Style defaultStyle =
> @@ -518,12 +519,12 @@
> // PENDING(prinz) should consider finding a alternative to
> // generating extra garbage on search key.
> SmallAttributeSet key = createSmallAttributeSet(search);
> - WeakReference reference = (WeakReference)attributesPool.get(key);
> + WeakReference<SmallAttributeSet> reference = attributesPool.get(key);
> SmallAttributeSet a;
> if (reference == null
> - || (a = (SmallAttributeSet)reference.get()) == null) {
> + || (a = reference.get()) == null) {
> a = key;
> - attributesPool.put(a, new WeakReference(a));
> + attributesPool.put(a, new WeakReference<SmallAttributeSet>(a));
> }
> return a;
> }
> @@ -677,8 +678,8 @@
> public static void registerStaticAttributeKey(Object key) {
> String ioFmt = key.getClass().getName() + "." + key.toString();
> if (freezeKeyMap == null) {
> - freezeKeyMap = new Hashtable();
> - thawKeyMap = new Hashtable();
> + freezeKeyMap = new Hashtable<Object, String>();
> + thawKeyMap = new Hashtable<String, Object>();
> }
> freezeKeyMap.put(key, ioFmt);
> thawKeyMap.put(ioFmt, key);
> @@ -717,10 +718,10 @@
> throws ClassNotFoundException, IOException
> {
> fontSearch = new FontKey(null, 0, 0);
> - fontTable = new Hashtable();
> + fontTable = new Hashtable<FontKey, Font>();
> search = new SimpleAttributeSet();
> attributesPool = Collections.
> - synchronizedMap(new WeakHashMap());
> + synchronizedMap(new WeakHashMap<SmallAttributeSet, WeakReference<SmallAttributeSet>>());
> s.defaultReadObject();
> }
>
> @@ -732,15 +733,15 @@
> */
> public static final String DEFAULT_STYLE = "default";
>
> - private static Hashtable freezeKeyMap;
> - private static Hashtable thawKeyMap;
> + private static Hashtable<Object, String> freezeKeyMap;
> + private static Hashtable<String, Object> thawKeyMap;
>
> private Style styles;
> private transient FontKey fontSearch = new FontKey(null, 0, 0);
> - private transient Hashtable fontTable = new Hashtable();
> + private transient Hashtable<FontKey, Font> fontTable = new Hashtable<FontKey, Font>();
>
> - private transient Map attributesPool = Collections.
> - synchronizedMap(new WeakHashMap());
> + private transient Map<SmallAttributeSet, WeakReference<SmallAttributeSet>> attributesPool = Collections.
> + synchronizedMap(new WeakHashMap<SmallAttributeSet, WeakReference<SmallAttributeSet>>());
> private transient MutableAttributeSet search = new SimpleAttributeSet();
>
> /**
> @@ -1177,8 +1178,8 @@
> }
> }
>
> - private Vector keys = new Vector();
> - private Vector data = new Vector();
> + private Vector<Object> keys = new Vector<Object>();
> + private Vector<Object> data = new Vector<Object>();
> }
>
> /**
> @@ -1345,8 +1346,7 @@
> * @since 1.4
> */
> public ChangeListener[] getChangeListeners() {
> - return (ChangeListener[])listenerList.getListeners(
> - ChangeListener.class);
> + return listenerList.getListeners(ChangeListener.class);
> }
>
>
> Index: classes/javax/swing/text/TableView.java
> ===================================================================
> --- classes/javax/swing/text/TableView.java (revision 250)
> +++ classes/javax/swing/text/TableView.java (working copy)
> @@ -65,6 +65,7 @@
> * spans if desired).
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.42 05/05/07
> * @see View
> */
> @@ -77,7 +78,7 @@
> */
> public TableView(Element elem) {
> super(elem, View.Y_AXIS);
> - rows = new Vector();
> + rows = new Vector<View>();
> gridValid = false;
> }
>
> @@ -579,7 +580,7 @@
> int[] columnSpans;
> int[] columnOffsets;
> SizeRequirements[] columnRequirements;
> - Vector rows;
> + Vector<View> rows;
> boolean gridValid;
> static final private BitSet EMPTY = new BitSet();
>
> Index: classes/javax/swing/text/TextAction.java
> ===================================================================
> --- classes/javax/swing/text/TextAction.java (revision 250)
> +++ classes/javax/swing/text/TextAction.java (working copy)
> @@ -57,6 +57,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.36 05/05/07
> */
> public abstract class TextAction extends AbstractAction {
> @@ -104,7 +105,7 @@
> * @return the augmented list
> */
> public static final Action[] augmentList(Action[] list1, Action[] list2) {
> - Hashtable h = new Hashtable();
> + Hashtable<String, Action> h = new Hashtable<String, Action>();
> for (int i = 0; i < list1.length; i++) {
> Action a = list1[i];
> String value = (String)a.getValue(Action.NAME);
> Index: classes/javax/swing/text/TextLayoutStrategy.java
> ===================================================================
> --- classes/javax/swing/text/TextLayoutStrategy.java (revision 250)
> +++ classes/javax/swing/text/TextLayoutStrategy.java (working copy)
> @@ -41,6 +41,7 @@
> * that uses TextLayout is plugged into the GlyphView.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.31 05/05/07
> */
> class TextLayoutStrategy extends FlowView.FlowStrategy {
> @@ -486,9 +487,9 @@
> * Returns a map with the attributes defined on the current
> * character.
> */
> - public Map getAttributes() {
> + public Map<Attribute, Object> getAttributes() {
> Object[] ka = keys.toArray();
> - Hashtable h = new Hashtable();
> + Hashtable<Attribute, Object> h = new Hashtable<Attribute, Object>();
> for (int i = 0; i < ka.length; i++) {
> TextAttribute a = (TextAttribute) ka[i];
> Object value = getAttribute(a);
> @@ -521,16 +522,16 @@
> * iterator's text range. The set is empty if no
> * attributes are defined.
> */
> - public Set getAllAttributeKeys() {
> + public Set<Attribute> getAllAttributeKeys() {
> return keys;
> }
>
> View v;
>
> - static Set keys;
> + static Set<Attribute> keys;
>
> static {
> - keys = new HashSet();
> + keys = new HashSet<Attribute>();
> keys.add(TextAttribute.FONT);
> keys.add(TextAttribute.RUN_DIRECTION);
> }
> Index: classes/javax/swing/text/ZoneView.java
> ===================================================================
> --- classes/javax/swing/text/ZoneView.java (revision 250)
> +++ classes/javax/swing/text/ZoneView.java (working copy)
> @@ -72,6 +72,7 @@
> * large zones efficiently.
> *
> * @author Timothy Prinzing
> + * @author Florian Brunner
> * @version 1.25 05/05/07
> * @see View
> * @since 1.3
> @@ -80,7 +81,7 @@
>
> int maxZoneSize = 8 * 1024;
> int maxZonesLoaded = 3;
> - Vector loadedZones;
> + Vector<View> loadedZones;
>
> /**
> * Constructs a ZoneView.
> @@ -90,7 +91,7 @@
> */
> public ZoneView(Element elem, int axis) {
> super(elem, axis);
> - loadedZones = new Vector();
> + loadedZones = new Vector<View>();
> }
>
> /**
> @@ -158,7 +159,7 @@
>
> void unloadOldZones() {
> while (loadedZones.size() > getMaxZonesLoaded()) {
> - View zone = (View) loadedZones.elementAt(0);
> + View zone = loadedZones.elementAt(0);
> loadedZones.removeElementAt(0);
> unloadZone(zone);
> }
> @@ -286,7 +287,7 @@
> // divide the old zone into a new set of bins
> Element elem = getElement();
> Document doc = elem.getDocument();
> - Vector zones = new Vector();
> + Vector<View> zones = new Vector<View>();
> int offs = offs0;
> do {
> offs0 = offs;
> Index: classes/javax/swing/Timer.java
> ===================================================================
> --- classes/javax/swing/Timer.java (revision 250)
> +++ classes/javax/swing/Timer.java (working copy)
> @@ -142,6 +142,7 @@
> *
> * @version 1.56 05/05/07
> * @author Dave Moore
> + * @author Florian Brunner
> */
> public class Timer implements Serializable
> {
> @@ -271,8 +272,7 @@
> * @since 1.4
> */
> public ActionListener[] getActionListeners() {
> - return (ActionListener[])listenerList.getListeners(
> - ActionListener.class);
> + return listenerList.getListeners(ActionListener.class);
> }
>
>
> @@ -614,3 +614,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/TimerQueue.java
> ===================================================================
> --- classes/javax/swing/TimerQueue.java (revision 250)
> +++ classes/javax/swing/TimerQueue.java (working copy)
> @@ -44,6 +44,7 @@
> * @version 1.45 05/05/07
> * @author Dave Moore
> * @author Igor Kushnirskiy
> + * @author Florian Brunner
> */
> class TimerQueue implements Runnable
> {
> @@ -97,7 +98,7 @@
> final ThreadGroup threadGroup =
> AppContext.getAppContext().getThreadGroup();
> java.security.AccessController.doPrivileged(
> - new java.security.PrivilegedAction() {
> + new java.security.PrivilegedAction<Object>() {
> public Object run() {
> Thread timerThread = new Thread(threadGroup, TimerQueue.this,
> "TimerQueue");
> Index: classes/javax/swing/tree/DefaultMutableTreeNode.java
> ===================================================================
> --- classes/javax/swing/tree/DefaultMutableTreeNode.java (revision 250)
> +++ classes/javax/swing/tree/DefaultMutableTreeNode.java (working copy)
> @@ -84,6 +84,7 @@
> *
> * @version 1.32 07/08/07
> * @author Rob Davis
> + * @author Florian Brunner
> */
> public class DefaultMutableTreeNode extends Object implements Cloneable,
> MutableTreeNode, Serializable
> @@ -101,7 +102,7 @@
> protected MutableTreeNode parent;
>
> /** array of children, may be null if this node has no children */
> - protected Vector children;
> + protected Vector<MutableTreeNode> children;
>
> /** optional user object */
> transient protected Object userObject;
> @@ -186,7 +187,7 @@
> }
> newChild.setParent(this);
> if (children == null) {
> - children = new Vector();
> + children = new Vector<MutableTreeNode>();
> }
> children.insertElementAt(newChild, childIndex);
> }
> @@ -1303,7 +1304,7 @@
>
> public PreorderEnumeration(TreeNode rootNode) {
> super();
> - Vector v = new Vector(1);
> + Vector<TreeNode> v = new Vector<TreeNode>(1);
> v.addElement(rootNode); // PENDING: don't really need a vector
> stack = new Stack();
> stack.push(v.elements());
> @@ -1354,8 +1355,7 @@
> if (subtree.hasMoreElements()) {
> retval = subtree.nextElement();
> } else if (children.hasMoreElements()) {
> - subtree = new PostorderEnumeration(
> - (TreeNode)children.nextElement());
> + subtree = new PostorderEnumeration(children.nextElement());
> retval = subtree.nextElement();
> } else {
> retval = root;
> @@ -1374,7 +1374,7 @@
>
> public BreadthFirstEnumeration(TreeNode rootNode) {
> super();
> - Vector v = new Vector(1);
> + Vector<TreeNode> v = new Vector<TreeNode>(1);
> v.addElement(rootNode); // PENDING: don't really need a vector
> queue = new Queue();
> queue.enqueue(v.elements());
> Index: classes/javax/swing/tree/DefaultTreeCellEditor.java
> ===================================================================
> --- classes/javax/swing/tree/DefaultTreeCellEditor.java (revision 250)
> +++ classes/javax/swing/tree/DefaultTreeCellEditor.java (working copy)
> @@ -60,6 +60,7 @@
> *
> * @version 1.38 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class DefaultTreeCellEditor implements ActionListener, TreeCellEditor,
> TreeSelectionListener {
> @@ -552,7 +553,7 @@
>
> // Serialization support.
> private void writeObject(ObjectOutputStream s) throws IOException {
> - Vector values = new Vector();
> + Vector<Object> values = new Vector<Object>();
>
> s.defaultWriteObject();
> // Save the realEditor, if its Serializable.
> Index: classes/javax/swing/tree/DefaultTreeModel.java
> ===================================================================
> --- classes/javax/swing/tree/DefaultTreeModel.java (revision 250)
> +++ classes/javax/swing/tree/DefaultTreeModel.java (working copy)
> @@ -49,6 +49,7 @@
> * @author Rob Davis
> * @author Ray Ryan
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class DefaultTreeModel implements Serializable, TreeModel {
> /** Root of the tree. */
> @@ -454,8 +455,7 @@
> * @since 1.4
> */
> public TreeModelListener[] getTreeModelListeners() {
> - return (TreeModelListener[])listenerList.getListeners(
> - TreeModelListener.class);
> + return listenerList.getListeners(TreeModelListener.class);
> }
>
> /**
> Index: classes/javax/swing/tree/DefaultTreeSelectionModel.java
> ===================================================================
> --- classes/javax/swing/tree/DefaultTreeSelectionModel.java (revision 250)
> +++ classes/javax/swing/tree/DefaultTreeSelectionModel.java (working copy)
> @@ -61,6 +61,7 @@
> *
> * @version 1.58 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class DefaultTreeSelectionModel extends Object implements Cloneable, Serializable, TreeSelectionModel
> {
> @@ -99,8 +100,8 @@
> /** Used to make sure the paths are unique, will contain all the paths
> * in <code>selection</code>.
> */
> - private Hashtable uniquePaths;
> - private Hashtable lastPaths;
> + private Hashtable<TreePath, Boolean> uniquePaths;
> + private Hashtable<TreePath, Boolean> lastPaths;
> private TreePath[] tempPaths;
>
>
> @@ -112,8 +113,8 @@
> listSelectionModel = new DefaultListSelectionModel();
> selectionMode = DISCONTIGUOUS_TREE_SELECTION;
> leadIndex = leadRow = -1;
> - uniquePaths = new Hashtable();
> - lastPaths = new Hashtable();
> + uniquePaths = new Hashtable<TreePath, Boolean>();
> + lastPaths = new Hashtable<TreePath, Boolean>();
> tempPaths = new TreePath[1];
> }
>
> @@ -246,7 +247,7 @@
> }
>
> TreePath beginLeadPath = leadPath;
> - Vector cPaths = new Vector(newCount + oldCount);
> + Vector<PathPlaceHolder> cPaths = new Vector<PathPlaceHolder>(newCount + oldCount);
> List<TreePath> newSelectionAsList =
> new ArrayList<TreePath>(newCount);
>
> @@ -277,7 +278,7 @@
>
> selection = newSelection;
>
> - Hashtable tempHT = uniquePaths;
> + Hashtable<TreePath, Boolean> tempHT = uniquePaths;
>
> uniquePaths = lastPaths;
> lastPaths = tempHT;
> @@ -349,7 +350,7 @@
> int counter, validCount;
> int oldCount;
> TreePath beginLeadPath = leadPath;
> - Vector cPaths = null;
> + Vector<PathPlaceHolder> cPaths = null;
>
> if(selection == null)
> oldCount = 0;
> @@ -364,7 +365,7 @@
> if (uniquePaths.get(paths[counter]) == null) {
> validCount++;
> if(cPaths == null)
> - cPaths = new Vector();
> + cPaths = new Vector<PathPlaceHolder>();
> cPaths.addElement(new PathPlaceHolder
> (paths[counter], true));
> uniquePaths.put(paths[counter], Boolean.TRUE);
> @@ -449,7 +450,7 @@
> clearSelection();
> }
> else {
> - Vector pathsToRemove = null;
> + Vector<PathPlaceHolder> pathsToRemove = null;
>
> /* Find the paths that can be removed. */
> for (int removeCounter = paths.length - 1; removeCounter >= 0;
> @@ -457,7 +458,7 @@
> if(paths[removeCounter] != null) {
> if (uniquePaths.get(paths[removeCounter]) != null) {
> if(pathsToRemove == null)
> - pathsToRemove = new Vector(paths.length);
> + pathsToRemove = new Vector<PathPlaceHolder>(paths.length);
> uniquePaths.remove(paths[removeCounter]);
> pathsToRemove.addElement(new PathPlaceHolder
> (paths[removeCounter], false));
> @@ -614,8 +615,7 @@
> * @since 1.4
> */
> public TreeSelectionListener[] getTreeSelectionListeners() {
> - return (TreeSelectionListener[])listenerList.getListeners(
> - TreeSelectionListener.class);
> + return listenerList.getListeners(TreeSelectionListener.class);
> }
>
> /**
> @@ -1082,7 +1082,7 @@
> PathPlaceHolder placeholder;
>
> for(int counter = 0; counter < cPathCount; counter++) {
> - placeholder = (PathPlaceHolder)changedPaths.elementAt(counter);
> + placeholder = changedPaths.elementAt(counter);
> newness[counter] = placeholder.isNew;
> paths[counter] = placeholder.path;
> }
> @@ -1178,8 +1178,8 @@
> clone.listenerList = new EventListenerList();
> clone.listSelectionModel = (DefaultListSelectionModel)
> listSelectionModel.clone();
> - clone.uniquePaths = new Hashtable();
> - clone.lastPaths = new Hashtable();
> + clone.uniquePaths = new Hashtable<TreePath, Boolean>();
> + clone.lastPaths = new Hashtable<TreePath, Boolean>();
> clone.tempPaths = new TreePath[1];
> return clone;
> }
> Index: classes/javax/swing/tree/FixedHeightLayoutCache.java
> ===================================================================
> --- classes/javax/swing/tree/FixedHeightLayoutCache.java (revision 250)
> +++ classes/javax/swing/tree/FixedHeightLayoutCache.java (working copy)
> @@ -47,6 +47,7 @@
> *
> * @version 1.30 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> */
>
> public class FixedHeightLayoutCache extends AbstractLayoutCache {
> @@ -65,21 +66,21 @@
> /**
> * Maps from TreePath to a FHTreeStateNode.
> */
> - private Hashtable treePathMapping;
> + private Hashtable<TreePath, FHTreeStateNode> treePathMapping;
>
> /**
> * Used for getting path/row information.
> */
> private SearchInfo info;
>
> - private Stack tempStacks;
> + private Stack<Stack<TreePath>> tempStacks;
>
>
> public FixedHeightLayoutCache() {
> super();
> - tempStacks = new Stack();
> + tempStacks = new Stack<Stack<TreePath>>();
> boundsBuffer = new Rectangle();
> - treePathMapping = new Hashtable();
> + treePathMapping = new Hashtable<TreePath, FHTreeStateNode>();
> info = new SearchInfo();
> setRowHeight(1);
> }
> @@ -593,7 +594,7 @@
> * return null, if you to create a node use getNodeForPath.
> */
> private FHTreeStateNode getMapping(TreePath path) {
> - return (FHTreeStateNode)treePathMapping.get(path);
> + return treePathMapping.get(path);
> }
>
> /**
> @@ -696,13 +697,13 @@
> return null;
>
> // Check all the parent paths, until a match is found.
> - Stack paths;
> + Stack<TreePath> paths;
>
> if(tempStacks.size() == 0) {
> - paths = new Stack();
> + paths = new Stack<TreePath>();
> }
> else {
> - paths = (Stack)tempStacks.pop();
> + paths = tempStacks.pop();
> }
>
> try {
> @@ -715,7 +716,7 @@
> // Found a match, create entries for all paths in
> // paths.
> while(node != null && paths.size() > 0) {
> - path = (TreePath)paths.pop();
> + path = paths.pop();
> node = node.createChildFor(path.
> getLastPathComponent());
> }
> Index: classes/javax/swing/tree/VariableHeightLayoutCache.java
> ===================================================================
> --- classes/javax/swing/tree/VariableHeightLayoutCache.java (revision 250)
> +++ classes/javax/swing/tree/VariableHeightLayoutCache.java (working copy)
> @@ -50,6 +50,7 @@
> * @author Rob Davis
> * @author Ray Ryan
> * @author Scott Violet
> + * @author Florian Brunner
> */
>
> public class VariableHeightLayoutCache extends AbstractLayoutCache {
> @@ -57,7 +58,7 @@
> * The array of nodes that are currently visible, in the order they
> * are displayed.
> */
> - private Vector visibleNodes;
> + private Vector<Object> visibleNodes;
>
> /**
> * This is set to true if one of the entries has an invalid size.
> @@ -80,20 +81,20 @@
> /**
> * Maps from <code>TreePath</code> to a <code>TreeStateNode</code>.
> */
> - private Hashtable treePathMapping;
> + private Hashtable<TreePath, TreeStateNode> treePathMapping;
>
> /**
> * A stack of stacks.
> */
> - private Stack tempStacks;
> + private Stack<Stack<TreePath>> tempStacks;
>
>
> public VariableHeightLayoutCache() {
> super();
> - tempStacks = new Stack();
> - visibleNodes = new Vector();
> + tempStacks = new Stack<Stack<TreePath>>();
> + visibleNodes = new Vector<Object>();
> boundsBuffer = new Rectangle();
> - treePathMapping = new Hashtable();
> + treePathMapping = new Hashtable<TreePath, TreeStateNode>();
> }
>
> /**
> @@ -705,7 +706,7 @@
> * return null, if you to create a node use getNodeForPath.
> */
> private TreeStateNode getMapping(TreePath path) {
> - return (TreeStateNode)treePathMapping.get(path);
> + return treePathMapping.get(path);
> }
>
> /**
> @@ -825,13 +826,13 @@
> }
>
> // Check all the parent paths, until a match is found.
> - Stack paths;
> + Stack<TreePath> paths;
>
> if(tempStacks.size() == 0) {
> - paths = new Stack();
> + paths = new Stack<TreePath>();
> }
> else {
> - paths = (Stack)tempStacks.pop();
> + paths = tempStacks.pop();
> }
>
> try {
> @@ -844,7 +845,7 @@
> // Found a match, create entries for all paths in
> // paths.
> while(node != null && paths.size() > 0) {
> - path = (TreePath)paths.pop();
> + path = paths.pop();
> node.getLoadedChildren(shouldCreate);
>
> int childIndex = treeModel.
> Index: classes/javax/swing/UIDefaults.java
> ===================================================================
> --- classes/javax/swing/UIDefaults.java (revision 250)
> +++ classes/javax/swing/UIDefaults.java (working copy)
> @@ -70,6 +70,7 @@
> * @see UIManager
> * @version 1.70 05/10/07
> * @author Hans Muller
> + * @author Florian Brunner
> */
> public class UIDefaults extends Hashtable<Object,Object>
> {
> @@ -77,7 +78,7 @@
>
> private SwingPropertyChangeSupport changeSupport;
>
> - private Vector resourceBundles;
> + private Vector<String> resourceBundles;
>
> private Locale defaultLocale = Locale.getDefault();
>
> @@ -87,7 +88,7 @@
> * Access to this should be done while holding a lock on the
> * UIDefaults, eg synchronized(this).
> */
> - private Map resourceCache;
> + private Map<Locale, Map<String, Object>> resourceCache;
>
> /**
> * Creates an empty defaults table.
> @@ -107,7 +108,7 @@
> */
> public UIDefaults(int initialCapacity, float loadFactor) {
> super(initialCapacity, loadFactor);
> - resourceCache = new HashMap();
> + resourceCache = new HashMap<Locale, Map<String, Object>>();
> }
>
>
> @@ -282,7 +283,7 @@
> if( defaultLocale == null )
> return null;
> else
> - l = (Locale)defaultLocale;
> + l = defaultLocale;
> }
>
> synchronized(this) {
> @@ -293,13 +294,13 @@
> /**
> * Returns a Map of the known resources for the given locale.
> */
> - private Map getResourceCache(Locale l) {
> - Map values = (Map)resourceCache.get(l);
> + private Map<String, Object> getResourceCache(Locale l) {
> + Map<String, Object> values = resourceCache.get(l);
>
> if (values == null) {
> - values = new HashMap();
> + values = new HashMap<String, Object>();
> for (int i=resourceBundles.size()-1; i >= 0; i--) {
> - String bundleName = (String)resourceBundles.get(i);
> + String bundleName = resourceBundles.get(i);
> try {
> Control c = CoreResourceBundleControl.getRBControlInstance(bundleName);
> ResourceBundle b;
> @@ -677,13 +678,13 @@
> try {
> String className = (String)get(uiClassID);
> if (className != null) {
> - Class cls = (Class)get(className);
> + Class<? extends ComponentUI> cls = (Class<? extends ComponentUI>)get(className);
> if (cls == null) {
> if (uiClassLoader == null) {
> - cls = SwingUtilities.loadSystemClass(className);
> + cls = (Class<? extends ComponentUI>)SwingUtilities.loadSystemClass(className);
> }
> else {
> - cls = uiClassLoader.loadClass(className);
> + cls = (Class<? extends ComponentUI>)uiClassLoader.loadClass(className);
> }
> if (cls != null) {
> // Save lookup for future use, as forName is slow.
> @@ -752,7 +753,7 @@
> Object cl = get("ClassLoader");
> ClassLoader uiClassLoader =
> (cl != null) ? (ClassLoader)cl : target.getClass().getClassLoader();
> - Class uiClass = getUIClass(target.getUIClassID(), uiClassLoader);
> + Class<? extends ComponentUI> uiClass = getUIClass(target.getUIClassID(), uiClassLoader);
> Object uiObject = null;
>
> if (uiClass == null) {
> @@ -762,7 +763,7 @@
> try {
> Method m = (Method)get(uiClass);
> if (m == null) {
> - Class acClass = javax.swing.JComponent.class;
> + Class<JComponent> acClass = javax.swing.JComponent.class;
> m = uiClass.getMethod("createUI", new Class[]{acClass});
> put(uiClass, m);
> }
> @@ -863,7 +864,7 @@
> return;
> }
> if( resourceBundles == null ) {
> - resourceBundles = new Vector(5);
> + resourceBundles = new Vector<String>(5);
> }
> if (!resourceBundles.contains(bundleName)) {
> resourceBundles.add( bundleName );
> @@ -1065,7 +1066,7 @@
> className = c;
> methodName = m;
> if (o != null) {
> - args = (Object[])o.clone();
> + args = o.clone();
> }
> }
>
> @@ -1080,10 +1081,10 @@
> // In order to pick up the security policy in effect at the
> // time of creation we use a doPrivileged with the
> // AccessControlContext that was in place when this was created.
> - return AccessController.doPrivileged(new PrivilegedAction() {
> + return AccessController.doPrivileged(new PrivilegedAction<Object>() {
> public Object run() {
> try {
> - Class c;
> + Class<?> c;
> Object cl;
> // See if we should use a separate ClassLoader
> if (table == null || !((cl = table.get("ClassLoader"))
> Index: classes/javax/swing/UIManager.java
> ===================================================================
> --- classes/javax/swing/UIManager.java (revision 250)
> +++ classes/javax/swing/UIManager.java (working copy)
> @@ -170,6 +170,7 @@
> * @version 1.134 06/07/07
> * @author Thomas Ball
> * @author Hans Muller
> + * @author Florian Brunner
> */
> public class UIManager implements Serializable
> {
> @@ -192,7 +193,7 @@
> MultiUIDefaults multiUIDefaults = new MultiUIDefaults(tables);
> LookAndFeel lookAndFeel;
> LookAndFeel multiLookAndFeel = null;
> - Vector auxLookAndFeels = null;
> + Vector<LookAndFeel> auxLookAndFeels = null;
> SwingPropertyChangeSupport changeSupport;
>
> UIDefaults getLookAndFeelDefaults() { return tables[0]; }
> @@ -379,7 +380,7 @@
> private static LookAndFeelInfo[] installedLAFs;
>
> static {
> - ArrayList iLAFs = new ArrayList(4);
> + ArrayList<LookAndFeelInfo> iLAFs = new ArrayList<LookAndFeelInfo>(4);
> iLAFs.add(new LookAndFeelInfo(
> "Metal", "javax.swing.plaf.metal.MetalLookAndFeel"));
> iLAFs.add(new LookAndFeelInfo("CDE/Motif",
> @@ -401,8 +402,7 @@
> iLAFs.add(new LookAndFeelInfo("GTK+",
> "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"));
> }
> - installedLAFs = (LookAndFeelInfo[])iLAFs.toArray(
> - new LookAndFeelInfo[iLAFs.size()]);
> + installedLAFs = iLAFs.toArray(new LookAndFeelInfo[iLAFs.size()]);
> }
>
>
> @@ -641,7 +641,7 @@
> * @see #getSystemLookAndFeelClassName
> */
> public static String getCrossPlatformLookAndFeelClassName() {
> - String laf = (String)AccessController.doPrivileged(
> + String laf = AccessController.doPrivileged(
> new GetPropertyAction("swing.crossplatformlaf"));
> if (laf != null) {
> return laf;
> @@ -1080,9 +1080,9 @@
> // for that.
> return;
> }
> - Vector v = getLAFState().auxLookAndFeels;
> + Vector<LookAndFeel> v = getLAFState().auxLookAndFeels;
> if (v == null) {
> - v = new Vector();
> + v = new Vector<LookAndFeel>();
> }
>
> if (!v.contains(laf)) {
> @@ -1116,7 +1116,7 @@
>
> boolean result;
>
> - Vector v = getLAFState().auxLookAndFeels;
> + Vector<LookAndFeel> v = getLAFState().auxLookAndFeels;
> if ((v == null) || (v.size() == 0)) {
> return false;
> }
> @@ -1226,7 +1226,7 @@
> final Properties props = new Properties();
>
> java.security.AccessController.doPrivileged(
> - new java.security.PrivilegedAction() {
> + new java.security.PrivilegedAction<Object>() {
> public Object run() {
> try {
> File file = new File(makeSwingPropertiesFilename());
> @@ -1285,7 +1285,7 @@
> * property. For example given "swing.installedlafs=motif,windows"
> * lafs = {"motif", "windows"}.
> */
> - Vector lafs = new Vector();
> + Vector<String> lafs = new Vector<String>();
> StringTokenizer st = new StringTokenizer(ilafsString, ",", false);
> while (st.hasMoreTokens()) {
> lafs.addElement(st.nextToken());
> @@ -1295,9 +1295,9 @@
> * list. If they both exist then add a LookAndFeelInfo to
> * the installedLafs array.
> */
> - Vector ilafs = new Vector(lafs.size());
> + Vector<LookAndFeelInfo> ilafs = new Vector<LookAndFeelInfo>(lafs.size());
> for(int i = 0; i < lafs.size(); i++) {
> - String laf = (String)lafs.elementAt(i);
> + String laf = lafs.elementAt(i);
> String name = swingProps.getProperty(makeInstalledLAFKey(laf, "name"), laf);
> String cls = swingProps.getProperty(makeInstalledLAFKey(laf, "class"));
> if (cls != null) {
> @@ -1307,7 +1307,7 @@
>
> installedLAFs = new LookAndFeelInfo[ilafs.size()];
> for(int i = 0; i < ilafs.size(); i++) {
> - installedLAFs[i] = (LookAndFeelInfo)(ilafs.elementAt(i));
> + installedLAFs[i] = ilafs.elementAt(i);
> }
> }
>
> @@ -1351,7 +1351,7 @@
> return;
> }
>
> - Vector auxLookAndFeels = new Vector();
> + Vector<LookAndFeel> auxLookAndFeels = new Vector<LookAndFeel>();
>
> StringTokenizer p = new StringTokenizer(auxLookAndFeelNames,",");
> String factoryName;
> @@ -1480,3 +1480,4 @@
> }
> }
>
> +
> Index: classes/javax/swing/undo/CompoundEdit.java
> ===================================================================
> --- classes/javax/swing/undo/CompoundEdit.java (revision 250)
> +++ classes/javax/swing/undo/CompoundEdit.java (working copy)
> @@ -32,6 +32,7 @@
> *
> * @version 1.32 05/05/07
> * @author Ray Ryan
> + * @author Florian Brunner
> */
> public class CompoundEdit extends AbstractUndoableEdit {
> /**
> @@ -60,7 +61,7 @@
> super.undo();
> int i = edits.size();
> while (i-- > 0) {
> - UndoableEdit e = (UndoableEdit)edits.elementAt(i);
> + UndoableEdit e = edits.elementAt(i);
> e.undo();
> }
> }
> @@ -86,7 +87,7 @@
> protected UndoableEdit lastEdit() {
> int count = edits.size();
> if (count > 0)
> - return (UndoableEdit)edits.elementAt(count-1);
> + return edits.elementAt(count-1);
> else
> return null;
> }
> @@ -99,7 +100,7 @@
> int size = edits.size();
> for (int i = size-1; i >= 0; i--)
> {
> - UndoableEdit e = (UndoableEdit)edits.elementAt(i);
> + UndoableEdit e = edits.elementAt(i);
> // System.out.println("CompoundEdit(" + i + "): Discarding " +
> // e.getUndoPresentationName());
> e.die();
> Index: classes/javax/swing/undo/StateEdit.java
> ===================================================================
> --- classes/javax/swing/undo/StateEdit.java (revision 250)
> +++ classes/javax/swing/undo/StateEdit.java (working copy)
> @@ -55,6 +55,7 @@
> *
> * @version 1.21 05/05/07
> * @author Ray Ryan
> + * @author Florian Brunner
> */
>
> public class StateEdit
> @@ -117,7 +118,7 @@
>
> protected void init (StateEditable anObject, String name) {
> this.object = anObject;
> - this.preState = new Hashtable(11);
> + this.preState = new Hashtable<Object, Object>(11);
> this.object.storeState(this.preState);
> this.postState = null;
> this.undoRedoName = name;
> @@ -134,7 +135,7 @@
> * ends the edit.
> */
> public void end() {
> - this.postState = new Hashtable(11);
> + this.postState = new Hashtable<Object, Object>(11);
> this.object.storeState(this.postState);
> this.removeRedundantState();
> }
> @@ -171,7 +172,7 @@
> * Remove redundant key/values in state hashtables.
> */
> protected void removeRedundantState() {
> - Vector uselessKeys = new Vector();
> + Vector<Object> uselessKeys = new Vector<Object>();
> Enumeration myKeys = preState.keys();
>
> // Locate redundant state
> Index: classes/javax/swing/undo/UndoableEditSupport.java
> ===================================================================
> --- classes/javax/swing/undo/UndoableEditSupport.java (revision 250)
> +++ classes/javax/swing/undo/UndoableEditSupport.java (working copy)
> @@ -32,6 +32,7 @@
> * A support class used for managing <code>UndoableEdit</code> listeners.
> *
> * @author Ray Ryan
> + * @author Florian Brunner
> * @version 1.27 05/05/07
> */
> public class UndoableEditSupport {
> @@ -90,8 +91,7 @@
> * @since 1.4
> */
> public synchronized UndoableEditListener[] getUndoableEditListeners() {
> - return (UndoableEditListener[])(listeners.toArray(
> - new UndoableEditListener[0]));
> + return listeners.toArray(new UndoableEditListener[0]);
> }
>
> /**
> @@ -178,3 +178,4 @@
> }
>
>
> +
> Index: classes/javax/swing/undo/UndoManager.java
> ===================================================================
> --- classes/javax/swing/undo/UndoManager.java (revision 250)
> +++ classes/javax/swing/undo/UndoManager.java (working copy)
> @@ -131,6 +131,7 @@
> * Please see {@link java.beans.XMLEncoder}.
> *
> * @author Ray Ryan
> + * @author Florian Brunner
> * @version 1.45, 05/05/07
> */
> public class UndoManager extends CompoundEdit implements UndoableEditListener {
> @@ -172,7 +173,7 @@
> UndoableEdit e = (UndoableEdit)cursor.nextElement();
> e.die();
> }
> - edits = new Vector();
> + edits = new Vector<UndoableEdit>();
> indexOfNextAdd = 0;
> // PENDING(rjrjr) when vector grows a removeRange() method
> // (expected in JDK 1.2), trimEdits() will be nice and
> @@ -241,7 +242,7 @@
> // System.out.println("Trimming " + from + " " + to + " with index " +
> // indexOfNextAdd);
> for (int i = to; from <= i; i--) {
> - UndoableEdit e = (UndoableEdit)edits.elementAt(i);
> + UndoableEdit e = edits.elementAt(i);
> // System.out.println("JUM: Discarding " +
> // e.getUndoPresentationName());
> e.die();
> @@ -294,7 +295,7 @@
> protected UndoableEdit editToBeUndone() {
> int i = indexOfNextAdd;
> while (i > 0) {
> - UndoableEdit edit = (UndoableEdit)edits.elementAt(--i);
> + UndoableEdit edit = edits.elementAt(--i);
> if (edit.isSignificant()) {
> return edit;
> }
> @@ -315,7 +316,7 @@
> int i = indexOfNextAdd;
>
> while (i < count) {
> - UndoableEdit edit = (UndoableEdit)edits.elementAt(i++);
> + UndoableEdit edit = edits.elementAt(i++);
> if (edit.isSignificant()) {
> return edit;
> }
> @@ -334,7 +335,7 @@
> protected void undoTo(UndoableEdit edit) throws CannotUndoException {
> boolean done = false;
> while (!done) {
> - UndoableEdit next = (UndoableEdit)edits.elementAt(--indexOfNextAdd);
> + UndoableEdit next = edits.elementAt(--indexOfNextAdd);
> next.undo();
> done = next == edit;
> }
> @@ -350,7 +351,7 @@
> protected void redoTo(UndoableEdit edit) throws CannotRedoException {
> boolean done = false;
> while (!done) {
> - UndoableEdit next = (UndoableEdit)edits.elementAt(indexOfNextAdd++);
> + UndoableEdit next = edits.elementAt(indexOfNextAdd++);
> next.redo();
> done = next == edit;
> }
> Index: classes/sun/swing/AccessibleMethod.java
> ===================================================================
> --- classes/sun/swing/AccessibleMethod.java (revision 250)
> +++ classes/sun/swing/AccessibleMethod.java (working copy)
> @@ -33,6 +33,7 @@
> *
> * @version 1.9 05/05/07
> * @author Shannon Hickey
> + * @author Florian Brunner
> */
> public class AccessibleMethod {
>
> @@ -115,7 +116,7 @@
>
> /** The action used to fetch the method and make it accessible */
> private static class AccessMethodAction implements PrivilegedExceptionAction<Method> {
> - private final Class klass;
> + private final Class<?> klass;
> private final String methodName;
> private final Class[] paramTypes;
>
> Index: classes/sun/swing/FilePane.java
> ===================================================================
> --- classes/sun/swing/FilePane.java (revision 250)
> +++ classes/sun/swing/FilePane.java (working copy)
> @@ -58,6 +58,7 @@
> *
> * @version 1.41, 05/09/07
> * @author Leif Samuelsson
> + * @author Florian Brunner
> */
> public class FilePane extends JPanel implements PropertyChangeListener {
> // Constants for actions. These are used for the actions' ACTION_COMMAND_KEY
> @@ -710,13 +711,13 @@
> visibleColumns.toArray(columns);
> columnMap = Arrays.copyOf(columnMap, columns.length);
>
> - List<RowSorter.SortKey> sortKeys =
> + List<? extends RowSorter.SortKey> sortKeys =
> (rowSorter == null) ? null : rowSorter.getSortKeys();
> fireTableStructureChanged();
> restoreSortKeys(sortKeys);
> }
>
> - private void restoreSortKeys(List<RowSorter.SortKey> sortKeys) {
> + private void restoreSortKeys(List<? extends RowSorter.SortKey> sortKeys) {
> if (sortKeys != null) {
> // check if preserved sortKeys are valid for this folder
> for (int i = 0; i < sortKeys.size(); i++) {
> @@ -875,7 +876,7 @@
> return rowSorter;
> }
>
> - private class DetailsTableRowSorter extends TableRowSorter {
> + private class DetailsTableRowSorter extends TableRowSorter<DetailsTableModel> {
> public DetailsTableRowSorter() {
> setModelWrapper(new SorterModelWrapper());
> }
> @@ -895,8 +896,8 @@
> updateComparators(detailsTableModel.getColumns());
> }
>
> - private class SorterModelWrapper extends ModelWrapper {
> - public Object getModel() {
> + private class SorterModelWrapper extends ModelWrapper<DetailsTableModel, Integer> {
> + public DetailsTableModel getModel() {
> return getDetailsTableModel();
> }
>
> @@ -912,7 +913,7 @@
> return FilePane.this.getModel().getElementAt(row);
> }
>
> - public Object getIdentifier(int row) {
> + public Integer getIdentifier(int row) {
> return row;
> }
> }
> @@ -923,10 +924,10 @@
> * directory and file to file using the wrapped comparator.
> */
> private class DirectoriesFirstComparatorWrapper implements Comparator<File> {
> - private Comparator comparator;
> + private Comparator<Object> comparator;
> private int column;
>
> - public DirectoriesFirstComparatorWrapper(int column, Comparator comparator) {
> + public DirectoriesFirstComparatorWrapper(int column, Comparator<Object> comparator) {
> this.column = column;
> this.comparator = comparator;
> }
> Index: classes/sun/swing/plaf/synth/DefaultSynthStyle.java
> ===================================================================
> --- classes/sun/swing/plaf/synth/DefaultSynthStyle.java (revision 250)
> +++ classes/sun/swing/plaf/synth/DefaultSynthStyle.java (working copy)
> @@ -43,6 +43,7 @@
> *
> * @version 1.31, 05/05/07
> * @author Scott Violet
> + * @author Florian Brunner
> */
> public class DefaultSynthStyle extends SynthStyle implements Cloneable {
> private static final Object PENDING = new String("Pending");
> @@ -62,7 +63,7 @@
> /**
> * User specific data.
> */
> - private Map data;
> + private Map<Object, Object> data;
>
> /**
> * Font to use if there is no matching StateInfo, or the StateInfo doesn't
> @@ -107,7 +108,7 @@
> }
> }
> if (style.data != null) {
> - data = new HashMap();
> + data = new HashMap<Object, Object>();
> data.putAll(style.data);
> }
> font = style.font;
> @@ -403,7 +404,7 @@
> }
>
>
> - private Object getKeyFromData(Map stateData, Object key) {
> + private Object getKeyFromData(Map<Object, Object> stateData, Object key) {
> Object value = null;
> if (stateData != null) {
>
> @@ -463,7 +464,7 @@
> }
> }
> if (data != null) {
> - style.data = new HashMap();
> + style.data = new HashMap<Object, Object>();
> style.data.putAll(data);
> }
> return style;
> @@ -571,7 +572,7 @@
> }
> if (data != null) {
> if (style.data == null) {
> - style.data = new HashMap();
> + style.data = new HashMap<Object, Object>();
> }
> style.data.putAll(data);
> }
> @@ -709,7 +710,7 @@
> * a component.
> */
> public static class StateInfo {
> - private Map data;
> + private Map<String, Object> data;
> private Font font;
> private Color[] colors;
> private int state;
> @@ -747,7 +748,7 @@
> this.font = info.font;
> if(info.data != null) {
> if(data == null) {
> - data = new HashMap();
> + data = new HashMap<String, Object>();
> }
> data.putAll(info.data);
> }
> @@ -837,7 +838,7 @@
> }
> if(data != null) {
> if(info.data == null) {
> - info.data = new HashMap();
> + info.data = new HashMap<String, Object>();
> }
> info.data.putAll(data);
> }
> Index: classes/sun/swing/plaf/synth/SynthFileChooserUI.java
> ===================================================================
> --- classes/sun/swing/plaf/synth/SynthFileChooserUI.java (revision 250)
> +++ classes/sun/swing/plaf/synth/SynthFileChooserUI.java (working copy)
> @@ -60,6 +60,7 @@
> * @version 1.24, 05/05/07
> * @author Leif Samuelsson
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public abstract class SynthFileChooserUI extends BasicFileChooserUI implements
> SynthUI {
> @@ -367,7 +368,7 @@
> private void updateFileNameCompletion() {
> if (fileNameCompletionString != null) {
> if (fileNameCompletionString.equals(getFileName())) {
> - File[] files = (File[])getModel().getFiles().toArray(new File[0]);
> + File[] files = getModel().getFiles().toArray(new File[0]);
> String str = getCommonStartString(files);
> if (str != null && str.startsWith(fileNameCompletionString)) {
> setFileName(str);
> Index: classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
> ===================================================================
> --- classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java (revision 250)
> +++ classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java (working copy)
> @@ -57,6 +57,7 @@
> * @version 1.15, 05/09/07
> * @author Leif Samuelsson
> * @author Jeff Dinkins
> + * @author Florian Brunner
> */
> public class SynthFileChooserUIImpl extends SynthFileChooserUI {
> private JLabel lookInLabel;
> @@ -734,7 +735,7 @@
> * Data model for a type-face selection combo-box.
> */
> protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel {
> - Vector directories = new Vector();
> + Vector<File> directories = new Vector<File>();
> int[] depths = null;
> File selectedDirectory = null;
> JFileChooser chooser = getFileChooser();
> @@ -790,7 +791,7 @@
> File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
> : canonical;
> File f = sf;
> - Vector path = new Vector(10);
> + Vector<File> path = new Vector<File>(10);
> do {
> path.addElement(f);
> } while ((f = f.getParentFile()) != null);
> @@ -798,7 +799,7 @@
> int pathCount = path.size();
> // Insert chain at appropriate place in vector
> for (int i = 0; i < pathCount; i++) {
> - f = (File)path.get(i);
> + f = path.get(i);
> if (directories.contains(f)) {
> int topIndex = directories.indexOf(f);
> for (int j = i-1; j >= 0; j--) {
> @@ -817,12 +818,12 @@
> private void calculateDepths() {
> depths = new int[directories.size()];
> for (int i = 0; i < depths.length; i++) {
> - File dir = (File)directories.get(i);
> + File dir = directories.get(i);
> File parent = dir.getParentFile();
> depths[i] = 0;
> if (parent != null) {
> for (int j = i-1; j >= 0; j--) {
> - if (parent.equals((File)directories.get(j))) {
> + if (parent.equals(directories.get(j))) {
> depths[i] = depths[j] + 1;
> break;
> }
> Index: classes/sun/swing/SwingLazyValue.java
> ===================================================================
> --- classes/sun/swing/SwingLazyValue.java (revision 250)
> +++ classes/sun/swing/SwingLazyValue.java (working copy)
> @@ -35,6 +35,8 @@
> * should never be used in a place where the developer could supply the
> * arguments.
> *
> + * @author unattributed
> + * @author Florian Brunner
> * @version 1.11 05/05/07
> */
> public class SwingLazyValue implements UIDefaults.LazyValue {
> @@ -55,13 +57,13 @@
> className = c;
> methodName = m;
> if (o != null) {
> - args = (Object[])o.clone();
> + args = o.clone();
> }
> }
>
> public Object createValue(final UIDefaults table) {
> try {
> - Class c;
> + Class<?> c;
> Object cl;
> c = Class.forName(className, true, null);
> if (methodName != null) {
> Index: classes/sun/swing/SwingUtilities2.java
> ===================================================================
> --- classes/sun/swing/SwingUtilities2.java (revision 250)
> +++ classes/sun/swing/SwingUtilities2.java (working copy)
> @@ -68,6 +68,8 @@
> * releases and even patch releases. You should not rely on this class even
> * existing.
> *
> + * @author unattributed
> + * @author Florian Brunner
> * @version 1.60 06/21/07
> */
> public class SwingUtilities2 {
> @@ -1235,9 +1237,9 @@
> private static synchronized boolean inputEvent_canAccessSystemClipboard(InputEvent ie) {
> if (inputEvent_CanAccessSystemClipboard_Field == null) {
> inputEvent_CanAccessSystemClipboard_Field =
> - (Field)AccessController.doPrivileged(
> - new java.security.PrivilegedAction() {
> - public Object run() {
> + AccessController.doPrivileged(
> + new java.security.PrivilegedAction<Field>() {
> + public Field run() {
> Field field = null;
> try {
> field = InputEvent.class.
> @@ -1415,10 +1417,10 @@
> * Class.getResourceAsStream just returns raw
> * bytes, which we can convert to an image.
> */
> - byte[] buffer = (byte[])
> + byte[] buffer =
> java.security.AccessController.doPrivileged(
> - new java.security.PrivilegedAction() {
> - public Object run() {
> + new java.security.PrivilegedAction<byte[]>() {
> + public byte[] run() {
> try {
> InputStream resource = null;
> Class<?> srchClass = baseClass;
> @@ -1485,7 +1487,7 @@
> return true;
> }
> // Else probably Solaris or Linux in which case may be remote X11
> - Class x11Class = Class.forName("sun.awt.X11GraphicsEnvironment");
> + Class<?> x11Class = Class.forName("sun.awt.X11GraphicsEnvironment");
> Method isDisplayLocalMethod = x11Class.getMethod(
> "isDisplayLocal", new Class[0]);
> return (Boolean)isDisplayLocalMethod.invoke(null, (Object[])null);
More information about the swing-dev
mailing list