compilation fails with 'no enclosing instance' error

Vicente-Arturo Romero-Zaldivar vicente.romero at oracle.com
Thu Feb 27 08:41:21 PST 2014


On 27/02/14 16:17, Liam Miller-Cushon wrote:
>
>     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 compilation.
>
> 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.
>
> Thanks,
> Liam
Well hiddenIn() is not used for methods only, also fields are considered.

Thanks,
Vicente
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20140227/4d621ae5/attachment.html 


More information about the compiler-dev mailing list