commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ki...@apache.org
Subject svn commit: r1363514 [1/2] - in /commons/proper/functor/trunk/src: changes/ test/java/org/apache/commons/functor/ test/java/org/apache/commons/functor/core/collection/ test/java/org/apache/commons/functor/core/comparator/ test/java/org/apache/commons/f...
Date Thu, 19 Jul 2012 20:13:51 GMT
Author: kinow
Date: Thu Jul 19 20:13:49 2012
New Revision: 1363514

URL: http://svn.apache.org/viewvc?rev=1363514&view=rev
Log:
[FUNCTOR-3] Reduced the use of raw types in test classes by adding generics where needed. In some cases, specially when using arrays with generics, the warnings were suppressed. 

This commit also fixed some warnings in Eclipse. In TestAbstractLoopProcedure.MockLoopProcedure class, only the serialVersionUID was included, removing a warning. And in TestLazyMap#testBaseMapOverrides, instead of using a pair <String, String>, the test was updated to use a <String, Integer>. Although the data used in the tests is different, the behavior is still the same. And in TestIsWithinRange, one unused import was removed.

All tests passed locally, no CPD, PMD or CheckStyle problems found.

Modified:
    commons/proper/functor/trunk/src/changes/changes.xml
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/TestAlgorithms.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestFilteredIterator.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestIsElementOf.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparatorFunction.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsWithinRange.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestAbstractLoopProcedure.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryAnd.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryCompositeBinaryFunction.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryOr.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinarySequence.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestSequence.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryAnd.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryOr.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/FlexiMapExample.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BinaryChop.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestBinaryChop.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/TestLines.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FixedSizeMap.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FunctoredMap.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/LazyMap.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/PredicatedMap.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestFixedSizeMap.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestLazyMap.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/TestPredicatedMap.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/TestIteratorToGeneratorAdapter.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java

Modified: commons/proper/functor/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/changes/changes.xml?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/changes/changes.xml (original)
+++ commons/proper/functor/trunk/src/changes/changes.xml Thu Jul 19 20:13:49 2012
@@ -23,6 +23,9 @@
   </properties>
   <body>
     <release version="1.0" date="2012-??-??" description="First release.">
+      <action dev="kinow" issue="FUNCTOR-3">
+        Reduce the use of raw types in test classes.
+      </action>
       <action dev="kinow" issue="FUNCTOR-21">
         Fix NPE in UnarySequence.
       </action>

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/TestAlgorithms.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/TestAlgorithms.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/TestAlgorithms.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/TestAlgorithms.java Thu Jul 19 20:13:49 2012
@@ -28,9 +28,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.commons.functor.adapter.LeftBoundPredicate;
 import org.apache.commons.functor.core.Identity;
-import org.apache.commons.functor.core.IsEqual;
 import org.apache.commons.functor.core.composite.UnaryNot;
 import org.apache.commons.functor.generator.FilteredGenerator;
 import org.apache.commons.functor.generator.Generator;
@@ -44,7 +42,6 @@ import org.junit.Test;
 /**
  * @version $Revision$ $Date$
  */
-@SuppressWarnings("unchecked")
 public class TestAlgorithms {
 
     // Lifecycle
@@ -52,10 +49,10 @@ public class TestAlgorithms {
 
     @Before
     public void setUp() throws Exception {
-        list = new ArrayList();
-        evens = new ArrayList();
-        doubled = new ArrayList();
-        listWithDuplicates = new ArrayList();
+        list = new ArrayList<Integer>();
+        evens = new ArrayList<Integer>();
+        doubled = new ArrayList<Integer>();
+        listWithDuplicates = new ArrayList<Integer>();
         sum = 0;
         for (int i=0;i<10;i++) {
             list.add(new Integer(i));
@@ -91,45 +88,45 @@ public class TestAlgorithms {
 
     @Test
     public void testSelect1() {
-        Collection result = new FilteredGenerator(IteratorToGeneratorAdapter.adapt(list.iterator()),isEven).toCollection();
+        Collection<Integer> result = new FilteredGenerator<Integer>(IteratorToGeneratorAdapter.adapt(list.iterator()),isEven).toCollection();
         assertNotNull(result);
         assertEquals(evens,result);
     }
 
     @Test
     public void testSelect2() {
-        ArrayList result = new ArrayList();
-        assertSame(result,new FilteredGenerator(IteratorToGeneratorAdapter.adapt(list.iterator()),isEven).to(result));
+        List<Integer> result = new ArrayList<Integer>();
+        assertSame(result,new FilteredGenerator<Integer>(IteratorToGeneratorAdapter.adapt(list.iterator()),isEven).to(result));
         assertEquals(evens,result);
     }
 
     @Test
     public void testReject1() {
-        Collection result = new FilteredGenerator(IteratorToGeneratorAdapter.adapt(list.iterator()),new UnaryNot(isOdd)).toCollection();
+        Collection<Integer> result = new FilteredGenerator<Integer>(IteratorToGeneratorAdapter.adapt(list.iterator()),new UnaryNot<Integer>(isOdd)).toCollection();
         assertNotNull(result);
         assertEquals(evens,result);
     }
 
     @Test
     public void testReject2() {
-        ArrayList result = new ArrayList();
-        assertSame(result,new FilteredGenerator(IteratorToGeneratorAdapter.adapt(list.iterator()),new UnaryNot(isOdd)).to(result));
+        List<Object> result = new ArrayList<Object>();
+        assertSame(result,new FilteredGenerator<Integer>(IteratorToGeneratorAdapter.adapt(list.iterator()),new UnaryNot<Integer>(isOdd)).to(result));
         assertEquals(evens,result);
     }
 
     @Test
     public void testApplyToGenerator() {
-        Generator gen = new IntegerRange(1,5);
+        Generator<Integer> gen = new IntegerRange(1,5);
         Summer summer = new Summer();
 
-        new TransformedGenerator(gen, new Doubler()).run(summer);
+        new TransformedGenerator<Integer, Integer>(gen, new Doubler()).run(summer);
 
         assertEquals(2*(1+2+3+4),summer.sum);
     }
 
     @Test
     public void testApply() {
-        Collection result = new TransformedGenerator(IteratorToGeneratorAdapter.adapt(list.iterator()), new Doubler())
+        Collection<Integer> result = new TransformedGenerator<Integer, Integer>(IteratorToGeneratorAdapter.adapt(list.iterator()), new Doubler())
                 .toCollection();
         assertNotNull(result);
         assertEquals(doubled,result);
@@ -137,43 +134,41 @@ public class TestAlgorithms {
 
     @Test
     public void testApply2() {
-        Set set = new HashSet();
-        assertSame(set, new TransformedGenerator(IteratorToGeneratorAdapter.adapt(list.iterator()), Identity.instance())
+        Set<Integer> set = new HashSet<Integer>();
+        assertSame(set, new TransformedGenerator<Integer, Integer>(IteratorToGeneratorAdapter.adapt(list.iterator()), Identity.<Integer>instance())
                 .to(set));
         assertEquals(list.size(),set.size());
-        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
+        for (Iterator<Integer> iter = list.iterator(); iter.hasNext(); ) {
             assertTrue(set.contains(iter.next()));
         }
     }
 
     @Test
     public void testApply3() {
-        Set set = new HashSet();
-        assertSame(set, new TransformedGenerator(IteratorToGeneratorAdapter.adapt(listWithDuplicates.iterator()),
+        Set<Object> set = new HashSet<Object>();
+        assertSame(set, new TransformedGenerator<Object, Object>(IteratorToGeneratorAdapter.adapt(listWithDuplicates.iterator()),
                 Identity.instance()).to(set));
         assertTrue(listWithDuplicates.size() > set.size());
-        for (Iterator iter = listWithDuplicates.iterator(); iter.hasNext(); ) {
+        for (Iterator<Integer> iter = listWithDuplicates.iterator(); iter.hasNext(); ) {
             assertTrue(set.contains(iter.next()));
         }
     }
 
     // Attributes
     // ------------------------------------------------------------------------
-    private List list = null;
-    private List doubled = null;
-    private List evens = null;
-    private List listWithDuplicates = null;
+    private List<Integer> list = null;
+    private List<Integer> doubled = null;
+    private List<Integer> evens = null;
+    private List<Integer> listWithDuplicates = null;
     private int sum = 0;
-    private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(3));
-    private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(23));
-    private UnaryPredicate isEven = new UnaryPredicate() {
-        public boolean test(Object obj) {
-            return ((Number) obj).intValue() % 2 == 0;
+    private UnaryPredicate<Integer> isEven = new UnaryPredicate<Integer>() {
+        public boolean test(Integer obj) {
+            return obj.intValue() % 2 == 0;
         }
     };
-    private UnaryPredicate isOdd = new UnaryPredicate() {
-        public boolean test(Object obj) {
-            return ((Number) obj).intValue() % 2 != 0;
+    private UnaryPredicate<Integer> isOdd = new UnaryPredicate<Integer>() {
+        public boolean test(Integer obj) {
+            return obj.intValue() % 2 != 0;
         }
     };
 
@@ -187,16 +182,16 @@ public class TestAlgorithms {
         public int count = 0;
     }
 
-    static class Summer implements UnaryProcedure {
-        public void run(Object that) {
-            sum += ((Number) that).intValue();
+    static class Summer implements UnaryProcedure<Integer> {
+        public void run(Integer that) {
+            sum += that.intValue();
         }
         public int sum = 0;
     }
 
-    static class Doubler implements UnaryFunction {
-        public Object evaluate(Object obj) {
-            return new Integer(2*((Number) obj).intValue());
+    static class Doubler implements UnaryFunction<Integer, Integer> {
+        public Integer evaluate(Integer obj) {
+            return new Integer(2* obj.intValue());
         }
     }
 }

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestFilteredIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestFilteredIterator.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestFilteredIterator.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestFilteredIterator.java Thu Jul 19 20:13:49 2012
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
@@ -38,20 +37,19 @@ import org.junit.Test;
 /**
  * @version $Revision$ $Date$
  */
-@SuppressWarnings("unchecked")
 public class TestFilteredIterator extends BaseFunctorTest {
 
     @Override
     public Object makeFunctor() {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         list.add("xyzzy");
         return FilteredIterator.filter(list.iterator(),Constant.truePredicate());
     }
 
     @Before
     public void setUp() throws Exception {
-        list = new ArrayList();
-        evens = new ArrayList();
+        list = new ArrayList<Integer>();
+        evens = new ArrayList<Integer>();
         for (int i=0;i<10;i++) {
             list.add(new Integer(i));
             if (i%2 == 0) {
@@ -71,8 +69,8 @@ public class TestFilteredIterator extend
 
     @Test
     public void testSomePass() {
-        Iterator expected = evens.iterator();
-        Iterator testing = new FilteredIterator(list.iterator(),isEven);
+        Iterator<Integer> expected = evens.iterator();
+        Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(),isEven);
         while(expected.hasNext()) {
             assertTrue(testing.hasNext());
             assertEquals(expected.next(),testing.next());
@@ -82,8 +80,8 @@ public class TestFilteredIterator extend
 
     @Test
     public void testAllPass() {
-        Iterator expected = evens.iterator();
-        Iterator testing = new FilteredIterator(evens.iterator(),isEven);
+        Iterator<Integer> expected = list.iterator();
+        Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(),Constant.truePredicate());
         while(expected.hasNext()) {
             assertTrue(testing.hasNext());
             assertEquals(expected.next(),testing.next());
@@ -93,8 +91,8 @@ public class TestFilteredIterator extend
 
     @Test
     public void testAllPass2() {
-        Iterator expected = list.iterator();
-        Iterator testing = new FilteredIterator(list.iterator(),Constant.truePredicate());
+        Iterator<Integer> expected = list.iterator();
+        Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(),Constant.truePredicate());
         while(expected.hasNext()) {
             assertTrue(testing.hasNext());
             assertEquals(expected.next(),testing.next());
@@ -104,20 +102,20 @@ public class TestFilteredIterator extend
 
     @Test
     public void testEmptyList() {
-        Iterator testing = new FilteredIterator(Collections.EMPTY_LIST.iterator(),isEven);
+        Iterator<Integer> testing = new FilteredIterator<Integer>(new ArrayList<Integer>().iterator(),isEven);
         assertTrue(!testing.hasNext());
     }
 
     @Test
     public void testNonePass() {
-        Iterator testing = new FilteredIterator(Collections.EMPTY_LIST.iterator(),Constant.falsePredicate());
+        Iterator<Integer> testing = new FilteredIterator<Integer>(new ArrayList<Integer>().iterator(),Constant.falsePredicate());
         assertTrue(!testing.hasNext());
     }
 
     @Test
     public void testNextWithoutHasNext() {
-        Iterator testing = new FilteredIterator(list.iterator(),isEven);
-        Iterator expected = evens.iterator();
+        Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(),isEven);
+        Iterator<Integer> expected = evens.iterator();
         while(expected.hasNext()) {
             assertEquals(expected.next(),testing.next());
         }
@@ -126,8 +124,8 @@ public class TestFilteredIterator extend
 
     @Test
     public void testNextAfterEndOfList() {
-        Iterator testing = new FilteredIterator(list.iterator(),isEven);
-        Iterator expected = evens.iterator();
+        Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(),isEven);
+        Iterator<Integer> expected = evens.iterator();
         while(expected.hasNext()) {
             assertEquals(expected.next(),testing.next());
         }
@@ -141,7 +139,7 @@ public class TestFilteredIterator extend
 
     @Test
     public void testNextOnEmptyList() {
-        Iterator testing = new FilteredIterator(Collections.EMPTY_LIST.iterator(),isEven);
+        Iterator<Integer> testing = new FilteredIterator<Integer>(new ArrayList<Integer>().iterator(),isEven);
         try {
             testing.next();
             fail("ExpectedNoSuchElementException");
@@ -152,7 +150,7 @@ public class TestFilteredIterator extend
 
     @Test
     public void testRemoveBeforeNext() {
-        Iterator testing = new FilteredIterator(list.iterator(),isEven);
+        Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(),isEven);
         try {
             testing.remove();
             fail("IllegalStateException");
@@ -163,7 +161,7 @@ public class TestFilteredIterator extend
 
     @Test
     public void testRemoveAfterNext() {
-        Iterator testing = new FilteredIterator(list.iterator(),isEven);
+        Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(),isEven);
         testing.next();
         testing.remove();
         try {
@@ -176,19 +174,19 @@ public class TestFilteredIterator extend
 
     @Test
     public void testRemoveSome() {
-        Iterator testing = new FilteredIterator(list.iterator(),isEven);
+        Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(),isEven);
         while(testing.hasNext()) {
             testing.next();
             testing.remove();
         }
-        for (Iterator iter = list.iterator(); iter.hasNext();) {
+        for (Iterator<Integer> iter = list.iterator(); iter.hasNext();) {
             assertTrue(! isEven.test(iter.next()) );
         }
     }
 
     @Test
     public void testRemoveAll() {
-        Iterator testing = new FilteredIterator(list.iterator(),Constant.truePredicate());
+        Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(),Constant.truePredicate());
         while(testing.hasNext()) {
             testing.next();
             testing.remove();
@@ -198,7 +196,7 @@ public class TestFilteredIterator extend
 
     @Test
     public void testRemoveWithoutHasNext() {
-        Iterator testing = new FilteredIterator(list.iterator(),Constant.truePredicate());
+        Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(),Constant.truePredicate());
         for (int i=0,m = list.size();i<m;i++) {
             testing.next();
             testing.remove();
@@ -213,32 +211,32 @@ public class TestFilteredIterator extend
 
     @Test
     public void testFilterWithNullPredicateReturnsIdentity() {
-        Iterator iter = list.iterator();
+        Iterator<Integer> iter = list.iterator();
         assertSame(iter,FilteredIterator.filter(iter,null));
     }
 
     @Test(expected = NullPointerException.class)
     public void testConstructorProhibitsNull() {
-        new FilteredIterator(null,null);
+        new FilteredIterator<Integer>(null,null);
     }
 
     @Test(expected = NullPointerException.class)
     public void testConstructorProhibitsNull2() {
-        new FilteredIterator(null,Constant.truePredicate());
+        new FilteredIterator<Integer>(null,Constant.truePredicate());
     }
 
     @Test(expected = NullPointerException.class)
     public void testConstructorProhibitsNull3() {
-        new FilteredIterator(list.iterator(),null);
+        new FilteredIterator<Integer>(list.iterator(),null);
     }
 
     // Attributes
     // ------------------------------------------------------------------------
-    private List list = null;
-    private List evens = null;
-    private UnaryPredicate isEven = new UnaryPredicate() {
-        public boolean test(Object obj) {
-            return ((Number) obj).intValue() % 2 == 0;
+    private List<Integer> list = null;
+    private List<Integer> evens = null;
+    private UnaryPredicate<Integer> isEven = new UnaryPredicate<Integer>() {
+        public boolean test(Integer obj) {
+            return obj.intValue() % 2 == 0;
         }
     };
 

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestIsElementOf.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestIsElementOf.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestIsElementOf.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestIsElementOf.java Thu Jul 19 20:13:49 2012
@@ -21,6 +21,8 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
 
 import org.apache.commons.functor.BaseFunctorTest;
 import org.apache.commons.functor.UnaryPredicate;
@@ -30,7 +32,6 @@ import org.junit.Test;
 /**
  * @version $Revision$ $Date$
  */
-@SuppressWarnings("unchecked")
 public class TestIsElementOf extends BaseFunctorTest {
 
     // Functor Testing Framework
@@ -38,7 +39,7 @@ public class TestIsElementOf extends Bas
 
     @Override
     protected Object makeFunctor() {
-        return new IsElementOf();
+        return new IsElementOf<Integer, Collection<Integer>>();
     }
 
     // Tests
@@ -46,12 +47,12 @@ public class TestIsElementOf extends Bas
 
     @Test
     public void testTestCollection() throws Exception {
-        ArrayList list = new ArrayList();
+        List<Integer> list = new ArrayList<Integer>();
         list.add(new Integer(5));
         list.add(new Integer(10));
         list.add(new Integer(15));
 
-        UnaryPredicate p = IsElementOf.instance(list);
+        UnaryPredicate<Integer> p = IsElementOf.instance(list);
         assertTrue(p.test(new Integer(5)));
         assertTrue(p.test(new Integer(10)));
         assertTrue(p.test(new Integer(15)));
@@ -65,7 +66,7 @@ public class TestIsElementOf extends Bas
     public void testTestArray() throws Exception {
         int[] list = new int[] { 5, 10, 15 };
 
-        UnaryPredicate p = IsElementOf.instance(list);
+        UnaryPredicate<Integer> p = IsElementOf.instance(list);
         assertTrue(p.test(new Integer(5)));
         assertTrue(p.test(new Integer(10)));
         assertTrue(p.test(new Integer(15)));
@@ -118,9 +119,9 @@ public class TestIsElementOf extends Bas
 
     @Test
     public void testEquals() throws Exception {
-        IsElementOf p1 = new IsElementOf();
+        IsElementOf<Integer, Collection<Integer>> p1 = new IsElementOf<Integer, Collection<Integer>>();
         assertObjectsAreEqual(p1, p1);
-        assertObjectsAreEqual(p1, new IsElementOf());
+        assertObjectsAreEqual(p1, new IsElementOf<Integer, Collection<Integer>>());
         assertObjectsAreEqual(p1, IsElementOf.instance());
         assertSame(IsElementOf.instance(), IsElementOf.instance());
         assertObjectsAreNotEqual(p1, Constant.falsePredicate());

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparatorFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparatorFunction.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparatorFunction.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparatorFunction.java Thu Jul 19 20:13:49 2012
@@ -79,7 +79,7 @@ public class TestComparatorFunction exte
     public void testEquals() {
         ComparatorFunction<Comparable<?>> f = ComparatorFunction.instance();
         assertObjectsAreEqual(f,f);
-        assertObjectsAreEqual(f,new ComparatorFunction<Comparable<?>>(ComparableComparator.instance()));
-        assertObjectsAreNotEqual(f,new ComparatorFunction(Collections.reverseOrder()));
+        assertObjectsAreEqual(f,new ComparatorFunction<Comparable<?>>(ComparableComparator.INSTANCE));
+        assertObjectsAreNotEqual(f,new ComparatorFunction<Boolean>(Collections.reverseOrder()));
     }
 }

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsWithinRange.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsWithinRange.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsWithinRange.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsWithinRange.java Thu Jul 19 20:13:49 2012
@@ -18,7 +18,6 @@ package org.apache.commons.functor.core.
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import org.apache.commons.functor.BaseFunctorTest;
 import org.junit.Test;

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestAbstractLoopProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestAbstractLoopProcedure.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestAbstractLoopProcedure.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestAbstractLoopProcedure.java Thu Jul 19 20:13:49 2012
@@ -55,6 +55,7 @@ public class TestAbstractLoopProcedure e
 }
 
 class MockLoopProcedure extends AbstractLoopProcedure {
+    private static final long serialVersionUID = 1L;
     public MockLoopProcedure(Predicate condition, Procedure action) {
         super(condition,action);
     }

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryAnd.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryAnd.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryAnd.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryAnd.java Thu Jul 19 20:13:49 2012
@@ -27,6 +27,7 @@ import org.junit.Test;
 /**
  * @version $Revision$ $Date$
  */
+@SuppressWarnings("unchecked")
 public class TestBinaryAnd extends BaseFunctorTest {
 
     // Functor Testing Framework

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryCompositeBinaryFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryCompositeBinaryFunction.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryCompositeBinaryFunction.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryCompositeBinaryFunction.java Thu Jul 19 20:13:49 2012
@@ -46,9 +46,8 @@ public class TestBinaryCompositeBinaryFu
     // ------------------------------------------------------------------------
 
     @Test
-    @SuppressWarnings("unchecked")
     public void testEvaluateRaw() throws Exception {
-        BinaryFunction f = new BinaryCompositeBinaryFunction(
+        BinaryFunction<Object, Object, Object> f = new BinaryCompositeBinaryFunction<Object, Object, Object>(
                 RightIdentity.FUNCTION,
                 Constant.of("K"),
                 RightIdentity.FUNCTION);

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryOr.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryOr.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryOr.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinaryOr.java Thu Jul 19 20:13:49 2012
@@ -27,6 +27,7 @@ import org.junit.Test;
 /**
  * @version $Revision$ $Date$
  */
+@SuppressWarnings("unchecked")
 public class TestBinaryOr extends BaseFunctorTest {
 
     // Functor Testing Framework

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinarySequence.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinarySequence.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinarySequence.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestBinarySequence.java Thu Jul 19 20:13:49 2012
@@ -37,7 +37,7 @@ public class TestBinarySequence extends 
 
     @Override
     protected Object makeFunctor() {
-        return new BinarySequence(new NoOp(),new NoOp());
+        return new BinarySequence<String, String>(new NoOp(),new NoOp());
     }
 
     // Tests
@@ -45,7 +45,7 @@ public class TestBinarySequence extends 
 
     @Test
     public void testRunZero() throws Exception {
-        BinarySequence seq = new BinarySequence();
+        BinarySequence<String, String> seq = new BinarySequence<String, String>();
         seq.run(null,null);
         seq.run("xyzzy","xyzzy");
     }
@@ -53,7 +53,7 @@ public class TestBinarySequence extends 
     @Test
     public void testRunOne() throws Exception {
         RunCounter counter = new RunCounter();
-        BinarySequence seq = new BinarySequence(counter);
+        BinarySequence<String, String> seq = new BinarySequence<String, String>(counter);
         assertEquals(0,counter.count);
         seq.run(null,null);
         assertEquals(1,counter.count);
@@ -64,7 +64,7 @@ public class TestBinarySequence extends 
     @Test
     public void testRunTwo() throws Exception {
         RunCounter[] counter = { new RunCounter(), new RunCounter() };
-        BinarySequence seq = new BinarySequence(counter[0],counter[1]);
+        BinarySequence<String, String> seq = new BinarySequence<String, String>(counter[0],counter[1]);
         assertEquals(0,counter[0].count);
         assertEquals(0,counter[1].count);
         seq.run(null,null);
@@ -77,8 +77,8 @@ public class TestBinarySequence extends 
 
     @Test
     public void testThen() throws Exception {
-        List list = new ArrayList();
-        BinarySequence seq = new BinarySequence();
+        List<RunCounter> list = new ArrayList<RunCounter>();
+        BinarySequence<String, String> seq = new BinarySequence<String, String>();
         seq.run(null,null);
         for (int i=0;i<10;i++) {
             RunCounter counter = new RunCounter();
@@ -93,9 +93,9 @@ public class TestBinarySequence extends 
 
     @Test
     public void testEquals() throws Exception {
-        BinarySequence p = new BinarySequence();
+        BinarySequence<String, String> p = new BinarySequence<String, String>();
         assertEquals(p,p);
-        BinarySequence q = new BinarySequence();
+        BinarySequence<String, String> q = new BinarySequence<String, String>();
         assertObjectsAreEqual(p,q);
 
         for (int i=0;i<3;i++) {
@@ -103,9 +103,9 @@ public class TestBinarySequence extends 
             assertObjectsAreNotEqual(p,q);
             q.then(new NoOp());
             assertObjectsAreEqual(p,q);
-            p.then(new BinarySequence(new NoOp(),new NoOp()));
+            p.then(new BinarySequence<String, String>(new NoOp(),new NoOp()));
             assertObjectsAreNotEqual(p,q);
-            q.then(new BinarySequence(new NoOp(),new NoOp()));
+            q.then(new BinarySequence<String, String>(new NoOp(),new NoOp()));
             assertObjectsAreEqual(p,q);
         }
 
@@ -115,8 +115,8 @@ public class TestBinarySequence extends 
     // Classes
     // ------------------------------------------------------------------------
 
-    static class RunCounter implements BinaryProcedure {
-        public void run(Object a, Object b) {
+    static class RunCounter implements BinaryProcedure<String, String> {
+        public void run(String a, String b) {
             count++;
         }
         public int count = 0;

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java Thu Jul 19 20:13:49 2012
@@ -19,7 +19,6 @@ package org.apache.commons.functor.core.
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import org.apache.commons.functor.BaseFunctorTest;
 import org.apache.commons.functor.core.Constant;
@@ -49,9 +48,8 @@ public class TestCompositeUnaryPredicate
     }
 
     @Test(expected = NullPointerException.class)
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public void testNullNotAllowed() throws Exception {
-        new CompositeUnaryPredicate(null);
+        new CompositeUnaryPredicate<Object>(null);
     }
 
     @Test(expected = NullPointerException.class)

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java Thu Jul 19 20:13:49 2012
@@ -44,10 +44,9 @@ public class TestCompositeUnaryProcedure
         Composite.procedure(NoOp.instance(), Identity.instance()).run(null);
     }
 
-    @SuppressWarnings("unchecked")
     public void testNullNotAllowed() throws Exception {
         try {
-            new CompositeUnaryProcedure(null);
+            new CompositeUnaryProcedure<Object>(null);
             fail("Expected IllegalArgumentException");
         } catch(IllegalArgumentException e) {
             // expected

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestSequence.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestSequence.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestSequence.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestSequence.java Thu Jul 19 20:13:49 2012
@@ -29,7 +29,6 @@ import org.junit.Test;
 /**
  * @version $Revision$ $Date$
  */
-@SuppressWarnings("unchecked")
 public class TestSequence extends BaseFunctorTest {
 
     // Functor Testing Framework
@@ -71,7 +70,7 @@ public class TestSequence extends BaseFu
 
     @Test
     public void testThen() throws Exception {
-        List list = new ArrayList();
+        List<RunCounter> list = new ArrayList<RunCounter>();
         Sequence seq = new Sequence();
         seq.run();
         for (int i=0;i<10;i++) {

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryAnd.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryAnd.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryAnd.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryAnd.java Thu Jul 19 20:13:49 2012
@@ -28,6 +28,7 @@ import org.junit.Test;
 /**
  * @version $Revision$ $Date$
  */
+@SuppressWarnings("unchecked")
 public class TestUnaryAnd extends BaseFunctorTest {
 
     // Functor Testing Framework

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryOr.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryOr.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryOr.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/composite/TestUnaryOr.java Thu Jul 19 20:13:49 2012
@@ -27,6 +27,7 @@ import org.junit.Test;
 /**
  * @version $Revision$ $Date$
  */
+@SuppressWarnings("unchecked")
 public class TestUnaryOr extends BaseFunctorTest {
 
     // Functor Testing Framework

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/FlexiMapExample.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/FlexiMapExample.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/FlexiMapExample.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/FlexiMapExample.java Thu Jul 19 20:13:49 2012
@@ -60,7 +60,6 @@ import org.junit.Test;
 /**
  * @version $Revision$ $Date$
  */
-@SuppressWarnings("unchecked")
 public class FlexiMapExample {
 
     /*
@@ -84,7 +83,7 @@ public class FlexiMapExample {
     @Test
     public void testBasicMap() {
         /* (We'll define these make*Map functions below.) */
-        Map map = makeBasicMap();
+        Map<Object, Object> map = makeBasicMap();
         Object key = "key";
         Object value = new Integer(3);
         map.put(key,value);
@@ -97,7 +96,7 @@ public class FlexiMapExample {
      */
     @Test
     public void testBasicMapReturnsNullForMissingKey() {
-        Map map = makeBasicMap();
+        Map<Object, Object> map = makeBasicMap();
         assertNull( map.get("key") );
     }
 
@@ -107,7 +106,7 @@ public class FlexiMapExample {
      */
     @Test
     public void testBasicMapAllowsNull() {
-        Map map = makeBasicMap();
+        Map<Object, Object> map = makeBasicMap();
         Object key = "key";
         Object value = null;
         map.put(key,value);
@@ -120,7 +119,7 @@ public class FlexiMapExample {
      */
     @Test
     public void testBasicMapAllowsMultipleTypes() {
-        Map map = makeBasicMap();
+        Map<Object, Object> map = makeBasicMap();
         map.put("key-1","value-1");
         map.put(new Integer(2),"value-2");
         map.put("key-3",new Integer(3));
@@ -139,7 +138,7 @@ public class FlexiMapExample {
      */
     @Test
     public void testBasicMapStoresOnlyOneValuePerKey() {
-        Map map = makeBasicMap();
+        Map<Object, Object> map = makeBasicMap();
 
         assertNull( map.put("key","value-1") );
         assertEquals("value-1", map.get("key") );
@@ -157,7 +156,7 @@ public class FlexiMapExample {
      */
     @Test
     public void testForbidNull() {
-        Map map = makeNullForbiddenMap();
+        Map<Object, Object> map = makeNullForbiddenMap();
 
         map.put("key","value");
         map.put("key2", new Integer(2) );
@@ -178,7 +177,7 @@ public class FlexiMapExample {
      */
     @Test
     public void testNullDefaultsToZero() {
-        Map map = makeDefaultValueForNullMap(new Integer(0));
+        Map<Object, Object> map = makeDefaultValueForNullMap(new Integer(0));
         /*
          * We expect 0 when no value has been associated with "key".
          */
@@ -196,7 +195,7 @@ public class FlexiMapExample {
      */
     @Test
     public void testIntegerValuesOnly() {
-        Map map = makeTypeConstrainedMap(Integer.class);
+        Map<Object, Object> map = makeTypeConstrainedMap(Integer.class);
         map.put("key", new Integer(2));
         assertEquals( new Integer(2), map.get("key") );
         try {
@@ -216,14 +215,15 @@ public class FlexiMapExample {
      * with a key adds to that collection, rather than overwriting the
      * previous value:
      */
+    @SuppressWarnings("unchecked")
     @Test
     public void testMultiMap() {
-        Map map = makeMultiMap();
+        Map<Object, Object> map = makeMultiMap();
 
         map.put("key", "value 1");
 
         {
-            Collection result = (Collection)(map.get("key"));
+            Collection<Object> result = (Collection<Object>)(map.get("key"));
             assertEquals(1,result.size());
             assertEquals("value 1", result.iterator().next());
         }
@@ -231,9 +231,9 @@ public class FlexiMapExample {
         map.put("key", "value 2");
 
         {
-            Collection result = (Collection)(map.get("key"));
+            Collection<Object> result = (Collection<Object>)(map.get("key"));
             assertEquals(2,result.size());
-            Iterator iter = result.iterator();
+            Iterator<Object> iter = result.iterator();
             assertEquals("value 1", iter.next());
             assertEquals("value 2", iter.next());
         }
@@ -241,9 +241,9 @@ public class FlexiMapExample {
         map.put("key", "value 3");
 
         {
-            Collection result = (Collection)(map.get("key"));
+            Collection<Object> result = (Collection<Object>)(map.get("key"));
             assertEquals(3,result.size());
-            Iterator iter = result.iterator();
+            Iterator<Object> iter = result.iterator();
             assertEquals("value 1", iter.next());
             assertEquals("value 2", iter.next());
             assertEquals("value 3", iter.next());
@@ -260,7 +260,7 @@ public class FlexiMapExample {
      */
     @Test
     public void testStringConcatMap() {
-        Map map = makeStringConcatMap();
+        Map<Object, Object> map = makeStringConcatMap();
         map.put("key", "value 1");
         assertEquals("value 1",map.get("key"));
         map.put("key", "value 2");
@@ -283,7 +283,7 @@ public class FlexiMapExample {
      * primary Map.put and Map.get methods here, although the remaining
      * Map methods could be handled similiarly.
      */
-    static class FlexiMap implements Map {
+    static class FlexiMap implements Map<Object, Object> {
 
         /*
          * Our FlexiMap will accept two BinaryFunctions, one
@@ -291,10 +291,10 @@ public class FlexiMapExample {
          * and one that's used to transforms objects being retrieved
          * from the map.
          */
-        public FlexiMap(BinaryFunction putfn, BinaryFunction getfn) {
+        public FlexiMap(BinaryFunction<Object, Object, Object> putfn, BinaryFunction<Object, Object, Object> getfn) {
             onPut = null == putfn ? RightIdentity.function() : putfn;
             onGet = null == getfn ? RightIdentity.function() : getfn;
-            proxiedMap = new HashMap();
+            proxiedMap = new HashMap<Object, Object>();
         }
 
 
@@ -338,7 +338,7 @@ public class FlexiMapExample {
             throw new UnsupportedOperationException("Left as an exercise for the reader.");
         }
 
-        public Set entrySet() {
+        public Set<Map.Entry<Object, Object>> entrySet() {
             throw new UnsupportedOperationException("Left as an exercise for the reader.");
         }
 
@@ -346,11 +346,11 @@ public class FlexiMapExample {
             throw new UnsupportedOperationException("Left as an exercise for the reader.");
         }
 
-        public Set keySet() {
+        public Set<Object> keySet() {
             throw new UnsupportedOperationException("Left as an exercise for the reader.");
         }
 
-        public void putAll(Map t) {
+        public void putAll(Map<?, ?> t) {
             throw new UnsupportedOperationException("Left as an exercise for the reader.");
         }
 
@@ -362,13 +362,13 @@ public class FlexiMapExample {
             throw new UnsupportedOperationException("Left as an exercise for the reader.");
         }
 
-        public Collection values() {
+        public Collection<Object> values() {
             throw new UnsupportedOperationException("Left as an exercise for the reader.");
         }
 
-        private BinaryFunction onPut = null;
-        private BinaryFunction onGet = null;
-        private Map proxiedMap = null;
+        private BinaryFunction<Object, Object, Object> onPut = null;
+        private BinaryFunction<Object, Object, Object> onGet = null;
+        private Map<Object, Object> proxiedMap = null;
     }
 
     /*
@@ -382,15 +382,15 @@ public class FlexiMapExample {
      * Note that using a RightIdentity for onPut and onGet
      * would yield the same behavior.
      */
-    private Map makeBasicMap() {
-        return new HashMap();
+    private Map<Object, Object> makeBasicMap() {
+        return new HashMap<Object, Object>();
     }
 
     /*
      * To prohibit null values, we'll only need to
      * provide an onPut function.
      */
-    private Map makeNullForbiddenMap() {
+    private Map<Object, Object> makeNullForbiddenMap() {
         return new FlexiMap(
             /*
              * We simply ignore the left-hand argument,
@@ -423,7 +423,7 @@ public class FlexiMapExample {
      * provide an onGet function, simliar to the onPut method used
      * above.
      */
-    private Map makeDefaultValueForNullMap(Object defaultValue) {
+    private Map<Object, Object> makeDefaultValueForNullMap(Object defaultValue) {
         return new FlexiMap(
             null,
             /*
@@ -441,7 +441,7 @@ public class FlexiMapExample {
                     /*
                      * returning our default when the value is otherwise null,
                      */
-                    new Constant(defaultValue),
+                    new Constant<Object>(defaultValue),
                     /*
                      * and passing through all non-null values.
                      */
@@ -455,7 +455,7 @@ public class FlexiMapExample {
      * To constrain the value types, we'll
      * provide an onPut function,
      */
-    private Map makeTypeConstrainedMap(Class clazz) {
+    private Map<Object, Object> makeTypeConstrainedMap(Class<?> clazz) {
         return new FlexiMap(
             /*
              * ignore the left-hand argument,
@@ -485,15 +485,16 @@ public class FlexiMapExample {
      * need to consider both the old and new values during
      * onPut:
      */
-    private Map makeMultiMap() {
+    private Map<Object, Object> makeMultiMap() {
         return new FlexiMap(
-            new BinaryFunction() {
+            new BinaryFunction<Object, Object, Object>() {
+                @SuppressWarnings("unchecked")
                 public Object evaluate(Object oldval, Object newval) {
-                    List list = null;
+                    List<Object> list = null;
                     if (null == oldval) {
-                        list = new ArrayList();
+                        list = new ArrayList<Object>();
                     } else {
-                        list = (List) oldval;
+                        list = (List<Object>) oldval;
                     }
                     list.add(newval);
                     return list;
@@ -506,13 +507,13 @@ public class FlexiMapExample {
     /*
      * The StringConcatMap is more interesting still.
      */
-    private Map makeStringConcatMap() {
+    private Map<Object, Object> makeStringConcatMap() {
         return new FlexiMap(
             /*
              * The onPut function looks similiar to the MultiMap
              * method:
              */
-            new BinaryFunction() {
+            new BinaryFunction<Object, Object, Object>() {
                 public Object evaluate(Object oldval, Object newval) {
                     StringBuffer buf = null;
                     if (null == oldval) {
@@ -529,7 +530,7 @@ public class FlexiMapExample {
              * but we'll also need an onGet functor to convert
              * the StringBuffer to a String:
              */
-            new BinaryFunction() {
+            new BinaryFunction<Object, Object, Object>() {
                 public Object evaluate(Object key, Object val) {
                     if (null == val) {
                         return null;
@@ -549,8 +550,8 @@ public class FlexiMapExample {
      */
 
     private abstract class UniversalFunctor implements
-        Procedure, UnaryProcedure, BinaryProcedure,
-        Function, UnaryFunction, BinaryFunction {
+        Procedure, UnaryProcedure<Object>, BinaryProcedure<Object, Object>,
+        Function<Object>, UnaryFunction<Object, Object>, BinaryFunction<Object, Object, Object> {
         public abstract void run();
 
         public void run(Object obj) {

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java Thu Jul 19 20:13:49 2012
@@ -82,8 +82,8 @@ public class QuicksortExample {
 
     @Test
     public void testSortEmpty() {
-        List empty = Collections.EMPTY_LIST;
-        List result = quicksort(empty);
+        List<Object> empty = Collections.EMPTY_LIST;
+        List<?> result = quicksort(empty);
         assertTrue("Sorting an empty list should produce an empty list.", result.isEmpty());
     }
 
@@ -94,10 +94,10 @@ public class QuicksortExample {
 
     @Test
     public void testSortSingleElementList() {
-        List list = new ArrayList();
+        List<Object> list = new ArrayList<Object>();
         list.add("element");
 
-        List sorted = quicksort(list);
+        List<?> sorted = quicksort(list);
 
         assertTrue(
             "The quicksort() method should return a distinct list.",
@@ -116,11 +116,11 @@ public class QuicksortExample {
 
     @Test
     public void testSortSingleValueList() {
-        List list = new ArrayList();
+        List<Object> list = new ArrayList<Object>();
         for (int i = 0; i < 10; i++) {
             list.add("element");
         }
-        List sorted = quicksort(list);
+        List<?> sorted = quicksort(list);
 
         assertTrue(
             "The quicksort() method should return a distinct list.",
@@ -138,12 +138,12 @@ public class QuicksortExample {
  */
     @Test
     public void testSortSorted() {
-        List list = new ArrayList();
+        List<Object> list = new ArrayList<Object>();
         for (int i = 0; i < 10; i++) {
             list.add(new Integer(i));
         }
 
-        List sorted = quicksort(list);
+        List<?> sorted = quicksort(list);
 
         assertTrue(
             "The quicksort() method should return a distinct list.",
@@ -161,8 +161,8 @@ public class QuicksortExample {
  */
     @Test
     public void testSortReversed() {
-        List expected = new ArrayList();
-        List tosort = new ArrayList();
+        List<Object> expected = new ArrayList<Object>();
+        List<Object> tosort = new ArrayList<Object>();
         for (int i = 0; i < 10; i++) {
             /*
              * The "expected" list contains the integers in order.
@@ -182,11 +182,11 @@ public class QuicksortExample {
  */
     @Test
     public void testSortShuffled() {
-        List expected = new ArrayList();
+        List<Object> expected = new ArrayList<Object>();
         for (int i = 0; i < 10; i++) {
             expected.add(new Integer(i));
         }
-        List tosort = new ArrayList(expected);
+        List<Object> tosort = new ArrayList<Object>(expected);
         Collections.shuffle(tosort);
 
         assertEquals(expected, quicksort(tosort));
@@ -201,7 +201,7 @@ public class QuicksortExample {
         /*
          * populate a list with random integers
          */
-        List tosort = new ArrayList();
+        List<Integer> tosort = new ArrayList<Integer>();
         for (int i = 0; i < 10; i++) {
             tosort.add(new Integer(random.nextInt(10)));
         }
@@ -209,7 +209,7 @@ public class QuicksortExample {
          * and use java.util.Collections.sort to
          * give us a sorted version to compare to
          */
-        List expected = new ArrayList(tosort);
+        List<Integer> expected = new ArrayList<Integer>(tosort);
         Collections.sort(expected);
 
         assertEquals(expected, quicksort(tosort));
@@ -230,6 +230,7 @@ public class QuicksortExample {
         /*
          * We'll need the total elapsed time:
          */
+        @SuppressWarnings("unused")
         long elapsed = 0L;
 
         /*
@@ -245,7 +246,7 @@ public class QuicksortExample {
              * Create a List of size SIZE, and
              * populate it with random integers:
              */
-            List tosort = new ArrayList(SIZE);
+            List<Object> tosort = new ArrayList<Object>(SIZE);
             for (int j = 0; j < SIZE; j++) {
                 tosort.add(new Integer(random.nextInt(SIZE)));
             }
@@ -309,8 +310,8 @@ public class QuicksortExample {
  * quicksort:
  */
 
-    public List quicksort(List list) {
-        return (List)(quicksort.evaluate(list));
+    public List<?> quicksort(List<?> list) {
+        return (List<?>)(quicksort.evaluate(list));
     }
 
 /*
@@ -336,24 +337,24 @@ public class QuicksortExample {
  * to transalate this description directly into code:
  */
 
-    private UnaryFunction quicksort = new ConditionalUnaryFunction(
+    private UnaryFunction<Object, Object> quicksort = new ConditionalUnaryFunction<Object, Object>(
         /* if the list is empty... */
         IsEmpty.instance(),
         /* ...then return an empty list... */
-        new Constant(Collections.EMPTY_LIST),
+        new Constant<Object>(Collections.EMPTY_LIST),
         /* ...else, apply the following function... */
         new ListFunction() {
             @Override
-            public Object evaluate(List list) {
+            public Object evaluate(List<?> list) {
                 /* Create a list to contain the results. */
-                List result = new ArrayList(list.size());
+                List<Object> result = new ArrayList<Object>(list.size());
                 /*
                  * Recursively apply quicksort the the elements in the
                  * tail less than the head, adding the result to the
                  * sorted list we're generating.
                  */
                 result.addAll(
-                    (List) quicksort.evaluate(
+                    (List<?>) quicksort.evaluate(
                         lesserTail.evaluate(
                             head.evaluate(list),
                             tail.evaluate(list))));
@@ -367,7 +368,7 @@ public class QuicksortExample {
                  * sorted list we're generating.
                  */
                 result.addAll(
-                    (List) quicksort.evaluate(
+                    (List<?>) quicksort.evaluate(
                         greaterTail.evaluate(
                             head.evaluate(list),
                             tail.evaluate(list))));
@@ -388,12 +389,12 @@ public class QuicksortExample {
  * Let ListFunction be a UnaryFunction that operates on Lists:
  */
 
-    public abstract class ListFunction implements UnaryFunction {
-        public abstract Object evaluate(List list);
+    public abstract class ListFunction implements UnaryFunction<Object, Object> {
+        public abstract Object evaluate(List<?> list);
 
         public Object evaluate(Object obj) {
             if (obj instanceof List) {
-                return evaluate((List) obj);
+                return evaluate((List<?>) obj);
             } else if (null == obj) {
                 throw new NullPointerException("The argument must not be null.");
             } else {
@@ -409,12 +410,12 @@ public class QuicksortExample {
  * an Object, List pair:
  */
 
-    public abstract class ObjectListFunction implements BinaryFunction {
-        public abstract Object evaluate(Object head, List tail);
+    public abstract class ObjectListFunction implements BinaryFunction<Object, Object, Object> {
+        public abstract Object evaluate(Object head, List<Object> tail);
 
         public Object evaluate(Object left, Object right) {
             if (left != null && right instanceof List) {
-                return evaluate(left, (List) right);
+                return evaluate(left, (List<?>) right);
             } else if (null == left) {
                 throw new NullPointerException("The left argument must not be null.");
             } else if (null == right) {
@@ -433,9 +434,9 @@ public class QuicksortExample {
  * Given a List, we need to be able to break it into its head:
  */
 
-    private UnaryFunction head = new ListFunction() {
+    private UnaryFunction<Object, Object> head = new ListFunction() {
         @Override
-        public Object evaluate(List list) {
+        public Object evaluate(List<?> list) {
             return list.get(0);
         }
     };
@@ -443,9 +444,9 @@ public class QuicksortExample {
 /*
  * and its tail:
  */
-    private UnaryFunction tail = new ListFunction() {
+    private UnaryFunction<Object, Object> tail = new ListFunction() {
         @Override
-        public Object evaluate(List list) {
+        public Object evaluate(List<?> list) {
             return list.size() < 2 ?
                 Collections.EMPTY_LIST :
                 list.subList(1, list.size());
@@ -458,12 +459,13 @@ public class QuicksortExample {
  * We can simply apply the select algorithm here, using
  * a predicate identifying elements less than the head.
  */
-    private BinaryFunction lesserTail = new ObjectListFunction() {
+    @SuppressWarnings("rawtypes")
+    private BinaryFunction<Object, Object, Object> lesserTail = new ObjectListFunction() {
         @Override
-        public Object evaluate(Object head, List tail) {
+        public Object evaluate(Object head, List<Object> tail) {
             return new FilteredGenerator(
                     IteratorToGeneratorAdapter.adapt(tail.iterator()),
-                IsLessThan.instance((Comparable) head)).toCollection();
+                    IsLessThan.instance((Comparable<?>) head)).toCollection();
         }
     };
 
@@ -472,12 +474,13 @@ public class QuicksortExample {
  * the tail greater than (or equal to) the head. This
  * is similar to the lesserTail approach.
  */
+    @SuppressWarnings("rawtypes")
     private BinaryFunction greaterTail = new ObjectListFunction() {
         @Override
-        public Object evaluate(Object head, List tail) {
+        public Object evaluate(Object head, List<Object> tail) {
             return new FilteredGenerator(
                     IteratorToGeneratorAdapter.adapt(tail.iterator()),
-                IsGreaterThanOrEqual.instance((Comparable) head)).toCollection();
+                 IsGreaterThanOrEqual.instance((Comparable<?>) head)).toCollection();
         }
     };
 
@@ -487,7 +490,7 @@ public class QuicksortExample {
  */
 
     public void testHeadFunction() {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         try {
             head.evaluate(list);
             fail("Expected IndexOutOfBoundsException when evaluating head of an empty list");
@@ -504,25 +507,25 @@ public class QuicksortExample {
     }
 
     public void testTailFunction() {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         {
-            List result = (List)(tail.evaluate(list));
+            List<String> result = (List<String>)(tail.evaluate(list));
             assertTrue("Tail of an empty list is empty.",result.isEmpty());
         }
         list.add("First");
         {
-            List result = (List)(tail.evaluate(list));
+            List<String> result = (List<String>)(tail.evaluate(list));
             assertTrue("Tail of a one element list is empty.",result.isEmpty());
         }
         list.add("Second");
         {
-            List result = (List)(tail.evaluate(list));
+            List<String> result = (List<String>)(tail.evaluate(list));
             assertEquals("Tail of a two element list has one element.",1,result.size());
             assertEquals("Second",result.get(0));
         }
         list.add("Third");
         {
-            List result = (List)(tail.evaluate(list));
+            List<String> result = (List<String>)(tail.evaluate(list));
             assertEquals("Tail of a three element list has two elements.",2,result.size());
             assertEquals("Second",result.get(0));
             assertEquals("Third",result.get(1));
@@ -530,13 +533,13 @@ public class QuicksortExample {
     }
 
     public void testLesserTail() {
-        List list = new ArrayList();
+        List<Integer> list = new ArrayList<Integer>();
         for (int i=0;i<10;i++) {
             list.add(new Integer(i));
         }
         for (int i=0;i<10;i++) {
             Integer val = new Integer(i);
-            List lesser = (List) lesserTail.evaluate(val,list);
+            List<Integer> lesser = (List<Integer>) lesserTail.evaluate(val,list);
             assertEquals(i,lesser.size());
             for (int j=0;j<i;j++) {
                 assertEquals(new Integer(j),lesser.get(j));
@@ -545,13 +548,13 @@ public class QuicksortExample {
     }
 
     public void testGreaterTail() {
-        List list = new ArrayList();
+        List<Integer> list = new ArrayList<Integer>();
         for (int i=0;i<10;i++) {
             list.add(new Integer(i));
         }
         for (int i=0;i<10;i++) {
             Integer val = new Integer(i);
-            List greater = (List) greaterTail.evaluate(val,list);
+            List<Integer> greater = (List<Integer>) greaterTail.evaluate(val,list);
             assertEquals(10-i,greater.size());
             for (int j=i;j<10;j++) {
                 assertEquals(new Integer(j),greater.get(j-i));

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BaseBinaryChop.java Thu Jul 19 20:13:49 2012
@@ -25,33 +25,31 @@ import java.util.List;
  *
  * @version $Revision$ $Date$
  */
-@SuppressWarnings("unchecked")
 public abstract class BaseBinaryChop implements BinaryChop {
     public int find(int seeking, int[] in) {
-        Object[] In = new Object[in.length];
+        Integer[] In = new Integer[in.length];
         for (int i=0;i<in.length;i++) {
             In[i] = new Integer(in[i]);
         }
         return find(new Integer(seeking), In);
     }
 
-    public int find(Object seeking, Object[] in) {
+    public int find(Integer seeking, Integer[] in) {
         return find(seeking, Arrays.asList(in));
     }
 
-    protected static int compare(List list, int index, Object obj) {
-        return ((Comparable) list.get(index)).compareTo(obj);
+    protected static int compare(List<Integer> list, int index, Integer obj) {
+        return ((Comparable<Integer>) list.get(index)).compareTo(obj);
     }
 
-    protected static boolean greaterThan(List list, int index, Object obj) {
+    protected static boolean greaterThan(List<Integer> list, int index, Integer obj) {
         return compare(list,index,obj) > 0;
     }
 
-    protected static boolean equals(List list, int index, Object obj) {
+    protected static boolean equals(List<Integer> list, int index, Integer obj) {
         return compare(list,index,obj) == 0;
     }
 
     protected static final Integer NEGATIVE_ONE = new Integer(-1);
 
-    public abstract int find(Object seeking, List in);
 }
\ No newline at end of file

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BinaryChop.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BinaryChop.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BinaryChop.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/BinaryChop.java Thu Jul 19 20:13:49 2012
@@ -26,6 +26,6 @@ import java.util.List;
  */
 public interface BinaryChop {
     int find(int seeking, int[] in);
-    int find(Object seeking, Object[] in);
-    int find(Object seeking, List in);
+    int find(Integer seeking, Integer[] in);
+    int find(Integer seeking, List<Integer> in);
 }
\ No newline at end of file

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/EiffelStyleLoop.java Thu Jul 19 20:13:49 2012
@@ -58,18 +58,18 @@ public class EiffelStyleLoop implements 
     }
 
     @SuppressWarnings("unchecked")
-    public EiffelStyleLoop variant(final Function function) {
+    public EiffelStyleLoop variant(final Function<Object> function) {
         return variant(new Predicate() {
             public boolean test() {
                 boolean result = true;
-                Comparable next = (Comparable)(function.evaluate());
+                Comparable<Object> next = (Comparable<Object>)(function.evaluate());
                 if (null != last) {
                     result = last.compareTo(next) > 0;
                 }
                 last = next;
                 return result;
             }
-            private Comparable last = null;
+            private Comparable<Object> last = null;
         });
     }
 

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestBinaryChop.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestBinaryChop.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestBinaryChop.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/kata/two/TestBinaryChop.java Thu Jul 19 20:13:49 2012
@@ -71,7 +71,6 @@ import org.junit.Test;
  *
  * @version $Revision$ $Date$
  */
-@SuppressWarnings("unchecked")
 public class TestBinaryChop {
 
     /**
@@ -103,7 +102,7 @@ public class TestBinaryChop {
         assertEquals(-1, chopper.find(6, new int[] { 1, 3, 5, 7 }));
         assertEquals(-1, chopper.find(8, new int[] { 1, 3, 5, 7 }));
 
-        List largeList = (List) (new IntegerRange(0, 100001).toCollection());
+        List<Integer> largeList = (List<Integer>) (new IntegerRange(0, 100001).toCollection());
         assertEquals(-1, chopper.find(new Integer(-5), largeList));
         assertEquals(100000, chopper.find(new Integer(100000), largeList));
         assertEquals(0, chopper.find(new Integer(0), largeList));
@@ -120,8 +119,7 @@ public class TestBinaryChop {
     @Test
     public void testBuiltIn() {
         chopTest(new BaseBinaryChop() {
-            @Override
-            public int find(Object seeking, List list) {
+            public int find(Integer seeking, List<Integer> list) {
                 int result = Collections.binarySearch(list,seeking);
                 //
                 // Collections.binarySearch is a bit smarter than our
@@ -151,8 +149,7 @@ public class TestBinaryChop {
     @Test
     public void testIterative() {
         chopTest(new BaseBinaryChop() {
-            @Override
-            public int find(Object seeking, List list) {
+            public int find(Integer seeking, List<Integer> list) {
                 int high = list.size();
                 int low = 0;
                 while (high - low > 1) {
@@ -260,7 +257,7 @@ public class TestBinaryChop {
      * the loop, so let's add a Function implementation as well,
      * as a way of retrieving that result:
      */
-    interface Loop extends Predicate, Procedure, Function {
+    interface Loop extends Predicate, Procedure, Function<Object> {
         /** The terminating condition. */
         boolean test();
         /** The loop body. */
@@ -277,8 +274,7 @@ public class TestBinaryChop {
     public void testIterativeWithInvariants() {
         chopTest(new BaseBinaryChop() {
 
-            @Override
-            public int find(final Object seeking, final List list) {
+            public int find(final Integer seeking, final List<Integer> list) {
                 Loop loop = new Loop() {
                     int high = list.size();
                     int low = 0;
@@ -341,7 +337,7 @@ public class TestBinaryChop {
      * We can do that too, using EiffelStyleLoop.
      */
     class BinarySearchLoop extends EiffelStyleLoop {
-        BinarySearchLoop(Object aSeeking, List aList) {
+        BinarySearchLoop(Integer aSeeking, List<Integer> aList) {
             seeking = aSeeking;
             list = aList;
 
@@ -358,7 +354,7 @@ public class TestBinaryChop {
                 }
             });
 
-            variant(new Function() {
+            variant(new Function<Object>() {
                 public Object evaluate() {
                     return new Integer(high - low);
                 }
@@ -388,15 +384,14 @@ public class TestBinaryChop {
 
         private int high;
         private int low;
-        private final Object seeking;
-        private final List list;
+        private final Integer seeking;
+        private final List<Integer> list;
     }
 
     @Test
     public void testIterativeWithInvariantsAndAssertions() {
         chopTest(new BaseBinaryChop() {
-            @Override
-            public int find(Object seeking, List list) {
+            public int find(Integer seeking, List<Integer> list) {
                 BinarySearchLoop loop = new BinarySearchLoop(seeking,list);
                 loop.run();
                 return loop.getResult();
@@ -411,12 +406,11 @@ public class TestBinaryChop {
     @Test
     public void testRecursive() {
         chopTest(new BaseBinaryChop() {
-            @Override
-            public int find(Object seeking, List list) {
+            public int find(Integer seeking, List<Integer> list) {
                 return find(seeking, list, 0, list.size());
             }
 
-            private int find(Object seeking, List list, int low, int high) {
+            private int find(Integer seeking, List<Integer> list, int low, int high) {
                 if (high - low > 1) {
                     int mid = (high + low) / 2;
                     if (greaterThan(list,mid,seeking)) {
@@ -446,9 +440,8 @@ public class TestBinaryChop {
     @Test
     public void testTailRecursive() {
         chopTest(new BaseBinaryChop() {
-            @Override
-            public int find(final Object seeking, final List list) {
-                return ((Number) new RecursiveEvaluation(new Function() {
+            public int find(final Integer seeking, final List<Integer> list) {
+                return ((Number) new RecursiveEvaluation(new Function<Object>() {
                     public Object evaluate() {
                         if (high - low > 1) {
                             int mid = (high + low) / 2;
@@ -493,12 +486,11 @@ public class TestBinaryChop {
     @Test
     public void testRecursive2() {
         chopTest(new BaseBinaryChop() {
-            @Override
-            public int find(Object seeking, List list) {
+            public int find(Integer seeking, List<Integer> list) {
                 return find(seeking,list,0);
             }
 
-            private int find(Object seeking, List list, int offset) {
+            private int find(Integer seeking, List<Integer> list, int offset) {
                 if (list.isEmpty()) {
                     return -1;
                 } if (list.size() == 1) {
@@ -524,9 +516,8 @@ public class TestBinaryChop {
     @Test
     public void testTailRecursive2() {
         chopTest(new BaseBinaryChop() {
-            @Override
-            public int find(final Object seeking, final List list) {
-                return ((Number) new RecursiveEvaluation(new Function() {
+            public int find(final Integer seeking, final List<Integer> list) {
+                return ((Number) new RecursiveEvaluation(new Function<Object>() {
                     public Object evaluate() {
                         if (sublist.isEmpty()) {
                             return BaseBinaryChop.NEGATIVE_ONE;
@@ -546,7 +537,7 @@ public class TestBinaryChop {
                         }
                     }
                     int offset = 0;
-                    List sublist = list;
+                    List<Integer> sublist = list;
                 }).evaluate()).intValue();
             }
         });

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/Lines.java Thu Jul 19 20:13:49 2012
@@ -74,6 +74,7 @@ public class Lines extends BaseGenerator
     private BufferedReader in = null;
 
     private class TunneledException extends RuntimeException {
+        private static final long serialVersionUID = 1L;
         private Exception exception = null;
         TunneledException(Exception exception) {
             super(exception.toString());

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/TestLines.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/TestLines.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/TestLines.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/lines/TestLines.java Thu Jul 19 20:13:49 2012
@@ -105,6 +105,7 @@ public class TestLines extends TestCase 
         assertEquals("Expected 5 lines",5,matches.size());
     }
 
+    @SuppressWarnings("unchecked")
     public void testFindMatchingFromTail() throws Exception {
         Collection<String> matches = new FilteredGenerator<String>(Lines.from(reader), new UnaryAnd<String>(new Offset(
                 8), new Contains<String>("lo"))).toCollection();

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FixedSizeMap.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FixedSizeMap.java?rev=1363514&r1=1363513&r2=1363514&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FixedSizeMap.java (original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/map/FixedSizeMap.java Thu Jul 19 20:13:49 2012
@@ -30,14 +30,13 @@ import org.apache.commons.functor.genera
  * @version $Revision$ $Date$
  */
 @SuppressWarnings("unchecked")
-public class FixedSizeMap extends FunctoredMap {
-    public FixedSizeMap(Map map) {
+public class FixedSizeMap<K, V> extends FunctoredMap<K, V> {
+    public FixedSizeMap(Map<K, V> map) {
         super(map);
-        setOnPut(new BinaryFunction() {
-            public Object evaluate(Object a, Object b) {
-                Map map = (Map) a;
-                Object key = Array.get(b,0);
-                Object value = Array.get(b,1);
+        setOnPut(new BinaryFunction<Map<K,V>, Object[], V>() {
+            public V evaluate(Map<K,V> map, Object[] b) {
+                K key = (K)Array.get(b,0);
+                V value = (V)Array.get(b,1);
                 if (map.containsKey(key)) {
                     return map.put(key,value);
                 } else {
@@ -46,10 +45,10 @@ public class FixedSizeMap extends Functo
             }
         });
 
-        setOnPutAll(new BinaryProcedure() {
-            public void run(Object a, Object b) {
-                Map dest = (Map) a;
-                Map src = (Map) b;
+        setOnPutAll(new BinaryProcedure<Map<K,V>, Map<K,V>>() {
+            public void run(Map<K,V> a, Map<K,V> b) {
+                Map<K,V> dest = a;
+                Map<K,V> src = b;
 
                 if (GeneratorContains.instance().test(IteratorToGeneratorAdapter.adapt(src.keySet().iterator()),UnaryNot.not(new ContainsKey(dest)))) {
                     throw new IllegalArgumentException();
@@ -59,7 +58,7 @@ public class FixedSizeMap extends Functo
             }
         });
 
-        setOnRemove(new BinaryProcedureBinaryFunction(new Throw(new UnsupportedOperationException())));
-        setOnClear(new Throw(new UnsupportedOperationException()));
+        setOnRemove(new BinaryProcedureBinaryFunction<Map<K, V>, K, V>((BinaryProcedure<? super Map<K, V>, ? super K>) new Throw<K, V>(new UnsupportedOperationException())));
+        setOnClear(new Throw<K, V>(new UnsupportedOperationException()));
     }
 }



Mime
View raw message