RFR: 8376185: NoSuchFieldError thrown after a record with type annotation retransformed [v6]
Chen Liang
liach at openjdk.org
Thu Feb 26 22:52:18 UTC 2026
On Thu, 12 Feb 2026 13:47:49 GMT, Jean-Philippe Bempel <jpbempel at openjdk.org> wrote:
>> …retransformed
>>
>> Fix a retransform error when retransforming a record with type annotation. processing the record type annotation was done by calling the wrong method and using the one to process regular annotation. Regular annotations have not the same structure and decoding was therefore incorrect. The decoding methods detect a problem but this error was not propagated correctly outside of VM_RedfineClass::load_new_class_versions method, swallowing the error and leaving the retransformed class in bad state.
>>
>> Here we have fixed the call to the right method for decoding the type annotations but also propagated the error when rewriting the constant pool as an JVMTI_ERROR_INTERNAL
>
> Jean-Philippe Bempel has updated the pull request incrementally with one additional commit since the last revision:
>
> fix whitespaces
test/jdk/java/lang/instrument/RetransformRecordTypeAnn/TestRetransformRecord.java line 36:
> 34: * @compile ../NamedBuffer.java
> 35: * @run driver RunAsmTools altered/MyRecord.jcod altered
> 36: * @compile MyRecord.java
It is always risky to assume stability in javac output, even with `--release` flag - javac can always have translation strategy improvements that bring in potentially unwanted changes to the resulting class files.
I recommend just having two versions of `MyRecord.jcod` so they are both stable, and it's easier for readers to notice their difference.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29445#discussion_r2861677191
More information about the serviceability-dev
mailing list