-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P4
-
Affects Version/s: repo-valhalla
-
Component/s: tools
In JLS,
If the form is TypeName . super . [TypeArguments] Identifier, then:
It is a compile-time error if the method invocation occurs in a static context or in an early construction context of the current class.
But in JEP-401 EA2, the following code compiles:
| Welcome to JShell -- Version 26-jep401ea2
| For an introduction type: /help intro
>....
...> class Test extends Super {
...>
...> Test() {}
...>
...> Test(int a) {
...> Test.super.testMethod();
...> super(); //it can be this or super, doesn’t matter
...> }
...> }
| created class Super
| created class Test
If the form is TypeName . super . [TypeArguments] Identifier, then:
It is a compile-time error if the method invocation occurs in a static context or in an early construction context of the current class.
But in JEP-401 EA2, the following code compiles:
| Welcome to JShell -- Version 26-jep401ea2
| For an introduction type: /help intro
>....
...> class Test extends Super {
...>
...> Test() {}
...>
...> Test(int a) {
...> Test.super.testMethod();
...> super(); //it can be this or super, doesn’t matter
...> }
...> }
| created class Super
| created class Test