diff options
author | 2019-11-13 09:33:52 -0800 | |
---|---|---|
committer | 2019-11-26 02:11:19 +0000 | |
commit | c47040d31cbcd8cddd5fadb552b4f0f6c94b5bd0 (patch) | |
tree | 50df569420cd6746daadf1487933719d1f86d66b /openjdkjvmti/ti_extension.cc | |
parent | dc540dfffb6863177143d024dd6f491775d77585 (diff) |
Allow structural redefinition on non-final classes.
This adds support for structurally redefining non-final,
non-finalizable classes. The only restriction is that one cannot
redefine a class at the same time as any of its supertypes, if a
structural redefinition is occurring. The structural redefinition may
not remove any fields or methods, change the superclass or change the
implemented interfaces. Adding new methods or fields, both static or
non-static, public, private, protected, or package-private, is
supported.
Test: ./test.py --host
Bug: 134162467
Bug: 144168550
Change-Id: I32e9e854b3e56270170b10e8f5aba9de8f6bfdfa
Diffstat (limited to 'openjdkjvmti/ti_extension.cc')
-rw-r--r-- | openjdkjvmti/ti_extension.cc | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/openjdkjvmti/ti_extension.cc b/openjdkjvmti/ti_extension.cc index 058a188630..130169711f 100644 --- a/openjdkjvmti/ti_extension.cc +++ b/openjdkjvmti/ti_extension.cc @@ -423,29 +423,31 @@ jvmtiError ExtensionUtil::GetExtensionFunctions(jvmtiEnv* env, reinterpret_cast<jvmtiExtensionFunction>(Redefiner::StructurallyRedefineClasses), "com.android.art.class.structurally_redefine_classes", "Entrypoint for structural class redefinition. Has the same signature as RedefineClasses." - " Currently this only supports adding new static fields to a class without any instance" - " fields or methods. After calling this com.android.art.structural_dex_file_load_hook" - " events will be triggered, followed by re-transformable ClassFileLoadHook events. After" - " this method completes subsequent RetransformClasses calls will use the input to this" - " function as the initial class definition.", + " Currently does not support redefining a class and any of its supertypes at the same time." + " Only supports additive changes, methods and fields may not be removed. Supertypes and" + " implemented interfaces may not be changed. After calling this" + " com.android.art.structural_dex_file_load_hook events will be triggered, followed by" + " re-transformable ClassFileLoadHook events. After this method completes subsequent" + " RetransformClasses calls will use the input to this function as the initial class" + " definition.", { - { "num_classes", JVMTI_KIND_IN, JVMTI_TYPE_JINT, false }, - { "class_definitions", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CVOID, false }, + { "num_classes", JVMTI_KIND_IN, JVMTI_TYPE_JINT, false }, + { "class_definitions", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CVOID, false }, }, { - ERR(CLASS_LOADER_UNSUPPORTED), - ERR(FAILS_VERIFICATION), - ERR(ILLEGAL_ARGUMENT), - ERR(INVALID_CLASS), - ERR(MUST_POSSESS_CAPABILITY), - ERR(MUST_POSSESS_CAPABILITY), - ERR(NULL_POINTER), - ERR(OUT_OF_MEMORY), - ERR(UNMODIFIABLE_CLASS), - ERR(UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED), - ERR(UNSUPPORTED_REDEFINITION_METHOD_ADDED), - ERR(UNSUPPORTED_REDEFINITION_METHOD_DELETED), - ERR(UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED), + ERR(CLASS_LOADER_UNSUPPORTED), + ERR(FAILS_VERIFICATION), + ERR(ILLEGAL_ARGUMENT), + ERR(INVALID_CLASS), + ERR(MUST_POSSESS_CAPABILITY), + ERR(MUST_POSSESS_CAPABILITY), + ERR(NULL_POINTER), + ERR(OUT_OF_MEMORY), + ERR(UNMODIFIABLE_CLASS), + ERR(UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED), + ERR(UNSUPPORTED_REDEFINITION_METHOD_ADDED), + ERR(UNSUPPORTED_REDEFINITION_METHOD_DELETED), + ERR(UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED), }); if (error != ERR(NONE)) { return error; |