diff options
| -rw-r--r-- | runtime/dex/dex_file_annotations.cc | 117 | ||||
| -rw-r--r-- | runtime/dex/dex_file_annotations.h | 37 | ||||
| -rw-r--r-- | runtime/interpreter/unstarted_runtime.cc | 2 | ||||
| -rw-r--r-- | runtime/native/java_lang_Class.cc | 8 | ||||
| -rw-r--r-- | runtime/native/java_lang_reflect_Constructor.cc | 2 | ||||
| -rw-r--r-- | runtime/native/java_lang_reflect_Method.cc | 2 |
6 files changed, 89 insertions, 79 deletions
diff --git a/runtime/dex/dex_file_annotations.cc b/runtime/dex/dex_file_annotations.cc index c399b1c7fe..95b42d27d2 100644 --- a/runtime/dex/dex_file_annotations.cc +++ b/runtime/dex/dex_file_annotations.cc @@ -29,6 +29,7 @@ #include "mirror/field.h" #include "mirror/method.h" #include "oat_file.h" +#include "obj_ptr-inl.h" #include "reflection.h" #include "thread.h" #include "well_known_classes.h" @@ -116,9 +117,9 @@ class ClassData { DISALLOW_COPY_AND_ASSIGN(ClassData); }; -mirror::Object* CreateAnnotationMember(const ClassData& klass, - Handle<mirror::Class> annotation_class, - const uint8_t** annotation) +ObjPtr<mirror::Object> CreateAnnotationMember(const ClassData& klass, + Handle<mirror::Class> annotation_class, + const uint8_t** annotation) REQUIRES_SHARED(Locks::mutator_lock_); bool IsVisibilityCompatible(uint32_t actual, uint32_t expected) { @@ -333,7 +334,7 @@ const DexFile::AnnotationSetItem* FindAnnotationSetForClass(const ClassData& kla return dex_file.GetClassAnnotationSet(annotations_dir); } -mirror::Object* ProcessEncodedAnnotation(const ClassData& klass, const uint8_t** annotation) +ObjPtr<mirror::Object> ProcessEncodedAnnotation(const ClassData& klass, const uint8_t** annotation) REQUIRES_SHARED(Locks::mutator_lock_) { uint32_t type_index = DecodeUnsignedLeb128(annotation); uint32_t size = DecodeUnsignedLeb128(annotation); @@ -355,13 +356,13 @@ mirror::Object* ProcessEncodedAnnotation(const ClassData& klass, const uint8_t** } ObjPtr<mirror::Class> annotation_member_class = - soa.Decode<mirror::Class>(WellKnownClasses::libcore_reflect_AnnotationMember).Ptr(); - mirror::Class* annotation_member_array_class = + soa.Decode<mirror::Class>(WellKnownClasses::libcore_reflect_AnnotationMember); + ObjPtr<mirror::Class> annotation_member_array_class = class_linker->FindArrayClass(self, &annotation_member_class); if (annotation_member_array_class == nullptr) { return nullptr; } - mirror::ObjectArray<mirror::Object>* element_array = nullptr; + ObjPtr<mirror::ObjectArray<mirror::Object>> element_array = nullptr; if (size > 0) { element_array = mirror::ObjectArray<mirror::Object>::Alloc(self, annotation_member_array_class, size); @@ -373,7 +374,7 @@ mirror::Object* ProcessEncodedAnnotation(const ClassData& klass, const uint8_t** Handle<mirror::ObjectArray<mirror::Object>> h_element_array(hs.NewHandle(element_array)); for (uint32_t i = 0; i < size; ++i) { - mirror::Object* new_member = CreateAnnotationMember(klass, annotation_class, annotation); + ObjPtr<mirror::Object> new_member = CreateAnnotationMember(klass, annotation_class, annotation); if (new_member == nullptr) { return nullptr; } @@ -605,7 +606,7 @@ bool ProcessAnnotationValue(const ClassData& klass, return false; } if (!component_type->IsPrimitive()) { - mirror::Object* obj = new_annotation_value.value_.GetL(); + ObjPtr<mirror::Object> obj = new_annotation_value.value_.GetL(); new_array->AsObjectArray<mirror::Object>()-> SetWithoutChecks<kTransactionActive>(i, obj); } else { @@ -682,20 +683,20 @@ bool ProcessAnnotationValue(const ClassData& klass, *annotation_ptr = annotation; if (result_style == DexFile::kAllObjects && primitive_type != Primitive::kPrimVoid) { - element_object = BoxPrimitive(primitive_type, annotation_value->value_).Ptr(); + element_object = BoxPrimitive(primitive_type, annotation_value->value_); set_object = true; } if (set_object) { - annotation_value->value_.SetL(element_object.Ptr()); + annotation_value->value_.SetL(element_object); } return true; } -mirror::Object* CreateAnnotationMember(const ClassData& klass, - Handle<mirror::Class> annotation_class, - const uint8_t** annotation) { +ObjPtr<mirror::Object> CreateAnnotationMember(const ClassData& klass, + Handle<mirror::Class> annotation_class, + const uint8_t** annotation) { const DexFile& dex_file = klass.GetDexFile(); Thread* self = Thread::Current(); ScopedObjectAccessUnchecked soa(self); @@ -799,7 +800,7 @@ const DexFile::AnnotationItem* GetAnnotationItemFromAnnotationSet( return nullptr; } -mirror::Object* GetAnnotationObjectFromAnnotationSet( +ObjPtr<mirror::Object> GetAnnotationObjectFromAnnotationSet( const ClassData& klass, const DexFile::AnnotationSetItem* annotation_set, uint32_t visibility, @@ -814,11 +815,11 @@ mirror::Object* GetAnnotationObjectFromAnnotationSet( return ProcessEncodedAnnotation(klass, &annotation); } -mirror::Object* GetAnnotationValue(const ClassData& klass, - const DexFile::AnnotationItem* annotation_item, - const char* annotation_name, - Handle<mirror::Class> array_class, - uint32_t expected_type) +ObjPtr<mirror::Object> GetAnnotationValue(const ClassData& klass, + const DexFile::AnnotationItem* annotation_item, + const char* annotation_name, + Handle<mirror::Class> array_class, + uint32_t expected_type) REQUIRES_SHARED(Locks::mutator_lock_) { const DexFile& dex_file = klass.GetDexFile(); const uint8_t* annotation = @@ -864,7 +865,7 @@ mirror::ObjectArray<mirror::String>* GetSignatureValue(const ClassData& klass, if (string_array_class == nullptr) { return nullptr; } - mirror::Object* obj = + ObjPtr<mirror::Object> obj = GetAnnotationValue(klass, annotation_item, "value", string_array_class, DexFile::kDexAnnotationArray); if (obj == nullptr) { @@ -873,8 +874,9 @@ mirror::ObjectArray<mirror::String>* GetSignatureValue(const ClassData& klass, return obj->AsObjectArray<mirror::String>(); } -mirror::ObjectArray<mirror::Class>* GetThrowsValue(const ClassData& klass, - const DexFile::AnnotationSetItem* annotation_set) +ObjPtr<mirror::ObjectArray<mirror::Class>> GetThrowsValue( + const ClassData& klass, + const DexFile::AnnotationSetItem* annotation_set) REQUIRES_SHARED(Locks::mutator_lock_) { const DexFile& dex_file = klass.GetDexFile(); StackHandleScope<1> hs(Thread::Current()); @@ -890,7 +892,7 @@ mirror::ObjectArray<mirror::Class>* GetThrowsValue(const ClassData& klass, if (class_array_class == nullptr) { return nullptr; } - mirror::Object* obj = + ObjPtr<mirror::Object> obj = GetAnnotationValue(klass, annotation_item, "value", class_array_class, DexFile::kDexAnnotationArray); if (obj == nullptr) { @@ -899,7 +901,7 @@ mirror::ObjectArray<mirror::Class>* GetThrowsValue(const ClassData& klass, return obj->AsObjectArray<mirror::Class>(); } -mirror::ObjectArray<mirror::Object>* ProcessAnnotationSet( +ObjPtr<mirror::ObjectArray<mirror::Object>> ProcessAnnotationSet( const ClassData& klass, const DexFile::AnnotationSetItem* annotation_set, uint32_t visibility) @@ -930,7 +932,7 @@ mirror::ObjectArray<mirror::Object>* ProcessAnnotationSet( continue; } const uint8_t* annotation = annotation_item->annotation_; - mirror::Object* annotation_obj = ProcessEncodedAnnotation(klass, &annotation); + ObjPtr<mirror::Object> annotation_obj = ProcessEncodedAnnotation(klass, &annotation); if (annotation_obj != nullptr) { result->SetWithoutChecks<false>(dest_index, annotation_obj); ++dest_index; @@ -943,21 +945,21 @@ mirror::ObjectArray<mirror::Object>* ProcessAnnotationSet( return result.Get(); } - mirror::ObjectArray<mirror::Object>* trimmed_result = + ObjPtr<mirror::ObjectArray<mirror::Object>> trimmed_result = mirror::ObjectArray<mirror::Object>::Alloc(self, annotation_array_class.Get(), dest_index); if (trimmed_result == nullptr) { return nullptr; } for (uint32_t i = 0; i < dest_index; ++i) { - mirror::Object* obj = result->GetWithoutChecks(i); + ObjPtr<mirror::Object> obj = result->GetWithoutChecks(i); trimmed_result->SetWithoutChecks<false>(i, obj); } return trimmed_result; } -mirror::ObjectArray<mirror::Object>* ProcessAnnotationSetRefList( +ObjPtr<mirror::ObjectArray<mirror::Object>> ProcessAnnotationSetRefList( const ClassData& klass, const DexFile::AnnotationSetRefList* set_ref_list, uint32_t size) @@ -968,7 +970,7 @@ mirror::ObjectArray<mirror::Object>* ProcessAnnotationSetRefList( StackHandleScope<1> hs(self); ObjPtr<mirror::Class> annotation_array_class = soa.Decode<mirror::Class>(WellKnownClasses::java_lang_annotation_Annotation__array); - mirror::Class* annotation_array_array_class = + ObjPtr<mirror::Class> annotation_array_array_class = Runtime::Current()->GetClassLinker()->FindArrayClass(self, &annotation_array_class); if (annotation_array_array_class == nullptr) { return nullptr; @@ -982,8 +984,9 @@ mirror::ObjectArray<mirror::Object>* ProcessAnnotationSetRefList( for (uint32_t index = 0; index < size; ++index) { const DexFile::AnnotationSetRefItem* set_ref_item = &set_ref_list->list_[index]; const DexFile::AnnotationSetItem* set_item = dex_file.GetSetRefItemItem(set_ref_item); - mirror::Object* annotation_set = ProcessAnnotationSet(klass, set_item, - DexFile::kDexVisibilityRuntime); + ObjPtr<mirror::Object> annotation_set = ProcessAnnotationSet(klass, + set_item, + DexFile::kDexVisibilityRuntime); if (annotation_set == nullptr) { return nullptr; } @@ -995,7 +998,8 @@ mirror::ObjectArray<mirror::Object>* ProcessAnnotationSetRefList( namespace annotations { -mirror::Object* GetAnnotationForField(ArtField* field, Handle<mirror::Class> annotation_class) { +ObjPtr<mirror::Object> GetAnnotationForField(ArtField* field, + Handle<mirror::Class> annotation_class) { const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForField(field); if (annotation_set == nullptr) { return nullptr; @@ -1008,7 +1012,7 @@ mirror::Object* GetAnnotationForField(ArtField* field, Handle<mirror::Class> ann annotation_class); } -mirror::ObjectArray<mirror::Object>* GetAnnotationsForField(ArtField* field) { +ObjPtr<mirror::ObjectArray<mirror::Object>> GetAnnotationsForField(ArtField* field) { const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForField(field); StackHandleScope<1> hs(Thread::Current()); const ClassData field_class(hs, field); @@ -1037,7 +1041,7 @@ bool IsFieldAnnotationPresent(ArtField* field, Handle<mirror::Class> annotation_ return annotation_item != nullptr; } -mirror::Object* GetAnnotationDefaultValue(ArtMethod* method) { +ObjPtr<mirror::Object> GetAnnotationDefaultValue(ArtMethod* method) { const ClassData klass(method); const DexFile* dex_file = &klass.GetDexFile(); const DexFile::AnnotationsDirectoryItem* annotations_dir = @@ -1081,7 +1085,8 @@ mirror::Object* GetAnnotationDefaultValue(ArtMethod* method) { return annotation_value.value_.GetL(); } -mirror::Object* GetAnnotationForMethod(ArtMethod* method, Handle<mirror::Class> annotation_class) { +ObjPtr<mirror::Object> GetAnnotationForMethod(ArtMethod* method, + Handle<mirror::Class> annotation_class) { const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForMethod(method); if (annotation_set == nullptr) { return nullptr; @@ -1090,14 +1095,14 @@ mirror::Object* GetAnnotationForMethod(ArtMethod* method, Handle<mirror::Class> DexFile::kDexVisibilityRuntime, annotation_class); } -mirror::ObjectArray<mirror::Object>* GetAnnotationsForMethod(ArtMethod* method) { +ObjPtr<mirror::ObjectArray<mirror::Object>> GetAnnotationsForMethod(ArtMethod* method) { const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForMethod(method); return ProcessAnnotationSet(ClassData(method), annotation_set, DexFile::kDexVisibilityRuntime); } -mirror::ObjectArray<mirror::Class>* GetExceptionTypesForMethod(ArtMethod* method) { +ObjPtr<mirror::ObjectArray<mirror::Class>> GetExceptionTypesForMethod(ArtMethod* method) { const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForMethod(method); if (annotation_set == nullptr) { return nullptr; @@ -1105,7 +1110,7 @@ mirror::ObjectArray<mirror::Class>* GetExceptionTypesForMethod(ArtMethod* method return GetThrowsValue(ClassData(method), annotation_set); } -mirror::ObjectArray<mirror::Object>* GetParameterAnnotations(ArtMethod* method) { +ObjPtr<mirror::ObjectArray<mirror::Object>> GetParameterAnnotations(ArtMethod* method) { const DexFile* dex_file = method->GetDexFile(); const DexFile::ParameterAnnotationsItem* parameter_annotations = FindAnnotationsItemForMethod(method); @@ -1136,9 +1141,9 @@ uint32_t GetNumberOfAnnotatedMethodParameters(ArtMethod* method) { return set_ref_list->size_; } -mirror::Object* GetAnnotationForMethodParameter(ArtMethod* method, - uint32_t parameter_idx, - Handle<mirror::Class> annotation_class) { +ObjPtr<mirror::Object> GetAnnotationForMethodParameter(ArtMethod* method, + uint32_t parameter_idx, + Handle<mirror::Class> annotation_class) { const DexFile* dex_file = method->GetDexFile(); const DexFile::ParameterAnnotationsItem* parameter_annotations = FindAnnotationsItemForMethod(method); @@ -1307,8 +1312,8 @@ uint32_t GetNativeMethodAnnotationAccessFlags(const DexFile& dex_file, return access_flags; } -mirror::Object* GetAnnotationForClass(Handle<mirror::Class> klass, - Handle<mirror::Class> annotation_class) { +ObjPtr<mirror::Object> GetAnnotationForClass(Handle<mirror::Class> klass, + Handle<mirror::Class> annotation_class) { ClassData data(klass); const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForClass(data); if (annotation_set == nullptr) { @@ -1320,13 +1325,13 @@ mirror::Object* GetAnnotationForClass(Handle<mirror::Class> klass, annotation_class); } -mirror::ObjectArray<mirror::Object>* GetAnnotationsForClass(Handle<mirror::Class> klass) { +ObjPtr<mirror::ObjectArray<mirror::Object>> GetAnnotationsForClass(Handle<mirror::Class> klass) { ClassData data(klass); const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForClass(data); return ProcessAnnotationSet(data, annotation_set, DexFile::kDexVisibilityRuntime); } -mirror::ObjectArray<mirror::Class>* GetDeclaredClasses(Handle<mirror::Class> klass) { +ObjPtr<mirror::ObjectArray<mirror::Class>> GetDeclaredClasses(Handle<mirror::Class> klass) { ClassData data(klass); const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForClass(data); if (annotation_set == nullptr) { @@ -1345,7 +1350,7 @@ mirror::ObjectArray<mirror::Class>* GetDeclaredClasses(Handle<mirror::Class> kla if (class_array_class == nullptr) { return nullptr; } - mirror::Object* obj = + ObjPtr<mirror::Object> obj = GetAnnotationValue(data, annotation_item, "value", class_array_class, DexFile::kDexAnnotationArray); if (obj == nullptr) { @@ -1354,7 +1359,7 @@ mirror::ObjectArray<mirror::Class>* GetDeclaredClasses(Handle<mirror::Class> kla return obj->AsObjectArray<mirror::Class>(); } -mirror::Class* GetDeclaringClass(Handle<mirror::Class> klass) { +ObjPtr<mirror::Class> GetDeclaringClass(Handle<mirror::Class> klass) { ClassData data(klass); const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForClass(data); if (annotation_set == nullptr) { @@ -1366,17 +1371,19 @@ mirror::Class* GetDeclaringClass(Handle<mirror::Class> klass) { if (annotation_item == nullptr) { return nullptr; } - mirror::Object* obj = GetAnnotationValue(data, annotation_item, "value", - ScopedNullHandle<mirror::Class>(), - DexFile::kDexAnnotationType); + ObjPtr<mirror::Object> obj = GetAnnotationValue(data, + annotation_item, + "value", + ScopedNullHandle<mirror::Class>(), + DexFile::kDexAnnotationType); if (obj == nullptr) { return nullptr; } return obj->AsClass(); } -mirror::Class* GetEnclosingClass(Handle<mirror::Class> klass) { - mirror::Class* declaring_class = GetDeclaringClass(klass); +ObjPtr<mirror::Class> GetEnclosingClass(Handle<mirror::Class> klass) { + ObjPtr<mirror::Class> declaring_class = GetDeclaringClass(klass); if (declaring_class != nullptr) { return declaring_class; } @@ -1420,7 +1427,7 @@ mirror::Class* GetEnclosingClass(Handle<mirror::Class> klass) { return method->GetDeclaringClass(); } -mirror::Object* GetEnclosingMethod(Handle<mirror::Class> klass) { +ObjPtr<mirror::Object> GetEnclosingMethod(Handle<mirror::Class> klass) { ClassData data(klass); const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForClass(data); if (annotation_set == nullptr) { @@ -1438,7 +1445,7 @@ mirror::Object* GetEnclosingMethod(Handle<mirror::Class> klass) { DexFile::kDexAnnotationMethod); } -bool GetInnerClass(Handle<mirror::Class> klass, mirror::String** name) { +bool GetInnerClass(Handle<mirror::Class> klass, ObjPtr<mirror::String>* name) { ClassData data(klass); const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForClass(data); if (annotation_set == nullptr) { diff --git a/runtime/dex/dex_file_annotations.h b/runtime/dex/dex_file_annotations.h index 4bb0d75a57..9645a7febd 100644 --- a/runtime/dex/dex_file_annotations.h +++ b/runtime/dex/dex_file_annotations.h @@ -22,6 +22,7 @@ #include "handle.h" #include "mirror/dex_cache.h" #include "mirror/object_array.h" +#include "obj_ptr.h" namespace art { @@ -35,9 +36,10 @@ class ClassLinker; namespace annotations { // Field annotations. -mirror::Object* GetAnnotationForField(ArtField* field, Handle<mirror::Class> annotation_class) +ObjPtr<mirror::Object> GetAnnotationForField(ArtField* field, + Handle<mirror::Class> annotation_class) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::ObjectArray<mirror::Object>* GetAnnotationsForField(ArtField* field) +ObjPtr<mirror::ObjectArray<mirror::Object>> GetAnnotationsForField(ArtField* field) REQUIRES_SHARED(Locks::mutator_lock_); mirror::ObjectArray<mirror::String>* GetSignatureAnnotationForField(ArtField* field) REQUIRES_SHARED(Locks::mutator_lock_); @@ -45,21 +47,22 @@ bool IsFieldAnnotationPresent(ArtField* field, Handle<mirror::Class> annotation_ REQUIRES_SHARED(Locks::mutator_lock_); // Method annotations. -mirror::Object* GetAnnotationDefaultValue(ArtMethod* method) +ObjPtr<mirror::Object> GetAnnotationDefaultValue(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::Object* GetAnnotationForMethod(ArtMethod* method, Handle<mirror::Class> annotation_class) +ObjPtr<mirror::Object> GetAnnotationForMethod(ArtMethod* method, + Handle<mirror::Class> annotation_class) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::ObjectArray<mirror::Object>* GetAnnotationsForMethod(ArtMethod* method) +ObjPtr<mirror::ObjectArray<mirror::Object>> GetAnnotationsForMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::ObjectArray<mirror::Class>* GetExceptionTypesForMethod(ArtMethod* method) +ObjPtr<mirror::ObjectArray<mirror::Class>> GetExceptionTypesForMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::ObjectArray<mirror::Object>* GetParameterAnnotations(ArtMethod* method) +ObjPtr<mirror::ObjectArray<mirror::Object>> GetParameterAnnotations(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); uint32_t GetNumberOfAnnotatedMethodParameters(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::Object* GetAnnotationForMethodParameter(ArtMethod* method, - uint32_t parameter_idx, - Handle<mirror::Class> annotation_class) +ObjPtr<mirror::Object> GetAnnotationForMethodParameter(ArtMethod* method, + uint32_t parameter_idx, + Handle<mirror::Class> annotation_class) REQUIRES_SHARED(Locks::mutator_lock_); bool GetParametersMetadataForMethod(ArtMethod* method, MutableHandle<mirror::ObjectArray<mirror::String>>* names, @@ -85,20 +88,20 @@ uint32_t GetNativeMethodAnnotationAccessFlags(const DexFile& dex_file, uint32_t method_index); // Class annotations. -mirror::Object* GetAnnotationForClass(Handle<mirror::Class> klass, +ObjPtr<mirror::Object> GetAnnotationForClass(Handle<mirror::Class> klass, Handle<mirror::Class> annotation_class) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::ObjectArray<mirror::Object>* GetAnnotationsForClass(Handle<mirror::Class> klass) +ObjPtr<mirror::ObjectArray<mirror::Object>> GetAnnotationsForClass(Handle<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::ObjectArray<mirror::Class>* GetDeclaredClasses(Handle<mirror::Class> klass) +ObjPtr<mirror::ObjectArray<mirror::Class>> GetDeclaredClasses(Handle<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::Class* GetDeclaringClass(Handle<mirror::Class> klass) +ObjPtr<mirror::Class> GetDeclaringClass(Handle<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::Class* GetEnclosingClass(Handle<mirror::Class> klass) +ObjPtr<mirror::Class> GetEnclosingClass(Handle<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_); -mirror::Object* GetEnclosingMethod(Handle<mirror::Class> klass) +ObjPtr<mirror::Object> GetEnclosingMethod(Handle<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_); -bool GetInnerClass(Handle<mirror::Class> klass, mirror::String** name) +bool GetInnerClass(Handle<mirror::Class> klass, ObjPtr<mirror::String>* name) REQUIRES_SHARED(Locks::mutator_lock_); bool GetInnerClassFlags(Handle<mirror::Class> klass, uint32_t* flags) REQUIRES_SHARED(Locks::mutator_lock_); diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc index 791ebf09b7..0e429a63f6 100644 --- a/runtime/interpreter/unstarted_runtime.cc +++ b/runtime/interpreter/unstarted_runtime.cc @@ -510,7 +510,7 @@ void UnstartedRuntime::UnstartedClassIsAnonymousClass( result->SetZ(false); return; } - mirror::String* class_name = nullptr; + ObjPtr<mirror::String> class_name = nullptr; if (!annotations::GetInnerClass(klass, &class_name)) { result->SetZ(false); return; diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc index 68024cd1c2..9f595b1c29 100644 --- a/runtime/native/java_lang_Class.cc +++ b/runtime/native/java_lang_Class.cc @@ -648,7 +648,7 @@ static jobjectArray Class_getDeclaredAnnotations(JNIEnv* env, jobject javaThis) // Return an empty array instead of a null pointer. ObjPtr<mirror::Class> annotation_array_class = soa.Decode<mirror::Class>(WellKnownClasses::java_lang_annotation_Annotation__array); - mirror::ObjectArray<mirror::Object>* empty_array = + ObjPtr<mirror::ObjectArray<mirror::Object>> empty_array = mirror::ObjectArray<mirror::Object>::Alloc(soa.Self(), annotation_array_class.Ptr(), 0); @@ -661,7 +661,7 @@ static jobjectArray Class_getDeclaredClasses(JNIEnv* env, jobject javaThis) { ScopedFastNativeObjectAccess soa(env); StackHandleScope<1> hs(soa.Self()); Handle<mirror::Class> klass(hs.NewHandle(DecodeClass(soa, javaThis))); - mirror::ObjectArray<mirror::Class>* classes = nullptr; + ObjPtr<mirror::ObjectArray<mirror::Class>> classes = nullptr; if (!klass->IsProxyClass() && klass->GetDexCache() != nullptr) { classes = annotations::GetDeclaredClasses(klass); } @@ -738,7 +738,7 @@ static jstring Class_getInnerClassName(JNIEnv* env, jobject javaThis) { if (klass->IsProxyClass() || klass->GetDexCache() == nullptr) { return nullptr; } - mirror::String* class_name = nullptr; + ObjPtr<mirror::String> class_name = nullptr; if (!annotations::GetInnerClass(klass, &class_name)) { return nullptr; } @@ -763,7 +763,7 @@ static jboolean Class_isAnonymousClass(JNIEnv* env, jobject javaThis) { if (klass->IsProxyClass() || klass->GetDexCache() == nullptr) { return false; } - mirror::String* class_name = nullptr; + ObjPtr<mirror::String> class_name = nullptr; if (!annotations::GetInnerClass(klass, &class_name)) { return false; } diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc index a5d6c9704d..13a8d28267 100644 --- a/runtime/native/java_lang_reflect_Constructor.cc +++ b/runtime/native/java_lang_reflect_Constructor.cc @@ -38,7 +38,7 @@ static jobjectArray Constructor_getExceptionTypes(JNIEnv* env, jobject javaMetho ScopedFastNativeObjectAccess soa(env); ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod) ->GetInterfaceMethodIfProxy(kRuntimePointerSize); - mirror::ObjectArray<mirror::Class>* result_array = + ObjPtr<mirror::ObjectArray<mirror::Class>> result_array = annotations::GetExceptionTypesForMethod(method); if (result_array == nullptr) { // Return an empty array instead of a null pointer. diff --git a/runtime/native/java_lang_reflect_Method.cc b/runtime/native/java_lang_reflect_Method.cc index 2503b3cb44..52e04941c6 100644 --- a/runtime/native/java_lang_reflect_Method.cc +++ b/runtime/native/java_lang_reflect_Method.cc @@ -62,7 +62,7 @@ static jobjectArray Method_getExceptionTypes(JNIEnv* env, jobject javaMethod) { klass->GetProxyThrows()->Get(throws_index); return soa.AddLocalReference<jobjectArray>(declared_exceptions->Clone(soa.Self())); } else { - mirror::ObjectArray<mirror::Class>* result_array = + ObjPtr<mirror::ObjectArray<mirror::Class>> result_array = annotations::GetExceptionTypesForMethod(method); if (result_array == nullptr) { // Return an empty array instead of a null pointer |