-
Bug
-
Resolution: Duplicate
-
P3
-
9-repo-jigsaw
In case of module has two packages with the same name, at least one of them by exports statement from another module, compiler returns warnings, but error is expected due to:
1) Modular Visibility and Accessibility wiki page:
Resolution may also fail if it computes a graph of modules where multiple modules export a package of the same name.
2) API spec of Configuration class, resolve() method:
Resolution and the post-resolution consistency checks may fail for several reasons: Two or more modules in the configuration export the same package to a module that reads both. This includes the case where a module M containing package P reads another module that exports P to M.
MINIMAL TEST CASE
Directory structure:
mod1/module-info.java
mod1/pack/B.java
mod2/module-info.java
mod2/pack/A.java
mod1 module-info:
module mod1 {
requires mod2;
}
mod2 module-info:
module mod2{
exports pack;
}
Command:
...bin/javac.exe -modulesourcepath . -d ../out mod1/pack/B.java mod2/pack/A.java
Result:
warning: package exists in another module: mod2
warning: package exists in another module: mod1
2 warnings
Tested with jigsaw b92 on Windows x64.
Same issue on Solaris.
1) Modular Visibility and Accessibility wiki page:
Resolution may also fail if it computes a graph of modules where multiple modules export a package of the same name.
2) API spec of Configuration class, resolve() method:
Resolution and the post-resolution consistency checks may fail for several reasons: Two or more modules in the configuration export the same package to a module that reads both. This includes the case where a module M containing package P reads another module that exports P to M.
MINIMAL TEST CASE
Directory structure:
mod1/module-info.java
mod1/pack/B.java
mod2/module-info.java
mod2/pack/A.java
mod1 module-info:
module mod1 {
requires mod2;
}
mod2 module-info:
module mod2{
exports pack;
}
Command:
...bin/javac.exe -modulesourcepath . -d ../out mod1/pack/B.java mod2/pack/A.java
Result:
warning: package exists in another module: mod2
warning: package exists in another module: mod1
2 warnings
Tested with jigsaw b92 on Windows x64.
Same issue on Solaris.
- duplicates
-
JDK-8136443 javac should fail to find a symbol, whose package exists in different visible modules
-
- Closed
-