commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1609966 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestEventListenerList.java
Date Sat, 12 Jul 2014 16:17:53 GMT
Author: oheger
Date: Sat Jul 12 16:17:53 2014
New Revision: 1609966

URL: http://svn.apache.org/r1609966
Log:
Fixed a compilation problem with Java 1.6.

Simplified a method using complex generic type arguments.

Modified:
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestEventListenerList.java

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestEventListenerList.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestEventListenerList.java?rev=1609966&r1=1609965&r2=1609966&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestEventListenerList.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestEventListenerList.java
Sat Jul 12 16:17:53 2014
@@ -278,21 +278,19 @@ public class TestEventListenerList
     }
 
     /**
-     * Helper method for collecting the event listeners in the given iterable.
+     * Helper method for collecting the elements in the given iterable.
      *
      * @param iterable the iterable
      * @return a list with the content of the iterable
      */
-    private static <T extends Event> List<EventListener<? super T>> fetchListeners(
-            Iterable<EventListener<? super T>> iterable)
+    private static <T> List<T> fetchElements(Iterable<? extends T> iterable)
     {
-        List<EventListener<? super T>> listeners =
-                new LinkedList<EventListener<? super T>>();
-        for (EventListener<? super T> listener : iterable)
+        List<T> elems = new LinkedList<T>();
+        for (T listener : iterable)
         {
-            listeners.add(listener);
+            elems.add(listener);
         }
-        return listeners;
+        return elems;
     }
 
     /**
@@ -306,7 +304,7 @@ public class TestEventListenerList
             EventType<? extends Event> eventType,
             EventListener<?>... expListeners)
     {
-        List<?> listeners = fetchListeners(list.getEventListeners(eventType));
+        List<?> listeners = fetchElements(list.getEventListeners(eventType));
         assertEquals("Wrong number of listeners", expListeners.length,
                 listeners.size());
         assertTrue("Wrong event listeners: " + listeners,
@@ -320,7 +318,7 @@ public class TestEventListenerList
     public void testGetEventListenersNull()
     {
         assertTrue("Got listeners",
-                fetchListeners(list.getEventListeners(null)).isEmpty());
+                fetchElements(list.getEventListeners(null)).isEmpty());
     }
 
     /**



Mime
View raw message