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

JSR269, class-files: two modules exporting the same package

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Not an Issue
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs

      Description

      Let's consider following Java sources:

      m1/module-info.java:
          module m1 { exports p; }
      m1/p/C1.java:
          package p;
          class C1 {}

      m2/module-info.java:
          module m2 { exports p; }
      m2/p/C2.java:
          package p;
          class C2 {}

      When these sources are compiled and resulted class-files are processed by annotation processor following error is produced:

      error: module reads package p from both m2 and m1
      1 error

      No annotation processing happens in this case.

      This module graph inconsistency doesn't seem critical for running annotation processing and presented behavior looks like a bug.

      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/Test65/test.sh by setting JDK_HOME variable to your JDK installation dir.
      3. Run A/Test65/test.sh.

      It outputs:

      Annotation processing of sources:
      Root element: p.C1
      Root element: p.C2
      Root element: m1
      Root element: m2
      ./modules/m1/module-info.java:1: warning: [module] module name m1 should avoid terminal digits
      module m1 {
             ^
      ./modules/m2/module-info.java:1: warning: [module] module name m2 should avoid terminal digits
      module m2 {
             ^
      2 warnings

      Annotation processing of class files:
      error: module reads package p from both m2 and m1
      1 error

        Attachments

          Activity

            People

            • Assignee:
              darcy Joe Darcy
              Reporter:
              grakov Georgiy Rakov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: