Integrated: 8273039: JShell crashes when naming variable or method "abstract" or "strictfp"
Jan Lahoda
jlahoda at openjdk.java.net
Fri Nov 19 07:53:47 UTC 2021
On Mon, 11 Oct 2021 16:48:07 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> When JShell processes `int strictfp = 0;` (which is obviously erroneous), it will speculativelly try to parse and attribute code along these lines:
>
> package REPL;
> import java.io.*;import java.math.*;import java.net.*;import java.nio.file.*;import java.util.*;import java.util.concurrent.*;import java.util.function.*;import java.util.prefs.*;import java.util.regex.*;import java.util.stream.*;
> class $JShell$DOESNOTMATTER {
> public static Object do_it$() throws Throwable {
> return int strictfp = 0;
> }
> }
>
>
> This crashes `Attr`, as the `strictfp` will be wrapped in `JCModifiers`, wrapped inside an erroneous tree, and `Attr` does not handle modifiers.
>
> The proposal is to let `Attr` "handle" the `JCModifiers` in an error-recovery situation.
This pull request has now been integrated.
Changeset: 2f20b0d8
Author: Jan Lahoda <jlahoda at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/2f20b0d8daca6bdc53b4b9e1837c428930d34236
Stats: 182 lines in 3 files changed: 181 ins; 0 del; 1 mod
8273039: JShell crashes when naming variable or method "abstract" or "strictfp"
Reviewed-by: vromero
-------------
PR: https://git.openjdk.java.net/jdk/pull/5897
More information about the compiler-dev
mailing list