compilation fails with 'no enclosing instance' error

Liam Miller-Cushon cushon at
Thu Feb 27 08:17:40 PST 2014

> IMO, the problem here in hiddenIn() is not that visibility is not being
> considered, this caught in other part of the compiler. The problem here is
> that hiddenIn() was analyzing all the superclasses up to Object. This is
> not necessary to determine if a member is hidden or not.

The implementation of hiddenIn() is also examining all superinterfaces. Is
that necessary? It's a compile time error for a static method to hide an
interface method, and that error should get caught earlier in the

If hiddenIn() was only considering superclasses then it could just examine
the path between the current class and the member's owner, which I think
would fix this bug.

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the compiler-dev mailing list