binary form of local class produces strange error
Stephan Herrmann
stephan.herrmann at berlin.de
Sun Jun 8 21:53:26 UTC 2025
We (ecj) have a test case relating to
https://bugs.java.com/bugdatabase/view_bug?bug_id=4094180 where historically we
expect javac to accept the following classes in separate invocations (despite
the obvious problem in X):
public class Y {
public static void main(String[] args) {
class Local {}
System.out.println("SUCCESS");
}
}
public class X {
public static void main(String argv[]) {
Object a = new Y$1Local();
}
}
Since 24 I see javac complaining:
X.java:3: error: an enclosing instance that contains Local is required
Object a = new Y$1Local();
^
1 error
This doesn't look right to me :)
best
Stephan
More information about the compiler-dev
mailing list