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

Denied access when named module accesses unreferences package from the unnamed module

XMLWordPrintable

    • b164
    • Verified

        See the attached example - unpack, fill "TEST_JAVA_HOME" into "run.sh" and execute "run.exe". Will produce:
        ---
        src/p/Test.java:1: error: Second.test() in package p2 is not accessible
        package p; public class Test { { p1.First.get().test(); } }
                                                       ^
          (package p2 is declared in module , which does not export it)
        1 error
        ---

        That is wrong, the compilation should succeed. Add:
        ---
        import p2.*;
        ---

        to src/p/Test.java allows the compilation to succeed.

        Reported here:
        http://mail.openjdk.java.net/pipermail/jdk9-dev/2017-March/005672.html
        http://mail.openjdk.java.net/pipermail/jigsaw-dev/2017-March/011755.html

              jlahoda Jan Lahoda
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: