Description
Consider:
---
$ cat module-info.java
import module m;
module m {
exports test;
uses Api;
}
---
---
$ cat test/Api.java
package test;
public class Api {
}
---
Compiling this yields:
---
$ javac --enable-preview --source 23 module-info.java test/Api.java
module-info.java:1: error: module m does not read: m
import module m;
^
module-info.java:5: error: cannot find symbol
uses Api;
^
symbol: class Api
Note: module-info.java uses preview features of Java SE 23.
Note: Recompile with -Xlint:preview for details.
2 errors
---
Which is wrong, as each module reads itself.
---
$ cat module-info.java
import module m;
module m {
exports test;
uses Api;
}
---
---
$ cat test/Api.java
package test;
public class Api {
}
---
Compiling this yields:
---
$ javac --enable-preview --source 23 module-info.java test/Api.java
module-info.java:1: error: module m does not read: m
import module m;
^
module-info.java:5: error: cannot find symbol
uses Api;
^
symbol: class Api
Note: module-info.java uses preview features of Java SE 23.
Note: Recompile with -Xlint:preview for details.
2 errors
---
Which is wrong, as each module reads itself.