A DESCRIPTION OF THE PROBLEM :
When starting jshell, directly using the `/!` command and afterwards pressing the up arrow to get the last input from history, jshell crashes.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Start jshell
2. Run `/!`
3. Press the up arrow
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The default import displayed after step 2 is inserted:
> import java.util.stream.*;
ACTUAL -
jshell crashes:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 195, Size: 194
at java.base/java.util.LinkedList.checkPositionIndex(LinkedList.java:564)
at java.base/java.util.LinkedList.listIterator(LinkedList.java:871)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.history.DefaultHistory.iterator(DefaultHistory.java:320)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.searchBackwards(LineReaderImpl.java:2647)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.historySearchBackward(LineReaderImpl.java:2603)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.upLineOrSearch(LineReaderImpl.java:2883)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:585)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:404)
at jdk.jshell/jdk.internal.jshell.tool.ConsoleIOContext.readLine(ConsoleIOContext.java:201)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.getInput(JShellTool.java:1238)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:1174)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:975)
at jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder.start(JShellToolBuilder.java:254)
at jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider.main(JShellToolProvider.java:120)
When starting jshell, directly using the `/!` command and afterwards pressing the up arrow to get the last input from history, jshell crashes.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Start jshell
2. Run `/!`
3. Press the up arrow
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The default import displayed after step 2 is inserted:
> import java.util.stream.*;
ACTUAL -
jshell crashes:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 195, Size: 194
at java.base/java.util.LinkedList.checkPositionIndex(LinkedList.java:564)
at java.base/java.util.LinkedList.listIterator(LinkedList.java:871)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.history.DefaultHistory.iterator(DefaultHistory.java:320)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.searchBackwards(LineReaderImpl.java:2647)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.historySearchBackward(LineReaderImpl.java:2603)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.upLineOrSearch(LineReaderImpl.java:2883)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:585)
at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:404)
at jdk.jshell/jdk.internal.jshell.tool.ConsoleIOContext.readLine(ConsoleIOContext.java:201)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.getInput(JShellTool.java:1238)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:1174)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:975)
at jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder.start(JShellToolBuilder.java:254)
at jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider.main(JShellToolProvider.java:120)
- duplicates
-
JDK-8240278 JShell crashes when pressing up-arrow after issuing /-1 command
- Closed