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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • tbd
    • 9
    • tools
    • None
    • Cause Known
    • b152
    • 9
    • generic
    • 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

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

              Dates

                Created:
                Updated: