Require optional linking error

Paul Sandoz paul.sandoz at oracle.com
Thu Aug 9 05:00:01 PDT 2012


Hi,

If i have the following modules:

module x at 1.0 {
  requires y at 2.0;
}
module y at 2.0 {
}
module z at 1.0 {
  requires optional y at 1.0;
  requires x;
}

and javac processes module z first, then the resolver passes and module z at 1.0 will get linked to y at 2.0:

     [exec]   context +y
     [exec]     module y at 2.0
     [exec]       view y at 2.0
     [exec]     local  [y at 2.0]
     [exec]     remote [+jdk.auth+jdk.base+jdk.desktop+jdk.jndi+jdk.prefs+jdk.tls+sun.charsets+sun.localedata+sun.resources]
...
     [exec]   context +z
     [exec]     module z at 1.0
     [exec]       view z at 1.0
     [exec]     local  [z at 1.0]
     [exec]     remote [+jdk.auth+jdk.base+jdk.desktop+jdk.jndi+jdk.prefs+jdk.tls+sun.charsets+sun.localedata+sun.resources, +y, +x]
...
     [exec]   context +x
     [exec]     module x at 1.0
     [exec]       view x at 1.0
     [exec]     local  [x at 1.0]
     [exec]     remote [+jdk.auth+jdk.base+jdk.desktop+jdk.jndi+jdk.prefs+jdk.tls+sun.charsets+sun.localedata+sun.resources, +y]

This is similar to the permits issues that i previously highlighted.

It's easy to catch this error (and the one for permits) if optional dependency resolution is augmented on to result of the mandatory dependency resolution.

Paul.


More information about the jigsaw-dev mailing list