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

JShell API: Exported elements referring to inaccessible types in jdk.jshell

XMLWordPrintable

    • b148
    • Not verified

      Under JDK-8153362:
      Add javac -Xlint warning to list exposed types which are not accessible

      A new lint for javac is developed that warns about exported elements that refer to types that are potentially inaccessible to the client of the API (like package private or not exported types).

      For jdk.jshell, the warnings are:
      ---
      .../jdk9/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java:195: warning: [exports] interface VirtualMachine in module jdk.jdi is not indirectly exported using requires public
          public static void detectJDIExitEvent(VirtualMachine vm, Consumer<String> unbiddenExitHandler) {
                                                ^
      error: warnings found and -Werror specified
      .../jdk9/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIExecutionControl.java:64: warning: [exports] interface VirtualMachine in module jdk.jdi is not indirectly exported using requires public
          protected abstract VirtualMachine vm() throws EngineTerminationException;
                             ^
      .../jdk9/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIExecutionControl.java:105: warning: [exports] interface ReferenceType in module jdk.jdi is not indirectly exported using requires public
          protected ReferenceType referenceType(VirtualMachine vm, String name) {
                    ^
      .../jdk9/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIExecutionControl.java:105: warning: [exports] interface VirtualMachine in module jdk.jdi is not indirectly exported using requires public
          protected ReferenceType referenceType(VirtualMachine vm, String name) {
                                                ^
      .../jdk9/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIDefaultExecutionControl.java:253: warning: [exports] interface VirtualMachine in module jdk.jdi is not indirectly exported using requires public
          protected synchronized VirtualMachine vm() throws EngineTerminationException {
                                 ^
      .../jdk9/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIInitiator.java:92: warning: [exports] interface VirtualMachine in module jdk.jdi is not indirectly exported using requires public
          public VirtualMachine vm() {
                 ^
      1 error
      6 warnings
      ---

      The lint will be disabled for jdk.jshell. Should jdk.jshell "requires public jdk.jdi"? Or we can suppress the warnings.

      Thanks.

            rfield Robert Field (Inactive)
            jlahoda Jan Lahoda
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: