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

Jan Lahoda jlahoda at openjdk.org
Mon Oct 14 06:01:49 UTC 2024


> 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:

  Reflecting review feedback - using lambda instead of an anonymous innerclass.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/21486/files
  - new: https://git.openjdk.org/jdk/pull/21486/files/c93ad264..d23195b3

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

  Stats: 39 lines in 1 file changed: 12 ins; 15 del; 12 mod
  Patch: https://git.openjdk.org/jdk/pull/21486.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21486/head:pull/21486

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


More information about the compiler-dev mailing list