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

NPE when compiling module-info.java with a class declaration in a non-module mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9-repo-jigsaw
    • tools
    • 9
    • b113
    • Verified

        Let's consider following directory structure:

        mod\module-info.java:
        module mod {
            exports pkg;
        }

        mod\pkg\module-info.java:
        package pkg;

        class C {
        }

        When it's compiled by [1] in a following manner:

        javac mod\module-info.java mod\pkg\module-info.java

        the output below is produced:

        An exception has occurred in the compiler (9-ea). Please file a bug against the Java compiler via th
        e Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.j
        ava.com) for duplicates. Include your program and the following diagnostic in your report. Thank you
        .
        java.lang.NullPointerException
                at com.sun.tools.javac.comp.TypeEnter$ImportsPhase.checkClassPackageClash(jdk.compiler@9-ea/
        TypeEnter.java:362)
                at com.sun.tools.javac.comp.TypeEnter$ImportsPhase.resolveImports(jdk.compiler@9-ea/TypeEnte
        r.java:342)
                at com.sun.tools.javac.comp.TypeEnter$ImportsPhase.runPhase(jdk.compiler@9-ea/TypeEnter.java
        :304)
                at com.sun.tools.javac.comp.TypeEnter$Phase.doCompleteEnvs(jdk.compiler@9-ea/TypeEnter.java:
        266)
                at com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(jdk.compiler@9-ea/TypeEnter.java:24
        4)
                at com.sun.tools.javac.comp.TypeEnter.complete(jdk.compiler@9-ea/TypeEnter.java:198)
                at com.sun.tools.javac.code.Symbol.complete(jdk.compiler@9-ea/Symbol.java:601)
                at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(jdk.compiler@9-ea/Symbol.java:1220)
                at com.sun.tools.javac.comp.Enter.complete(jdk.compiler@9-ea/Enter.java:547)
                at com.sun.tools.javac.comp.Enter.main(jdk.compiler@9-ea/Enter.java:524)
                at com.sun.tools.javac.main.JavaCompiler.enterTrees(jdk.compiler@9-ea/JavaCompiler.java:1053
        )
                at com.sun.tools.javac.main.JavaCompiler.compile(jdk.compiler@9-ea/JavaCompiler.java:917)
                at com.sun.tools.javac.main.Main.compile(jdk.compiler@9-ea/Main.java:261)
                at com.sun.tools.javac.main.Main.compile(jdk.compiler@9-ea/Main.java:143)
                at com.sun.tools.javac.Main.compile(jdk.compiler@9-ea/Main.java:55)
                at com.sun.tools.javac.Main.main(jdk.compiler@9-ea/Main.java:41)

        The minimized testcase is attached; in order to run it please:

        1. Unzip the attached archive to some dir on Windows machined, say directory A;
        2. Rename A\test\test_bat to A\test\test.bat;
        3. Modify test.bat by changing JDK_HOME variable to point to your jigsaw JDK 9 installation directory;
        4. Run test.bat.

        [1] http://download.java.net/java/jigsaw/archive/106/binaries/jigsaw-jdk-9-ea+106_windows-x86_bin.zip

              vromero Vicente Arturo Romero Zaldivar
              grakov Georgiy Rakov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: