-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P4
-
Affects Version/s: repo-valhalla
-
Component/s: tools
JLS says:
The body of a compact constructor declaration must satisfy all of the following conditions, or a compile-time error occurs:
The body must not contain an explicit constructor invocation (8.8.7.1).
But in JEP-401 EA2 this code is accepted:
Welcome to JShell -- Version 26-jep401ea2
| For an introduction type: /help intro
jshell> record Record(int x) {
...> public Record {
...> super();
...> }
...> }
| created record Record
The body of a compact constructor declaration must satisfy all of the following conditions, or a compile-time error occurs:
The body must not contain an explicit constructor invocation (8.8.7.1).
But in JEP-401 EA2 this code is accepted:
Welcome to JShell -- Version 26-jep401ea2
| For an introduction type: /help intro
jshell> record Record(int x) {
...> public Record {
...> super();
...> }
...> }
| created record Record
- duplicates
-
JDK-8370712 [lworld] super(), this() invocations should not be allowed in compact record constructors
-
- Closed
-