Implement RetransformClasses
This CL implements basic support for the RetransformClasses function
and callbacks of the ClassFileLoadHook.
We do not yet support calling the ClassFileLoadHook events on first
load of class.
Bug: 32369913
Bug: 31684920
Test: mma -j40 test-art-host
Change-Id: I7959474f03f9903cc6f10ae3c06d9fd531ec7957
diff --git a/test/921-hello-failure/src/Main.java b/test/921-hello-failure/src/Main.java
index 1fe2599..43d6e9e 100644
--- a/test/921-hello-failure/src/Main.java
+++ b/test/921-hello-failure/src/Main.java
@@ -25,6 +25,7 @@
MissingInterface.doTest(new Transform2());
ReorderInterface.doTest(new Transform2());
MultiRedef.doTest(new Transform(), new Transform2());
+ MultiRetrans.doTest(new Transform(), new Transform2());
}
// Transforms the class. This throws an exception if something goes wrong.
@@ -47,7 +48,20 @@
dex_files.toArray(new byte[0][]));
}
+ public static void addMultiTransformationResults(CommonClassDefinition... defs) throws Exception {
+ for (CommonClassDefinition d : defs) {
+ addCommonTransformationResult(d.target.getCanonicalName(),
+ d.class_file_bytes,
+ d.dex_file_bytes);
+ }
+ }
+
public static native void doCommonMultiClassRedefinition(Class<?>[] targets,
byte[][] classfiles,
byte[][] dexfiles) throws Exception;
+ public static native void doCommonClassRetransformation(Class<?>... target) throws Exception;
+ public static native void enableCommonRetransformation(boolean enable);
+ public static native void addCommonTransformationResult(String target_name,
+ byte[] class_bytes,
+ byte[] dex_bytes);
}