RFR: JDK-8315575: Retransform of record class with record component annotation fails with CFE [v3]
Alex Menkov
amenkov at openjdk.org
Thu Mar 14 22:12:38 UTC 2024
On Thu, 14 Mar 2024 02:12:29 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
> True. It should know how to put the `attribute_count` value into the class file but it does not need to know how to calculate its value. What I do not like in your model is that there is no one single place which knows how to calculate this value and the existing and potential consumers should have this knowledge.
It **must** know how to calculate the value. Because this is number of `attribute_info_attributes` attributes that follow. And only `JvmtiClassFileReconstituter` knows how many attributes it's going to write.
> The bug is that the `attributute_count` field value from the class file stored in the `RecordComponent` does not match the calculated value because the invisible attribute was not saved (was ignored).
I'd consider this as design issue with the current implementation - `JvmtiClassFileReconstituter` gets the value from external source (`RecordComponent`) and uses it without validation.
This approach is inconsistent with other `JvmtiClassFileReconstituter` code.
For other similar cases it calculates record counts in place (from size of arrays, string length, from list enumerator, etc.).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18161#discussion_r1525542056
More information about the hotspot-runtime-dev
mailing list