From c47040d31cbcd8cddd5fadb552b4f0f6c94b5bd0 Mon Sep 17 00:00:00 2001 From: Alex Light Date: Wed, 13 Nov 2019 09:33:52 -0800 Subject: 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 --- runtime/runtime_callbacks.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'runtime/runtime_callbacks.cc') diff --git a/runtime/runtime_callbacks.cc b/runtime/runtime_callbacks.cc index ac73364ff0..e0f57c013d 100644 --- a/runtime/runtime_callbacks.cc +++ b/runtime/runtime_callbacks.cc @@ -228,6 +228,19 @@ void RuntimeCallbacks::ClassLoad(Handle klass) { } } +void RuntimeCallbacks::EndDefineClass() { + for (ClassLoadCallback* cb : COPY(class_callbacks_)) { + cb->EndDefineClass(); + } +} + +void RuntimeCallbacks::BeginDefineClass() { + for (ClassLoadCallback* cb : COPY(class_callbacks_)) { + cb->BeginDefineClass(); + } +} + + void RuntimeCallbacks::ClassPreDefine(const char* descriptor, Handle temp_class, Handle loader, -- cgit v1.2.3-59-g8ed1b