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

[TESTBUG] tools/javac/api/TestModuleUnnamedPackage.java fails to compile

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 14
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b24

      Description

      ## Symptom
      ```
      /home/sonia/fool/openjdk/jdk/test/langtools/tools/lib/toolbox/JavacTask.java:46: error: package com.sun.tools.javac.api is not visible
      import com.sun.tools.javac.api.JavacTaskImpl;
                                ^
        (package com.sun.tools.javac.api is declared in module jdk.compiler, which does not export it to the unnamed module)
      /home/sonia/fool/openjdk/jdk/test/langtools/tools/lib/toolbox/JavacTask.java:47: error: package com.sun.tools.javac.api is not visible
      import com.sun.tools.javac.api.JavacTool;
                                ^
        (package com.sun.tools.javac.api is declared in module jdk.compiler, which does not export it to the unnamed module)
      Note: Some input files use unchecked or unsafe operations.
      Note: Recompile with -Xlint:unchecked for details.
      2 errors

      TEST RESULT: Failed. Compilation failed: Compilation failed
      ```

      ## Fix
      ```
      diff -r 355f4f42dda5 test/langtools/tools/javac/api/TestModuleUnnamedPackage.java
      --- a/test/langtools/tools/javac/api/TestModuleUnnamedPackage.java Thu Nov 14 10:55:46 2019 +0100
      +++ b/test/langtools/tools/javac/api/TestModuleUnnamedPackage.java Thu Nov 14 22:43:17 2019 +0800
      @@ -25,7 +25,7 @@
        * @test
        * @bug 8234025
        * @summary Elements.getPackageElement(ModuleElement,CharSequence) returns null for unnamed package
      - * @modules jdk.compiler
      + * @modules jdk.compiler/com.sun.tools.javac.api jdk.compiler/com.sun.tools.javac.main
        * @library /tools/lib /tools/javac/lib
        * @build toolbox.ModuleBuilder toolbox.ToolBox
        * @run main TestModuleUnnamedPackage
      ```

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jiefu Jie Fu
              Reporter:
              jiefu Jie Fu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: