You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2012/08/08 21:50:46 UTC

svn commit: r1370919 - /commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java

Author: mbenson
Date: Wed Aug  8 19:50:46 2012
New Revision: 1370919

URL: http://svn.apache.org/viewvc?rev=1370919&view=rev
Log:
make sure all generic signatures match; eclipse was seemingly compiling in such a way that method calls with casting were not routing properly

Modified:
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java

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=1370919&r1=1370918&r2=1370919&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 Wed Aug  8 19:50:46 2012
@@ -411,7 +411,7 @@ public class QuicksortExample {
  */
 
     public abstract class ObjectListFunction implements BinaryFunction<Object, Object, Object> {
-        public abstract Object evaluate(Object head, List<Object> tail);
+        public abstract Object evaluate(Object head, List<?> tail);
 
         public Object evaluate(Object left, Object right) {
             if (left != null && right instanceof List) {
@@ -462,7 +462,7 @@ public class QuicksortExample {
     @SuppressWarnings("rawtypes")
     private BinaryFunction<Object, Object, Object> lesserTail = new ObjectListFunction() {
         @Override
-        public Object evaluate(Object head, List<Object> tail) {
+        public Object evaluate(Object head, List<?> tail) {
             return new FilteredGenerator(
                     IteratorToGeneratorAdapter.adapt(tail.iterator()),
                     IsLessThan.instance((Comparable<?>) head)).toCollection();
@@ -477,7 +477,7 @@ public class QuicksortExample {
     @SuppressWarnings("rawtypes")
     private BinaryFunction greaterTail = new ObjectListFunction() {
         @Override
-        public Object evaluate(Object head, List<Object> tail) {
+        public Object evaluate(Object head, List<?> tail) {
             return new FilteredGenerator(
                     IteratorToGeneratorAdapter.adapt(tail.iterator()),
                  IsGreaterThanOrEqual.instance((Comparable<?>) head)).toCollection();



Re: svn commit: r1370919 - /commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java

Posted by Simone Tripodi <si...@apache.org>.
Hi Matt!

wouldn't something like

> +        public abstract <E> E evaluate(E head, List<E> tail);

work?

best,
-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/


On Wed, Aug 8, 2012 at 9:50 PM,  <mb...@apache.org> wrote:
> Author: mbenson
> Date: Wed Aug  8 19:50:46 2012
> New Revision: 1370919
>
> URL: http://svn.apache.org/viewvc?rev=1370919&view=rev
> Log:
> make sure all generic signatures match; eclipse was seemingly compiling in such a way that method calls with casting were not routing properly
>
> Modified:
>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/example/QuicksortExample.java
>
> 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=1370919&r1=1370918&r2=1370919&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 Wed Aug  8 19:50:46 2012
> @@ -411,7 +411,7 @@ public class QuicksortExample {
>   */
>
>      public abstract class ObjectListFunction implements BinaryFunction<Object, Object, Object> {
> -        public abstract Object evaluate(Object head, List<Object> tail);
> +        public abstract Object evaluate(Object head, List<?> tail);
>
>          public Object evaluate(Object left, Object right) {
>              if (left != null && right instanceof List) {
> @@ -462,7 +462,7 @@ public class QuicksortExample {
>      @SuppressWarnings("rawtypes")
>      private BinaryFunction<Object, Object, Object> lesserTail = new ObjectListFunction() {
>          @Override
> -        public Object evaluate(Object head, List<Object> tail) {
> +        public Object evaluate(Object head, List<?> tail) {
>              return new FilteredGenerator(
>                      IteratorToGeneratorAdapter.adapt(tail.iterator()),
>                      IsLessThan.instance((Comparable<?>) head)).toCollection();
> @@ -477,7 +477,7 @@ public class QuicksortExample {
>      @SuppressWarnings("rawtypes")
>      private BinaryFunction greaterTail = new ObjectListFunction() {
>          @Override
> -        public Object evaluate(Object head, List<Object> tail) {
> +        public Object evaluate(Object head, List<?> tail) {
>              return new FilteredGenerator(
>                      IteratorToGeneratorAdapter.adapt(tail.iterator()),
>                   IsGreaterThanOrEqual.instance((Comparable<?>) head)).toCollection();
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org