Using 'transitive' modifier for 'java.base' in user's module-info.java

Jan Lahoda jan.lahoda at oracle.com
Tue Jan 14 12:34:33 UTC 2025


Hello Mikhail,


Thanks for the report, I've filled:
https://bugs.openjdk.org/browse/JDK-8347646


Jan


On 13. 01. 25 18:03, Mikhail Pyltsin wrote:
> Hi!
> I am investigating a new version of jep494
> (https://cr.openjdk.org/~gbierman/jep494/jep494-20241024/specs/module-import-declarations-jls.html#jls-7.7.1)
> This chapter allows to use `transitive` in user's module-info.java, but
> after compilation (with --enable-preview) and trying to use this file 
> I've got the error:
> `The requires entry for java.base has ACC_TRANSITIVE set`.
>
> it looks like the problem is here
> https://github.com/openjdk/jdk/blob/a7915bb2e1b822b6d9cbeb220765e8c821c71d0b/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java#L420
> It requires that classfile must be preview, but it's minor version is 
> not equal to 65535 (flag  --enable-preview  was used), because it 
> doesn't use anything from preview.
>
> Could you help me, is this behaviour expected? and how could users 
> use 'transitive'  with 'java.base' in their 'module-info.java'?
>


More information about the compiler-dev mailing list