-
Bug
-
Resolution: Not an Issue
-
P2
-
None
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
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