Javac Bug/Specification Question

Richard Warburton richard.warburton at
Wed Apr 6 16:22:26 PDT 2011


I hope this is an acceptable place to ask about this issue.  I would
report a bug, except that I'm not entirely sure it is a bug, and I've
seen similar issues discussed on here before.  Essentially I have a
program that compiles fine in Eclipse, but doesn't using javac.  I
suspect this is due to a generics/inference bug.  The problem is that
when inferring a type of Foo<? super T> that is passed a instance some
concrete type javac infers the type Foo<Object>.  I have put a
testcase online at:

This contains a '' script that for me provides the following error:

in JavacFail cannot be applied to
                System.out.println(filter(asList(1, 2, 3), or(gt(2), lt(2))));
Note: src/ uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

I've also committed in the eclipse project files (in spite of usual
practice) in an effort to make it easier to test that it works under

I've tested under both javac 1.6.0_13 and javac 1.6.0_20, the version
of eclipse that I'm using is Helios Service Release 1, build-id:

If it helps in the detection of the bug it is possible to work around
the issue by assigning the function to a seperate variable with the
type, 'Predicate<Integer>', however I consider this a bit of an
inferior solution.



More information about the compiler-dev mailing list