summaryrefslogtreecommitdiff
path: root/runtime/dex_file_annotations.cc
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2017-10-24 13:26:01 +0000
committer android-build-merger <android-build-merger@google.com> 2017-10-24 13:26:01 +0000
commit2897ca8520df514bbb70b61f3bb69ed686f160f9 (patch)
tree37738a6a7e8a73bd76dc93ec970678d73547665f /runtime/dex_file_annotations.cc
parentfa3fc51c254d726e9d5e1037726c9b2cf90965fc (diff)
parent358347ae8fcf662def560367fe35a9ed9ee3b187 (diff)
Merge "Ensure GetSourceDebugExtension works with Proxy classes."
am: 358347ae8f Change-Id: I0365076d92bfbfed0347a6b8d354c145409d94b6
Diffstat (limited to 'runtime/dex_file_annotations.cc')
-rw-r--r--runtime/dex_file_annotations.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/runtime/dex_file_annotations.cc b/runtime/dex_file_annotations.cc
index fe33bded2b..6075230f4a 100644
--- a/runtime/dex_file_annotations.cc
+++ b/runtime/dex_file_annotations.cc
@@ -134,8 +134,12 @@ const DexFile::AnnotationSetItem* FindAnnotationSetForField(ArtField* field)
REQUIRES_SHARED(Locks::mutator_lock_) {
const DexFile* dex_file = field->GetDexFile();
ObjPtr<mirror::Class> klass = field->GetDeclaringClass();
+ const DexFile::ClassDef* class_def = klass->GetClassDef();
+ if (class_def == nullptr) {
+ return nullptr;
+ }
const DexFile::AnnotationsDirectoryItem* annotations_dir =
- dex_file->GetAnnotationsDirectory(*klass->GetClassDef());
+ dex_file->GetAnnotationsDirectory(*class_def);
if (annotations_dir == nullptr) {
return nullptr;
}
@@ -258,6 +262,9 @@ const uint8_t* SearchEncodedAnnotation(const DexFile& dex_file,
const DexFile::AnnotationSetItem* FindAnnotationSetForMethod(ArtMethod* method)
REQUIRES_SHARED(Locks::mutator_lock_) {
+ if (method->IsProxyMethod()) {
+ return nullptr;
+ }
const DexFile* dex_file = method->GetDexFile();
const DexFile::AnnotationsDirectoryItem* annotations_dir =
dex_file->GetAnnotationsDirectory(method->GetClassDef());
@@ -305,8 +312,12 @@ const DexFile::ParameterAnnotationsItem* FindAnnotationsItemForMethod(ArtMethod*
const DexFile::AnnotationSetItem* FindAnnotationSetForClass(const ClassData& klass)
REQUIRES_SHARED(Locks::mutator_lock_) {
const DexFile& dex_file = klass.GetDexFile();
+ const DexFile::ClassDef* class_def = klass.GetClassDef();
+ if (class_def == nullptr) {
+ return nullptr;
+ }
const DexFile::AnnotationsDirectoryItem* annotations_dir =
- dex_file.GetAnnotationsDirectory(*klass.GetClassDef());
+ dex_file.GetAnnotationsDirectory(*class_def);
if (annotations_dir == nullptr) {
return nullptr;
}