Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8232856

jshell crashes when pressing up arrow after /!

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 16
    • 13
    • tools
    • b24
    • x86_64
    • windows_10

      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)

            jlahoda Jan Lahoda
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: