From: Artur Signell Date: Mon, 28 Dec 2009 13:24:41 +0000 (+0000) Subject: Fixed generics warnings X-Git-Tag: 6.7.0.beta1~2088 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=37f22730cfdd3e42b301e3a5f79653f572e262fc;p=vaadin-framework.git Fixed generics warnings svn changeset:10553/svn branch:6.3 --- diff --git a/src/com/vaadin/data/util/FilesystemContainer.java b/src/com/vaadin/data/util/FilesystemContainer.java index 126e2237dd..adcfcfe3a7 100644 --- a/src/com/vaadin/data/util/FilesystemContainer.java +++ b/src/com/vaadin/data/util/FilesystemContainer.java @@ -62,7 +62,7 @@ public class FilesystemContainer implements Container.Hierarchical { /** * List of the string identifiers for the available properties. */ - public static Collection FILE_PROPERTIES; + public static Collection FILE_PROPERTIES; private final static Method FILEITEM_LASTMODIFIED; @@ -74,7 +74,7 @@ public class FilesystemContainer implements Container.Hierarchical { static { - FILE_PROPERTIES = new ArrayList(); + FILE_PROPERTIES = new ArrayList(); FILE_PROPERTIES.add(PROPERTY_NAME); FILE_PROPERTIES.add(PROPERTY_ICON); FILE_PROPERTIES.add(PROPERTY_SIZE); @@ -201,10 +201,10 @@ public class FilesystemContainer implements Container.Hierarchical { * add a JavaDoc comment here, we use the default documentation from * implemented interface. */ - public Collection getChildren(Object itemId) { + public Collection getChildren(Object itemId) { if (!(itemId instanceof File)) { - return Collections.unmodifiableCollection(new LinkedList()); + return Collections.unmodifiableCollection(new LinkedList()); } File[] f; if (filter != null) { @@ -214,10 +214,10 @@ public class FilesystemContainer implements Container.Hierarchical { } if (f == null) { - return Collections.unmodifiableCollection(new LinkedList()); + return Collections.unmodifiableCollection(new LinkedList()); } - final List l = Arrays.asList(f); + final List l = Arrays.asList(f); Collections.sort(l); return Collections.unmodifiableCollection(l); @@ -276,7 +276,7 @@ public class FilesystemContainer implements Container.Hierarchical { * comment here, we use the default documentation from implemented * interface. */ - public Collection rootItemIds() { + public Collection rootItemIds() { File[] f; @@ -292,10 +292,10 @@ public class FilesystemContainer implements Container.Hierarchical { } if (f == null) { - return Collections.unmodifiableCollection(new LinkedList()); + return Collections.unmodifiableCollection(new LinkedList()); } - final List l = Arrays.asList(f); + final List l = Arrays.asList(f); Collections.sort(l); return Collections.unmodifiableCollection(l); @@ -392,18 +392,18 @@ public class FilesystemContainer implements Container.Hierarchical { * @param f * the root file where to start adding files */ - private void addItemIds(Collection col, File f) { + private void addItemIds(Collection col, File f) { File[] l; if (filter != null) { l = f.listFiles(filter); } else { l = f.listFiles(); } - final List ll = Arrays.asList(l); + final List ll = Arrays.asList(l); Collections.sort(ll); - for (final Iterator i = ll.iterator(); i.hasNext();) { - final File lf = (File) i.next(); + for (final Iterator i = ll.iterator(); i.hasNext();) { + final File lf = i.next(); if (lf.isDirectory()) { addItemIds(col, lf); } else { @@ -416,10 +416,10 @@ public class FilesystemContainer implements Container.Hierarchical { * Gets the IDs of Items in the filesystem. Don't add a JavaDoc comment * here, we use the default documentation from implemented interface. */ - public Collection getItemIds() { + public Collection getItemIds() { if (recursive) { - final Collection col = new ArrayList(); + final Collection col = new ArrayList(); for (int i = 0; i < roots.length; i++) { addItemIds(col, roots[i]); } @@ -437,10 +437,11 @@ public class FilesystemContainer implements Container.Hierarchical { } if (f == null) { - return Collections.unmodifiableCollection(new LinkedList()); + return Collections + .unmodifiableCollection(new LinkedList()); } - final List l = Arrays.asList(f); + final List l = Arrays.asList(f); Collections.sort(l); return Collections.unmodifiableCollection(l); } @@ -492,7 +493,7 @@ public class FilesystemContainer implements Container.Hierarchical { * * @return Unmodifiable collection containing all available file properties. */ - public Collection getContainerPropertyIds() { + public Collection getContainerPropertyIds() { return FILE_PROPERTIES; } @@ -505,7 +506,7 @@ public class FilesystemContainer implements Container.Hierarchical { * the ID of the property whose type is requested. * @return data type of the requested property, or null */ - public Class getType(Object propertyId) { + public Class getType(Object propertyId) { if (propertyId.equals(PROPERTY_NAME)) { return String.class; @@ -617,7 +618,7 @@ public class FilesystemContainer implements Container.Hierarchical { * JavaDoc comment here, we use the default documentation from * implemented interface. */ - public Collection getItemPropertyIds() { + public Collection getItemPropertyIds() { return getContainerPropertyIds(); } diff --git a/src/com/vaadin/data/util/IndexedContainer.java b/src/com/vaadin/data/util/IndexedContainer.java index c61b16bada..b246a50a6b 100644 --- a/src/com/vaadin/data/util/IndexedContainer.java +++ b/src/com/vaadin/data/util/IndexedContainer.java @@ -63,7 +63,7 @@ public class IndexedContainer implements Container.Indexed, /** * Linked list of ordered Property IDs. */ - private ArrayList propertyIds = new ArrayList(); + private ArrayList propertyIds = new ArrayList(); /** * Property ID to type mapping. diff --git a/src/com/vaadin/terminal/CompositeErrorMessage.java b/src/com/vaadin/terminal/CompositeErrorMessage.java index 776e6c919c..e2158c81ba 100644 --- a/src/com/vaadin/terminal/CompositeErrorMessage.java +++ b/src/com/vaadin/terminal/CompositeErrorMessage.java @@ -24,7 +24,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { /** * Array of all the errors. */ - private final List errors; + private final List errors; /** * Level of the error. @@ -39,7 +39,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { * ignored, but at least one message is required. */ public CompositeErrorMessage(ErrorMessage[] errorMessages) { - errors = new ArrayList(errorMessages.length); + errors = new ArrayList(errorMessages.length); level = Integer.MIN_VALUE; for (int i = 0; i < errorMessages.length; i++) { @@ -60,12 +60,13 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { * the Collection of error messages that are listed togeter. At * least one message is required. */ - public CompositeErrorMessage(Collection errorMessages) { - errors = new ArrayList(errorMessages.size()); + public CompositeErrorMessage(Collection errorMessages) { + errors = new ArrayList(errorMessages.size()); level = Integer.MIN_VALUE; - for (final Iterator i = errorMessages.iterator(); i.hasNext();) { - addErrorMessage((ErrorMessage) i.next()); + for (final Iterator i = errorMessages.iterator(); i + .hasNext();) { + addErrorMessage(i.next()); } if (errors.size() == 0) { @@ -105,7 +106,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { * * @return the error iterator. */ - public Iterator iterator() { + public Iterator iterator() { return errors.iterator(); } @@ -115,7 +116,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { public void paint(PaintTarget target) throws PaintException { if (errors.size() == 1) { - ((ErrorMessage) errors.iterator().next()).paint(target); + (errors.iterator().next()).paint(target); } else { target.startTag("error"); @@ -132,8 +133,9 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { } // Paint all the exceptions - for (final Iterator i = errors.iterator(); i.hasNext();) { - ((ErrorMessage) i.next()).paint(target); + for (final Iterator i = errors.iterator(); i + .hasNext();) { + i.next().paint(target); } target.endTag("error"); @@ -165,7 +167,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { public String toString() { String retval = "["; int pos = 0; - for (final Iterator i = errors.iterator(); i.hasNext();) { + for (final Iterator i = errors.iterator(); i.hasNext();) { if (pos > 0) { retval += ","; } diff --git a/src/com/vaadin/ui/AbstractComponent.java b/src/com/vaadin/ui/AbstractComponent.java index 68910bb686..92bf90831b 100644 --- a/src/com/vaadin/ui/AbstractComponent.java +++ b/src/com/vaadin/ui/AbstractComponent.java @@ -119,7 +119,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource /** * List of repaint request listeners or null if not listened at all. */ - private LinkedList repaintRequestListeners = null; + private LinkedList repaintRequestListeners = null; /** * Are all the repaint listeners notified about recent changes ? @@ -763,7 +763,8 @@ public abstract class AbstractComponent implements Component, MethodEventSource } /* Documentation copied from interface */ - public void childRequestedRepaint(Collection alreadyNotified) { + public void childRequestedRepaint( + Collection alreadyNotified) { // Invisible components (by flag in this particular component) do not // need repaints if (!visible) { @@ -778,7 +779,8 @@ public abstract class AbstractComponent implements Component, MethodEventSource * * @param alreadyNotified */ - private void fireRequestRepaintEvent(Collection alreadyNotified) { + private void fireRequestRepaintEvent( + Collection alreadyNotified) { // Notify listeners only once if (!repaintRequestListenersNotified) { // Notify the listeners @@ -788,12 +790,13 @@ public abstract class AbstractComponent implements Component, MethodEventSource final RepaintRequestEvent event = new RepaintRequestEvent(this); for (int i = 0; i < listeners.length; i++) { if (alreadyNotified == null) { - alreadyNotified = new LinkedList(); + alreadyNotified = new LinkedList(); } if (!alreadyNotified.contains(listeners[i])) { ((RepaintRequestListener) listeners[i]) .repaintRequested(event); - alreadyNotified.add(listeners[i]); + alreadyNotified + .add((RepaintRequestListener) listeners[i]); repaintRequestListenersNotified = true; } } @@ -810,7 +813,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource /* Documentation copied from interface */ public void addListener(RepaintRequestListener listener) { if (repaintRequestListeners == null) { - repaintRequestListeners = new LinkedList(); + repaintRequestListeners = new LinkedList(); } if (!repaintRequestListeners.contains(listener)) { repaintRequestListeners.add(listener); diff --git a/src/com/vaadin/ui/Component.java b/src/com/vaadin/ui/Component.java index 75d819f4b3..61df5164df 100644 --- a/src/com/vaadin/ui/Component.java +++ b/src/com/vaadin/ui/Component.java @@ -308,13 +308,15 @@ public interface Component extends Paintable, VariableOwner, Sizeable, * and pass it forwards. Null parameter is interpreted as empty * collection. */ - public void childRequestedRepaint(Collection alreadyNotified); + public void childRequestedRepaint( + Collection alreadyNotified); /* Component event framework */ /** * Superclass of all component originated Events. */ + @SuppressWarnings("serial") public class Event extends EventObject { /** diff --git a/tests/src/com/vaadin/tests/BasicRandomTest.java b/tests/src/com/vaadin/tests/BasicRandomTest.java index f78b0ca673..8b5a9d01ab 100644 --- a/tests/src/com/vaadin/tests/BasicRandomTest.java +++ b/tests/src/com/vaadin/tests/BasicRandomTest.java @@ -44,6 +44,7 @@ import com.vaadin.ui.Window; * @author IT Mill Ltd. * */ +@SuppressWarnings("unchecked") public class BasicRandomTest extends com.vaadin.Application implements Button.ClickListener { @@ -340,8 +341,7 @@ public class BasicRandomTest extends com.vaadin.Application implements * ErrorEvents are printed to default error stream and not in GUI. */ @Override - public void terminalError( - com.vaadin.terminal.Terminal.ErrorEvent event) { + public void terminalError(com.vaadin.terminal.Terminal.ErrorEvent event) { final Throwable e = event.getThrowable(); System.err.println(getUser().toString() + " terminalError: " + e.toString());