RFR: JDK-8315575: Retransform of record class with record component annotation fails with CFE [v5]
Serguei Spitsyn
sspitsyn at openjdk.org
Wed Mar 20 03:28:20 UTC 2024
On Tue, 19 Mar 2024 21:57:38 GMT, Alex Menkov <amenkov at openjdk.org> wrote:
>> RecordComponent class has _attributes_count field.
>> The only user of the field is JvmtiClassFileReconstituter. Incorrect value of the field causes producing incorrect data for Record attribute.
>> Parsing Record attribute ClassFileParser skips unknown attributes and may skip RuntimeInvisibleAnnotations/RuntimeInvisibleTypeAnnotations.
>> Also annotations can be changed (added/removed) by class redefinition.
>> The fix removes attributes_count from RecordComponent; JvmtiClassFileReconstituter calculates correct attributes_count generating class bytes.
>>
>> Testing:
>> - tier1,tier2,hs-tier5-svc;
>> - redefineClasses/retransformClasses tests:
>> - test/jdk/java/lang/instrument
>> - test/hotspot/jtreg/serviceability/jvmti/RedefineClasses
>> - test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses
>> - test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses
>
> Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
>
> Updated the fix and the test for multiple annotations
test/jdk/java/lang/instrument/RetransformRecordAnnotation.java line 107:
> 105: newClassBytes = classBytes;
> 106: fInst.retransformClasses(targetClass);
> 107: assertTrue(targetClass.getName() + " was not seen by transform()", seenClassBytes != null);
Nit: I guess, the `targetClassName` was intended to be used in place of `targetClass.getName()`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18161#discussion_r1531472856
More information about the hotspot-runtime-dev
mailing list