compilation fails with 'no enclosing instance' error

Liam Miller-Cushon cushon at google.com
Wed Feb 12 17:49:31 PST 2014


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/20140212/9d4e8582/attachment.html 


More information about the compiler-dev mailing list