compilation fails with 'no enclosing instance' error
Liam Miller-Cushon
cushon at google.com
Thu Feb 13 14:51:30 PST 2014
Thanks for confirming.
Would someone with access to the bug tracker mind filing this? Or should I
submit a report to http://bugreport.java.com? It would be helpful to have a
bug ID to refer to.
On Wed, Feb 12, 2014 at 6:20 PM, Alex Buckley <alex.buckley at oracle.com>wrote:
> Regression. MyImpl inherits the instance method foo(Object) from Impl, and
> foo(o) should invoke the inherited method. At least javac is recognizing
> that the type Impl is an important source of truth.
>
> The foo(Object) method in base.BaseImpl is irrelevant because, having
> package access, it's not inherited by Impl.
>
> Alex
>
>
> On 2/12/2014 5:49 PM, Liam Miller-Cushon wrote:
>
>> Hi,
>>
>> I discovered a JDK8-b128 compilation error that does not occur with JDK7:
>>
>> === base/BaseImpl.java ===
>> package base;
>>
>> public class BaseImpl {
>> static void foo(Object o) {}
>> }
>> ===
>>
>> === Test.java ===
>> class Impl extends base.BaseImpl {
>> public void foo(Object o) {}
>> }
>>
>> class MyImpl extends Impl {
>> public void m(Object o) {
>> foo(o);
>> }
>> }
>> ===
>>
>> $ javac base/BaseImpl.java Test.java
>> Test.java:7: error: no enclosing instance of type Impl is in scope
>> foo(o);
>> ^
>>
>> Is this a deliberate change, or a regression? If it's deliberate, the
>> error message is not very clear.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20140213/b28f57c3/attachment.html
More information about the compiler-dev
mailing list