Problem in jdk8/tl: defined in an inaccessible class or interface

Werner Dietl wdietl at
Sun Mar 31 12:35:28 PDT 2013

Take this simple example:

public class IterableTest {
    interface Data extends Iterable<String> { }

    void test(Iterable<? extends Data> t) {
        for(Object a: t.iterator().next());

It compiles without errors using javac 1.6.0_27, 1.7.0_15, and 1.8.0 b82.
However, using the current jdk8/tl version results in: error: iterator() in Iterable is defined in an
inaccessible class or interface
        for(Object a: t.iterator().next());
  where T is a type-variable:
    T extends Object declared in interface Iterable
1 error

Is this a desired error?
Can the error message be improved to highlight better what is wrong?

Thanks for any help,
cu, WMD.


More information about the type-annotations-dev mailing list