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

JShell tool: packages in classpath don't appear in completions

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd_major
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Understanding:
      Cause Known
    • Introduced In Build:
      b152
    • Introduced In Version:
      9
    • CPU:
      generic
    • OS:
      generic

      Description

      In 9b136, it works well like:
      $ ~/bin/jdk9b136/bin/jshell --class-path ~/.m2/repository/com/google/guava/guava/21.0/guava-21.0.jar
      | JShellへようこそ -- バージョン9-ea
      | 概要については、次を入力してください: /help intro

      jshell> import
      Documentation Main Test com java javafx javax jdk netscape
      oracle org sun

      jshell> import com.
      google oracle sun

      jshell> import com.google.
      common thirdparty

      jshell> import com.google.common.
      annotations base cache collect escape eventbus graph hash html io math
      net primitives reflect util xml

      jshell> import com.google.common.io.*


      jshell> com.
      google oracle sun

      jshell> com.google.
      common thirdparty


      But in JDK9b161, it doesn't work well:
      ~/bin/jdk9b161/bin/jshell --class-path ~/.m2/repository/com/google/guava/guava/21.0/guava-21.0.jar
      | JShellへようこそ -- バージョン9-ea
      | 概要については、次を入力してください: /help intro

      jshell> import
      com java javafx javax jdk netscape oracle org sun

      jshell> import com.
      oracle sun

      jshell> com.
      oracle sun

      CAUSE:
      The cause is JShellTool doesn't call addToClasspath and SourceCodeAnaysisImpl couldn't catch fileManager with classpath.

      POSSIBLE SOLUTIONs:
      1. Call addToClasspath in JShellTool with specified classpath
      2. Remove addToClasspath methods and detect classpath automatically while constructing TaskFactory or MemoryFileManager

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jlahoda Jan Lahoda
                Reporter:
                shinyafox Shinya Yoshida
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: