RFR: JDK-8315575: Retransform of record class with record component annotation fails with CFE [v3]
Alex Menkov
amenkov at openjdk.org
Wed Mar 13 19:29:13 UTC 2024
On Wed, 13 Mar 2024 04:13:03 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
>>
>> removed attributes_count from RecordComponent
>
> src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp line 516:
>
>> 514: + component->annotations() != nullptr ? 1 : 0
>> 515: + component->type_annotations() != nullptr ? 1 : 0;
>> 516: write_u2(attributes_count);
>
> Nit: I would suggest to define this function in the `RecordComponent` class:
>
> u2 attributes_count() const {
> u2 attributes_count = generic_signature_index() != 0 ? 1 : 0
> + annotations() != nullptr ? 1 : 0
> + type_annotations() != nullptr ? 1 : 0;
> return attributes_count;
> }
RecordComponent contains information about Record attribute, but it knows nothing about class bytes and attributute_count doesn't make sense for it.
So I think this is JvmtiClassFileReconstituter responsibility to calculate a value required to generate class bytes for RecordComponent.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18161#discussion_r1523810447
More information about the serviceability-dev
mailing list