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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2
    • 9
    • 9
    • tools
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: