publicstatic ClassLoader getClassLoaderFor(String location) throws Exception { try { Class<?> class_loader_class = Class.forName("dalvik.system.PathClassLoader");
Constructor<?> ctor = class_loader_class.getConstructor(String.class, ClassLoader.class); /* on Dalvik, this is a DexFile; otherwise, it's null */ return (ClassLoader)ctor.newInstance(location + "/" + TEST_NAME + "-ex.jar",
Main.class.getClassLoader());
} catch (ClassNotFoundException e) { // Running on RI. Use URLClassLoader. returnnew java.net.URLClassLoader( new java.net.URL[] { new java.net.URL("file://" + location + "/classes-ex/") });
}
}
publicstaticvoid main(String[] args) { // Don't pop transformations. Make sure that even if 2 threads race to define the class both // will get the same result.
setPopRetransformations(false);
addCommonTransformationResult("Transform", CLASS_BYTES, DEX_BYTES);
enableCommonRetransformation(true); try { /* this is the "alternate" DEX/Jar file */
ClassLoader new_loader = getClassLoaderFor(System.getenv("DEX_LOCATION")); Class<?> klass = (Class<?>)new_loader.loadClass("TestMain"); if (klass == null) { thrownew AssertionError("loadClass failed");
}
Method run_test = klass.getMethod("runTest");
run_test.invoke(null);
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace(System.out);
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.