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

Confusing error while compiling via JSR199 API using the same file manager

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Duplicate
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Subcomponent:
    • Introduced In Version:
      9

      Description

      Following compiler error is produced under following circumstances:

      ./test/p3/C3.java:1: error: unnamed package is not allowed in named modules
      package p3;
      ^

      The circumstances are:
      1. Compilation is performed via JSR199 API.
      2. StandardJavaFileManager instance is retrieved and used in compiling in module mode, that is when -modulepath and -modulesourcepath options are specified.
      3. The same StandardJavaFileManager instance which was used in step 2 is used for compiling in NON module mode, that is when -classpath option is specified and -modulepath and -modulesourcepath options are not.

      The minimized test case is attached in order to reproduce the bug please:
      1. Unzip attached archive to some dir, say A, on Unix/Linux machine.
      2. Modify A/Test31/test.sh by setting JDK_HOME variable to your JDK installation dir.
      3. Run A/Test31/test.sh.

      These steps produce following output on JDK 9 build 130:

      With the same file manager:
      Compilation in module mode succeeded
      ./test/p3/C3.java:1: error: unnamed package is not allowed in named modules
      package p3;
      ^
      Compilation in NON-module mode failed

      With fresh file manager:
      Compilation in NON-module mode succeeded

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sadayapalam Srikanth Adayapalam
                Reporter:
                grakov Georgiy Rakov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: