RFR: 8255273: jshell crashes with UnsupportedOperationException: Should not get here.
Jan Lahoda
jlahoda at openjdk.java.net
Fri Mar 26 16:50:41 UTC 2021
Consider JShell interaction like:
jshell> import java.time.*;
jshell> new Instant<tab>
This will crash the JShell with an `UnsupportedOperationException`. The ultimately reason is that:
-completions are computed, and are `InstantiationError(` and `InstantiationException(`, with a common prefix `InstantiationE`
-documentation is computed, and is for java.time.Instant
The completion state machine then gets into a state where it fills in the common prefix, and then it would like say something along the lines of "Press tab once more to see signature/documentation.", but that does not make much sense (as the documentation is computed for a wrong input - the new input is `new InstantiationE`, not `Instant`, so the documentation is already invalid for that.
(The `UnsupportedOperationException` is in place where the "Press tab once more to see signature/documentation." should happen, because the code should not get into a state like this.)
The proposed solution is to cancel the documentation if a prefix is (to be) filled.
-------------
Commit messages:
- Fixing compilation error.
- Merging master into JDK-8255273
- 8255273: jshell crashes with UnsupportedOperationException: Should not get here.
Changes: https://git.openjdk.java.net/jdk/pull/3220/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3220&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8255273
Stats: 101 lines in 2 files changed: 60 ins; 27 del; 14 mod
Patch: https://git.openjdk.java.net/jdk/pull/3220.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/3220/head:pull/3220
PR: https://git.openjdk.java.net/jdk/pull/3220
More information about the kulla-dev
mailing list