RFR: 8337795: Type annotation attached to incorrect type during class reading [v2]
Liam Miller-Cushon
cushon at openjdk.org
Sat Aug 10 19:17:08 UTC 2024
> This change fixes a bug in the logic for adding type annotations to types during class reading.
>
> The implementation searched for contained types that type annotations applied to, and then separately rewrote the type to add the annotations using `StructuralTypeMapping`, relying on the object identity of `Type` instances to keep track of them between the two passes. This produced incorrect results if the same type (with the same identity) appeared multiple times as a contained type.
>
> This fix merges the two passes into a single visitor that both locates annotated contained types, and rewrites them to add the annotations. This requires duplicating similar logic to `StructuralTypeMapping`, which seems unavoidable.
Liam Miller-Cushon has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
- Merge branch 'master' into JDK-8337795
- 8337795: Type annotation attached to incorrect type during class reading
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/20460/files
- new: https://git.openjdk.org/jdk/pull/20460/files/e801a291..a107e4fc
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=20460&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=20460&range=00-01
Stats: 29806 lines in 910 files changed: 14941 ins; 11076 del; 3789 mod
Patch: https://git.openjdk.org/jdk/pull/20460.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/20460/head:pull/20460
PR: https://git.openjdk.org/jdk/pull/20460
More information about the compiler-dev
mailing list