On Thu, 5 Feb 2026 14:41:42 GMT, Jean-Philippe Bempel <[email protected]>
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:
>
> handle result after pending exceptions
src/hotspot/share/prims/jvmtiRedefineClasses.cpp line 2050:
> 2048: if (type_annotations != nullptr && type_annotations->length() !=
> 0) {
> 2049: int byte_i = 0; // byte index into annotations
> 2050: if
> (!rewrite_cp_refs_in_type_annotations_typeArray(type_annotations, byte_i,
> "record_info")) {
That is a very subtle distinction. I am struggling to understand what the
difference between each of these methods is and to what they apply. ?? It
doesn't help that the comments for each method seem to point tot he same
section of JVMS albeit vastly different editions and thus section numbers!
test/jdk/java/lang/instrument/RetransformRecordTypeAnn/TestRetransformRecord.java
line 41:
> 39: * @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine*=debug
> TestRetransformRecord
> 40: */
> 41:
Please add an explanatory comment outlining how the test does what it needs to
do.
test/jdk/java/lang/instrument/RetransformRecordTypeAnn/altered/MyRecord.jcod
line 23:
> 21: * questions.
> 22: */
> 23:
Please add a comment explaining what this file is, what it was based on, and
how it differs from what would appear in Java source code. Thanks.
test/jdk/java/lang/instrument/RetransformRecordTypeAnn/rename.sh line 1:
> 1: #!/bin/sh
You should not need this and we certainly do not want to introduce a shell
script in a new test. You should be able to compile the jcod file into the
desired destination directory - or at worst move it with the ClassfileInstaller.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29445#discussion_r2780731148
PR Review Comment: https://git.openjdk.org/jdk/pull/29445#discussion_r2780744521
PR Review Comment: https://git.openjdk.org/jdk/pull/29445#discussion_r2780704995
PR Review Comment: https://git.openjdk.org/jdk/pull/29445#discussion_r2780738475