]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed generics warnings
authorArtur Signell <artur.signell@itmill.com>
Mon, 28 Dec 2009 13:24:41 +0000 (13:24 +0000)
committerArtur Signell <artur.signell@itmill.com>
Mon, 28 Dec 2009 13:24:41 +0000 (13:24 +0000)
svn changeset:10553/svn branch:6.3

src/com/vaadin/data/util/FilesystemContainer.java
src/com/vaadin/data/util/IndexedContainer.java
src/com/vaadin/terminal/CompositeErrorMessage.java
src/com/vaadin/ui/AbstractComponent.java
src/com/vaadin/ui/Component.java
tests/src/com/vaadin/tests/BasicRandomTest.java

index 126e2237dd13ad6f3f75c02dff43918bc9e7599a..adcfcfe3a7810de2ec30874dff674e060a02cce5 100644 (file)
@@ -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<String> 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<String>();
         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<File> getChildren(Object itemId) {
 
         if (!(itemId instanceof File)) {
-            return Collections.unmodifiableCollection(new LinkedList());
+            return Collections.unmodifiableCollection(new LinkedList<File>());
         }
         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<File>());
         }
 
-        final List l = Arrays.asList(f);
+        final List<File> 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<File> 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<File>());
         }
 
-        final List l = Arrays.asList(f);
+        final List<File> 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<File> col, File f) {
         File[] l;
         if (filter != null) {
             l = f.listFiles(filter);
         } else {
             l = f.listFiles();
         }
-        final List ll = Arrays.asList(l);
+        final List<File> ll = Arrays.asList(l);
         Collections.sort(ll);
 
-        for (final Iterator i = ll.iterator(); i.hasNext();) {
-            final File lf = (File) i.next();
+        for (final Iterator<File> 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<File> getItemIds() {
 
         if (recursive) {
-            final Collection col = new ArrayList();
+            final Collection<File> col = new ArrayList<File>();
             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<File>());
             }
 
-            final List l = Arrays.asList(f);
+            final List<File> 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<String> 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 <code>null</code>
      */
-    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<String> getItemPropertyIds() {
             return getContainerPropertyIds();
         }
 
index c61b16bada779847264aeaa52fde16fa6435e7cb..b246a50a6b17690d5265370f56dfe9792b118d14 100644 (file)
@@ -63,7 +63,7 @@ public class IndexedContainer implements Container.Indexed,
     /**
      * Linked list of ordered Property IDs.
      */
-    private ArrayList propertyIds = new ArrayList();
+    private ArrayList<Object> propertyIds = new ArrayList<Object>();
 
     /**
      * Property ID to type mapping.
index 776e6c919c63f0462478f3b7b57e0fe48e2bd23c..e2158c81bab6f807938c32dbac0b9c4c09362a37 100644 (file)
@@ -24,7 +24,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable {
     /**
      * Array of all the errors.
      */
-    private final List errors;
+    private final List<ErrorMessage> 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<ErrorMessage>(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<ErrorMessage> errorMessages) {
+        errors = new ArrayList<ErrorMessage>(errorMessages.size());
         level = Integer.MIN_VALUE;
 
-        for (final Iterator i = errorMessages.iterator(); i.hasNext();) {
-            addErrorMessage((ErrorMessage) i.next());
+        for (final Iterator<ErrorMessage> 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<ErrorMessage> 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<ErrorMessage> 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<ErrorMessage> i = errors.iterator(); i.hasNext();) {
             if (pos > 0) {
                 retval += ",";
             }
index 68910bb686c120a9d003985be6f26b5fd84b37bf..92bf90831bfe3b7e882c475f1f73cecb3e42c262 100644 (file)
@@ -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<RepaintRequestListener> 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<RepaintRequestListener> 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<RepaintRequestListener> 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<RepaintRequestListener>();
                     }
                     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<RepaintRequestListener>();
         }
         if (!repaintRequestListeners.contains(listener)) {
             repaintRequestListeners.add(listener);
index 75d819f4b3b767873cb3b6b588eac3e37a1028ab..61df5164df4ff3d67264422b93e5e96bb2f582ed 100644 (file)
@@ -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<RepaintRequestListener> alreadyNotified);
 
     /* Component event framework */
 
     /**
      * Superclass of all component originated <code>Event</code>s.
      */
+    @SuppressWarnings("serial")
     public class Event extends EventObject {
 
         /**
index f78b0ca6737a376f14edae1102872588de91dc85..8b5a9d01ab44a1abb36d29990033e7200c7e3028 100644 (file)
@@ -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());