add missing files

This commit is contained in:
Jean-Philippe Bempel 2026-01-27 12:36:40 +00:00
parent 44981e6b69
commit 33f92068a0
No known key found for this signature in database
4 changed files with 11 additions and 7 deletions

View File

@ -1472,6 +1472,9 @@ jvmtiError VM_RedefineClasses::load_new_class_versions() {
}
res = merge_cp_and_rewrite(the_class, scratch_class, THREAD);
if (res != JVMTI_ERROR_NONE) {
return res;
}
if (HAS_PENDING_EXCEPTION) {
Symbol* ex_name = PENDING_EXCEPTION->klass()->name();
log_info(redefine, class, load, exceptions)("merge_cp_and_rewrite exception: '%s'", ex_name->as_C_string());
@ -2045,7 +2048,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_record_attribute(InstanceKlass* scra
AnnotationArray* type_annotations = component->type_annotations();
if (type_annotations != nullptr && type_annotations->length() != 0) {
int byte_i = 0; // byte index into annotations
if (!rewrite_cp_refs_in_annotations_typeArray(type_annotations, byte_i)) {
if (!rewrite_cp_refs_in_type_annotations_typeArray(type_annotations, byte_i, "record_info")) {
log_debug(redefine, class, annotation)("bad record_component_type_annotations at %d", i);
// propagate failure back to caller
return false;

View File

@ -33,7 +33,7 @@ public class TestRetransformRecord {
try (FileInputStream str = new FileInputStream(clsfile)) {
buf = NamedBuffer.loadBufferFromStream(str);
}
Instrumentation inst = RedefineClassHelper.instrumentation;
Instrumentation inst = RedefineClassHelper.instrumentation;
inst.addTransformer(new IdentityTransformer("MyRecord", buf), true);
inst.retransformClasses(MyRecord.class);
System.out.println(MyRecord.parse("foo"));
@ -51,10 +51,10 @@ class IdentityTransformer implements ClassFileTransformer {
@Override
public byte[] transform(ClassLoader loader,
String classPath,
Class<?> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer) {
String classPath,
Class<?> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer) {
if (classPath != null && classPath.equals(className.replace('.', '/'))) {
System.out.println("Transforming " + className);
return buffer;

View File

@ -1,3 +1,4 @@
#!/bin/sh
# move MyRecord class file created from jcod file to the altered directory
mkdir $TESTCLASSES/altered
mv $TESTCLASSES/MyRecord.class $TESTCLASSES/altered/MyRecord.class

View File

@ -107,7 +107,7 @@ public class RedefineClassHelper {
* Main method to be invoked before test to create the redefineagent.jar
*/
public static void main(String[] args) throws Exception {
String manifest = "Premain-Class: RedefineClassHelper\nCan-Redefine-Classes: true\n";
String manifest = "Premain-Class: RedefineClassHelper\nCan-Redefine-Classes: true\nCan-Retransform-Classes: true\n";
ClassFileInstaller.writeJar("redefineagent.jar", ClassFileInstaller.Manifest.fromString(manifest), "RedefineClassHelper");
}
}