You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class TestFlow {
TestFlow(boolean f) {
if (f)
super();
else
this();
}
}
This reports "Constructor call must be the first statement in a constructor", despite the preview being enabled.
In JLS this is managed by grammar rules admitting constructor calls only as a top level statement in the constructor body. When this feature enabled, should we say smth like "must be a top-level statement in a constructor body"? Would that be clear, or do we need to explicitly mention what is not allowed: wrapping the constructor call in some control structure or block?
The text was updated successfully, but these errors were encountered:
should we say smth like "must be a top-level statement in a constructor body"? Would that be clear, or do we need to explicitly mention what is not allowed: wrapping the constructor call in some control structure or block?
In #2685 I opted for a simply "Constructor call is not allowed here" (javac says "Explicit onstructor call is not allowed here")
This reports "Constructor call must be the first statement in a constructor", despite the preview being enabled.
In JLS this is managed by grammar rules admitting constructor calls only as a top level statement in the constructor body. When this feature enabled, should we say smth like "must be a top-level statement in a constructor body"? Would that be clear, or do we need to explicitly mention what is not allowed: wrapping the constructor call in some control structure or block?
The text was updated successfully, but these errors were encountered: