Separate annotations from dexfile reading.
Bug: 22322814
Change-Id: I867d66da407dd80394a10d19903ebbc1ec3986ff
Test: test-art
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index 5a4ced2..412445f 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -20,6 +20,7 @@
#include "class_linker-inl.h"
#include "common_throws.h"
#include "dex_file-inl.h"
+#include "dex_file_annotations.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
#include "mirror/field.h"
@@ -423,7 +424,7 @@
return nullptr;
}
Handle<mirror::Class> klass(hs.NewHandle(soa.Decode<mirror::Class*>(annotationType)));
- return soa.AddLocalReference<jobject>(field->GetDexFile()->GetAnnotationForField(field, klass));
+ return soa.AddLocalReference<jobject>(annotations::GetAnnotationForField(field, klass));
}
static jobjectArray Field_getDeclaredAnnotations(JNIEnv* env, jobject javaField) {
@@ -437,7 +438,7 @@
mirror::ObjectArray<mirror::Object>::Alloc(soa.Self(), annotation_array_class, 0);
return soa.AddLocalReference<jobjectArray>(empty_array);
}
- return soa.AddLocalReference<jobjectArray>(field->GetDexFile()->GetAnnotationsForField(field));
+ return soa.AddLocalReference<jobjectArray>(annotations::GetAnnotationsForField(field));
}
static jobjectArray Field_getSignatureAnnotation(JNIEnv* env, jobject javaField) {
@@ -446,8 +447,7 @@
if (field->GetDeclaringClass()->IsProxyClass()) {
return nullptr;
}
- return soa.AddLocalReference<jobjectArray>(
- field->GetDexFile()->GetSignatureAnnotationForField(field));
+ return soa.AddLocalReference<jobjectArray>(annotations::GetSignatureAnnotationForField(field));
}
static jboolean Field_isAnnotationPresentNative(JNIEnv* env, jobject javaField,
@@ -459,7 +459,7 @@
return false;
}
Handle<mirror::Class> klass(hs.NewHandle(soa.Decode<mirror::Class*>(annotationType)));
- return field->GetDexFile()->IsFieldAnnotationPresent(field, klass);
+ return annotations::IsFieldAnnotationPresent(field, klass);
}
static JNINativeMethod gMethods[] = {