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

jshell crashes when pressing up arrow after /!

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 13
    • Fix Version/s: 16
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b24
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      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)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: