-
Bug
-
Resolution: Fixed
-
P4
-
repo-valhalla
-
generic
-
generic
JEP 401 (https://openjdk.java.net/jeps/401) calls for:
A primitive class declaration is subject to the following restrictions:
...
No constructor makes a super constructor call. Instance creation will occur without executing any superclass initialization code.
...
// -----
Javac implements this "in principle", by rewriting any super() chaining attempt in
com.sun.tools.javac.jvm.TransValues#visitMethodDef
so no chaining happens. Instead the factory "product" gets created
by the synthesized code (that replaces the super call) via:
V $this = V.default;
But tolerating express *programmer coded" super() call in the constructor is a deviation from the draft specification.
A possible fix is to tolerate the compiler inserted super calls and issue errors only for programmer coded super calls.
See the treatment of super() calls in enum constructors and the
issue of the diagnostic Errors.CallToSuperNotAllowedInEnumCtor
for precendent.
A primitive class declaration is subject to the following restrictions:
...
No constructor makes a super constructor call. Instance creation will occur without executing any superclass initialization code.
...
// -----
Javac implements this "in principle", by rewriting any super() chaining attempt in
com.sun.tools.javac.jvm.TransValues#visitMethodDef
so no chaining happens. Instead the factory "product" gets created
by the synthesized code (that replaces the super call) via:
V $this = V.default;
But tolerating express *programmer coded" super() call in the constructor is a deviation from the draft specification.
A possible fix is to tolerate the compiler inserted super calls and issue errors only for programmer coded super calls.
See the treatment of super() calls in enum constructors and the
issue of the diagnostic Errors.CallToSuperNotAllowedInEnumCtor
for precendent.