Open
Description
What problem are you trying to solve?
Jep 513 calls for allowing statements before the call to super()
in Java constructors, allowing for simple assignments and validations before doing expensive construction.
What precondition(s) should be checked before applying this recipe?
Java version >= 25
(Also double check Jep 513 lands in Java 25)
Describe the situation before applying the recipe
class A {
public A(String bar) {
super();
if(bar.equals("test"))
throw new RuntimeException();
}
}
Describe the situation after applying the recipe
class A {
public A(String bar) {
if(bar.equals("test"))
throw new RuntimeException();
super();
}
}
Any additional context
https://openjdk.org/jeps/513 has several examples and considerations on what statements should be supported before calls to super(..)
Metadata
Metadata
Assignees
Type
Projects
Status
Backlog