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

Mikhail Pyltsin pyltsinm at gmail.com
Mon Jan 13 17:03:53 UTC 2025


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'?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20250113/d2c2411c/attachment.htm>


More information about the compiler-dev mailing list