RFR: 8374155: Add @AOTSafeClassInitializer to Record [v3]

Dan Heidinga heidinga at openjdk.org
Mon Jan 12 20:10:50 UTC 2026


On Fri, 9 Jan 2026 12:35:28 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR proposes to add the `@AOTSafeClassInitializer` annotation to the `Record` class. This allows user-created records to be annotated with `AOTSafeClassInitializer`.
>> 
>> On multiple platforms, tested and passed:
>>  - [x] tier1
>>  - [x] tier2
>>  - [x] tier3
>>  
>>  Not tested:
>>  - [ ] tier4
>>  - [ ] tier5
>>  - [ ] tier6
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add a real test

test/hotspot/jtreg/runtime/cds/appcds/aotClassLinking/GeneratedInternedString.java line 79:

> 77: }
> 78: 
> 79: // A variant using a bespoke record

Should the record class be annotated with `@AOTSafeClassInitializer` as well?

My understanding of the test framework is that it's looking for a particular error string showing bad values / objects cached in the heap archive.  Without the annotation here, we're not attempting to make the record class stay initialized in the archive...

Possible I'm missing something here but I don't think we're actually testing the record being saved in an initialized state yet

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29084#discussion_r2683747809


More information about the hotspot-runtime-dev mailing list