RFR: 8273039: JShell crashes when naming variable or method "abstract" or "strictfp"

Vicente Romero vromero at openjdk.java.net
Fri Nov 5 18:46:39 UTC 2021


On Fri, 5 Nov 2021 18:27:58 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 5101:
>> 
>>> 5099: 
>>> 5100:     @Override
>>> 5101:     public void visitModifiers(JCModifiers tree) {
>> 
>> question can't we report this error when the erroneous code is being parsed? adding this method to Attr makes me feel a bit uncomfortable, I can understand if this is the only / best way though
>
> Parser will report the error, and will wrap the (presumed) modifiers into an erroneous tree, so the AST is reasonable. But JShell runs javac with `--should-stop=at=FLOW`, so the error in parser will not stop the processing, and when `Attr` will look into the erroneous tree, it will fail.

I see, thanks for the clarification

-------------

PR: https://git.openjdk.java.net/jdk/pull/5897


More information about the compiler-dev mailing list