RFR: 8162500: Receiver annotations of inner classes of local classes not found at runtime

Joe Darcy darcy at openjdk.org
Tue Aug 20 00:44:51 UTC 2024


On Tue, 16 Jul 2024 18:02:57 GMT, Chen Liang <liach at openjdk.org> wrote:

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

Should this behavior change (via a bug fix) have a CSR?

Are there any other combination of nested kinds of classes that should be tested as part of a fix in this area?

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

PR Comment: https://git.openjdk.org/jdk/pull/20200#issuecomment-2297755209


More information about the core-libs-dev mailing list