RFR: 8332890: Module imports don't work inside the same module

Jan Lahoda jlahoda at openjdk.org
Fri May 24 16:09:32 UTC 2024


Consider a module descriptor like:

import module m;
module m {
    exports api;
}


javac will complain `m` does not read `m`:

$ javac --enable-preview --source 23 module-info.java api/Api.java 
module-info.java:1: error: module m does not read: m
import module m;
^
Note: module-info.java uses preview features of Java SE 23.
Note: Recompile with -Xlint:preview for details.
1 error


But, readability is reflexive. The proposed solution is to simply include every module in its own readability set.

As a side fix, `env.toplevel.packge.modle` does not work for `module-info`, `env.toplevel.modle` should be used instead.

-------------

Commit messages:
 - 8332890: Module imports don't work inside the same module

Changes: https://git.openjdk.org/jdk/pull/19398/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19398&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8332890
  Stats: 61 lines in 3 files changed: 59 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/19398.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19398/head:pull/19398

PR: https://git.openjdk.org/jdk/pull/19398


More information about the compiler-dev mailing list