public class TestFlow {
TestFlow() {
throw new RuntimeException();
super();
}
TestFlow(boolean f) {
if (f)
super();
else // remove this line to see the crash
this();
}
}
... initially to challenge where we still report "Constructor call must be the first statement in a constructor", despite the preview being enabled (just a matter of phrasing).
But then the compiler crashed with :
java.lang.NullPointerException: Cannot read field "thrownExceptions" because "this.binding" is null
at org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall.analyseCode(ExplicitConstructorCall.java:120)
at org.eclipse.jdt.internal.compiler.ast.IfStatement.analyseCode(IfStatement.java:115)
at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.analyseCode(ConstructorDeclaration.java:183)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:956)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:308)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:137)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:910)
at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:145)
at java.base/java.lang.Thread.run(Thread.java:1570)
... initially to challenge where we still report "Constructor call must be the first statement in a constructor", despite the preview being enabled (just a matter of phrasing).
I played with code like this ...
... initially to challenge where we still report "Constructor call must be the first statement in a constructor", despite the preview being enabled (just a matter of phrasing).
But then the compiler crashed with :