RFR: 8162500: Receiver annotations of inner classes of local classes not found at runtime
Chen Liang
liach at openjdk.org
Tue Jul 16 18:08:07 UTC 2024
In annotated types, local and inner class types should be annotated as "top-level" types. For example, in the test here
public static Class<?> getLocalsMember() {
class Local {
class Member {
@Annot(2635) Member(@Annot(2732) Local Local.this) {}
}
}
return Local.Member.class;
}
The `Local` occurrences cannot be qualified with the enclosing class type, even if the local class may be compiled to capture the enclosing class.
However, core reflection had a bug where it looks for an enclosing class instead of a declaring class; this meant that for said `Local`, core reflection was treating the outer class as the top-level in type annotations, while the top level should be the local class instead. This patch fixes this bug.
-------------
Commit messages:
- 8162500: Receiver annotations of inner classes of local classes not found at runtime
Changes: https://git.openjdk.org/jdk/pull/20200/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20200&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8162500
Stats: 16 lines in 2 files changed: 11 ins; 0 del; 5 mod
Patch: https://git.openjdk.org/jdk/pull/20200.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/20200/head:pull/20200
PR: https://git.openjdk.org/jdk/pull/20200
More information about the core-libs-dev
mailing list