[jdk23u] RFR: 8341966: Broken annotated module may lead to an exception in javac [v2]

Jan Lahoda jlahoda at openjdk.org
Thu Oct 17 12:00:25 UTC 2024


> Hi all,
> 
>     This pull request contains a backport of commit [7ff4ea8d](https://github.com/openjdk/jdk/commit/7ff4ea8d01c681b90ad59be04007557d84c8db94) from the [openjdk/jdk](https://git.openjdk.org/jdk) repository.
> 
>     The commit being backported was authored by Jan Lahoda on 17 Oct 2024 and was reviewed by Adam Sotona.
> 
>     Thanks!
> 
> The original description:
> 
> Consider a `module-info.class`, that both:
>  - is wrong, so it will produce a bad-classfile error, for example due to an illegal `requires transitive java.base;`
>  - and the module is annotated
> 
> If the javac proceeds to resolve the annotations (which is not the default, but can be pushed to do it), it will crash with an `AssertionError` while trying to un-proxy the annotations. This is because there's an assert that `requestingOwner.owner.kind == MDL`, but since the module is erroneous, the kind is `ERR`, and the assert fails.
> 
> The proposal is to loosen the assert a bit, and require `requestingOwner.owner instanceof ModuleSymbol`. That should still be sufficiently strong, while permitting broken modules to be handled.

Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:

  Adjusting test to JDK 23 ClassFile API.

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

Changes:
  - all: https://git.openjdk.org/jdk23u/pull/192/files
  - new: https://git.openjdk.org/jdk23u/pull/192/files/9f8a9db7..0f468423

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk23u&pr=192&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk23u&pr=192&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk23u/pull/192.diff
  Fetch: git fetch https://git.openjdk.org/jdk23u.git pull/192/head:pull/192

PR: https://git.openjdk.org/jdk23u/pull/192


More information about the jdk-updates-dev mailing list