RFR: 8194743: Compiler implementation for Statements before super() [v16]
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Sep 25 17:23:18 UTC 2023
On Mon, 25 Sep 2023 17:04:39 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Archie Cobbs has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Have RefBeforeCtorCalledError extend StaticError and customize debug strings.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java line 2016:
>
>> 2014: if (staticOnly)
>> 2015: return new StaticError(sym);
>> 2016: if (env1.info.ctorPrologue && env1 == env)
>
> where does `env1 == env` come from?
Should this work?
class Test {
String s = "Hello";
void m() {
System.out.println("Hello");
}
class Inner {
Inner() {
m();
super();
}
}
public static void main(String[] args) {
new Test().new Inner();
}
}
The proposed changes accept this program. But I can't find supporting text in the JLS changes:
https://cr.openjdk.org/~gbierman/jep447/jep447-20230620/specs/statements-before-super-jls.html
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13656#discussion_r1336182611
More information about the compiler-dev
mailing list