compilation fails with 'no enclosing instance' error
Vicente-Arturo Romero-Zaldivar
vicente.romero at oracle.com
Thu Feb 27 07:32:45 PST 2014
Hi,
On 14/02/14 00:57, Liam Miller-Cushon wrote:
>
> Filed https://bugs.openjdk.java.net/browse/JDK-8034924.
>
>
> Thanks!
>
> - The compile-time error appears (incorrectly) whether the static
> method in base.BaseImpl is package access or private. But if the
> static method is public, then everything works fine:
> Impl.foo(Object) attempts to override base.BaseImpl.foo(Object),
> and a compile-time error occurs because an instance method cannot
> override a static method.
>
>
> I think the culprit is that Symbol.hiddenIn(...) doesn't consider
> visibility. It's incorrectly reporting Impl.foo() as being hidden by
> base.BaseImpl.foo(), which causes an error during lowering when a
> qualified base class reference is being synthesized for the invocation.
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.
Thanks,
Vicente
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20140227/71090a5e/attachment.html
More information about the compiler-dev
mailing list