RFR: 8296010: AssertionError in annotationTargetType [v3]

Vicente Romero vromero at openjdk.org
Wed Feb 1 05:40:11 UTC 2023


> javac is crashing if a class file is forged so that an annotation can be applicable to an unknown target. It would be equivalent to the following declaration:
> 
> 
> @Target({ElementType.FIELD, ElementType.NO_SUCH})
> @interface A {}
> 
> if the compiler process this source it would issue a compiler error, indicating that symbol `NO_SUCH` cant be found. Currently our class reader just issues a warning and move on. This is OK as it could be that the loaded class won't be used anyway but if this annotation is actually applied to symbol as in:
> 
> 
> class B {
>     @A Object o;
> }
> 
> then this to my understanding should be a compilation error. Currently javac is crashing and this is not acceptable, so this PR is fixing this issue so that a compilation error is issued instead.

Vicente Romero has updated the pull request incrementally with two additional commits since the last revision:

 - Merge branch 'JDK-8296010' of https://github.com/vicente-romero-oracle/jdk into JDK-8296010
 - updating parameter name

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12241/files
  - new: https://git.openjdk.org/jdk/pull/12241/files/59a6f3c1..e2f234bd

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

  Stats: 142 lines in 6 files changed: 102 ins; 1 del; 39 mod
  Patch: https://git.openjdk.org/jdk/pull/12241.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12241/head:pull/12241

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


More information about the compiler-dev mailing list