javac generics bug (review-id 2356418)

Chris Dennis cdennis at
Mon Oct 8 07:39:23 PDT 2012


I just stumbled across a javac generics issue whereby the following class fails to compile:

public class GenericTest {
    public Object foo(Callable<? extends Object[]> foo) throws Exception {

with: error: array required, but CAP#1 found
  where CAP#1 is a fresh type-variable:
    CAP#1 extends Object[] from capture of ? extends Object[]
1 error

You can however access .length on the ? extends Object[] typed return without any problems.

I've filed this on (2356418), but figured I would raise the issue here too since it looks like a regression that happened in 1.6 and I have a very simple reproducible test case.


Chris Dennis

More information about the compiler-dev mailing list