Tuesday, 15 September 2015

java generics - The method evaluate(T,T) in the type T is not applicable for the arguments (Comparable, Comparable) -



java generics - The method evaluate(T,T) in the type T is not applicable for the arguments (Comparable, Comparable<capture#11-of ?>) -

i'm having problem generic method since upgrade java version 8. phone call following:

operator o; comparable a; comparable<?> b; boolean match = o.evaluate(a, b)

and method

public enum operator{ public <t extends comparable<t>> boolean evaluate(t value1, t value2) { if (value1 == null && value2 != null) { homecoming false; } switch (this) { //some code here } } }

and exception is: method evaluate(t, t) in type operator not applicable arguments (comparable, comparable)

thanks in advance!

evaluate expects arguments known same type, can compared itself, that's not case here.

java

No comments:

Post a Comment