Draft Spec for Second Preview of Flexible Constructor Bodies (JEP 482)
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Jun 11 17:10:42 UTC 2024
On 11/06/2024 17:17, Stephan Herrmann wrote:
> I'm sorry, I didn't look at the specific complications. This
> particular one is wrongly accepted also by ecj. IOW there is some
> confusion indeed regarding how far the "staticness" propagates into
> nested structures.
Ok. I tried this example:
|$ cat Foo.java class Test { interface Bar { } static class Foo {
Foo(Bar bar) { } } int x; class Inner extends Foo { Inner() { super(new
Bar() { { Test.this.x++; } // allowed??? }); } } } |
|java -jar org.eclipse.jdt.core.compiler.batch_3.38.0.v20240524-2033.jar
Foo.java ---------- 1. ERROR in /w/lt/jdk/dev/Foo.java (at line 11) {
Test.this.x++; } // allowed??? ^^^^^^^^^ No enclosing instance of the
type Test is accessible in scope ---------- 1 problem (1 error) |
This seems to suggest that the “outside JLS” behavior is not supported
by ecj?
Maurizio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-experts/attachments/20240611/9f274ba6/attachment-0001.htm>
More information about the amber-spec-experts
mailing list