type inference problem lead to cannot find symbol error message

Thomas Jung thomas.andreas.jung at googlemail.com
Sat Aug 7 10:55:34 PDT 2010


Hi,

I'm still trying out functionality of the Guava library with the
lambda prototype.

This time I've a strange behavior with the
CharMatcher.forPredicate(Predicate<? super Character> predicate)
method (http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/base/CharMatcher.html#forPredicate%28com.google.common.base.Predicate%29).

If I remove the type of the predicate

CharMatcher c = CharMatcher.forPredicate(#(Character c){c.compareTo('e') < 0});
CharMatcher c2 = CharMatcher.forPredicate(#(c){c.compareTo('e') < 0});

it results in the error message:

CTest.java:[47,50] cannot find symbol

[47,50] is the first opening brace "CharMatcher c2 = CharMatcher.forPredicate("

Any ideas?

Thomas


More information about the lambda-dev mailing list