Collapse ART's AbstractMethod class into Executable
After the OpenJDK 8 pull there is now a common base class
for Method and Constructor that can be used instead.
Methods that are abstract on Executable but on Android
were implemented in AbstractMethod are now consistently
renamed to "{method}Internal", declared final and
given package-protected access.
For consistency with all other private, natively
implemented methods, the method getDeclaredAnnotations()
has been renamed getDeclaredAnnotationsNative().
Bug: 28666126
Bug: 31052885
Test: make test-art-host and cts run of CtsLibcoreTestCases
Change-Id: Ibfe6af6a47fe0cfffd0859ffbe58980aeb84e053
diff --git a/runtime/native/java_lang_reflect_AbstractMethod.cc b/runtime/native/java_lang_reflect_Executable.cc
similarity index 77%
rename from runtime/native/java_lang_reflect_AbstractMethod.cc
rename to runtime/native/java_lang_reflect_Executable.cc
index 254f8db..8fcf6ac 100644
--- a/runtime/native/java_lang_reflect_AbstractMethod.cc
+++ b/runtime/native/java_lang_reflect_Executable.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "java_lang_reflect_AbstractMethod.h"
+#include "java_lang_reflect_Executable.h"
#include "art_method-inl.h"
#include "dex_file_annotations.h"
@@ -28,7 +28,7 @@
namespace art {
-static jobjectArray AbstractMethod_getDeclaredAnnotations(JNIEnv* env, jobject javaMethod) {
+static jobjectArray Executable_getDeclaredAnnotationsNative(JNIEnv* env, jobject javaMethod) {
ScopedFastNativeObjectAccess soa(env);
ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod);
if (method->GetDeclaringClass()->IsProxyClass()) {
@@ -42,7 +42,7 @@
return soa.AddLocalReference<jobjectArray>(annotations::GetAnnotationsForMethod(method));
}
-static jobject AbstractMethod_getAnnotationNative(JNIEnv* env,
+static jobject Executable_getAnnotationNative(JNIEnv* env,
jobject javaMethod,
jclass annotationType) {
ScopedFastNativeObjectAccess soa(env);
@@ -56,7 +56,7 @@
}
}
-static jobjectArray AbstractMethod_getSignatureAnnotation(JNIEnv* env, jobject javaMethod) {
+static jobjectArray Executable_getSignatureAnnotation(JNIEnv* env, jobject javaMethod) {
ScopedFastNativeObjectAccess soa(env);
ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod);
if (method->GetDeclaringClass()->IsProxyClass()) {
@@ -67,7 +67,7 @@
}
-static jobjectArray AbstractMethod_getParameterAnnotationsNative(JNIEnv* env, jobject javaMethod) {
+static jobjectArray Executable_getParameterAnnotationsNative(JNIEnv* env, jobject javaMethod) {
ScopedFastNativeObjectAccess soa(env);
ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod);
if (method->IsProxyMethod()) {
@@ -77,7 +77,7 @@
}
}
-static jboolean AbstractMethod_isAnnotationPresentNative(JNIEnv* env,
+static jboolean Executable_isAnnotationPresentNative(JNIEnv* env,
jobject javaMethod,
jclass annotationType) {
ScopedFastNativeObjectAccess soa(env);
@@ -91,17 +91,17 @@
}
static JNINativeMethod gMethods[] = {
- NATIVE_METHOD(AbstractMethod, getAnnotationNative,
+ NATIVE_METHOD(Executable, getAnnotationNative,
"!(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;"),
- NATIVE_METHOD(AbstractMethod, getDeclaredAnnotations, "!()[Ljava/lang/annotation/Annotation;"),
- NATIVE_METHOD(AbstractMethod, getParameterAnnotationsNative,
+ NATIVE_METHOD(Executable, getDeclaredAnnotationsNative, "!()[Ljava/lang/annotation/Annotation;"),
+ NATIVE_METHOD(Executable, getParameterAnnotationsNative,
"!()[[Ljava/lang/annotation/Annotation;"),
- NATIVE_METHOD(AbstractMethod, getSignatureAnnotation, "!()[Ljava/lang/String;"),
- NATIVE_METHOD(AbstractMethod, isAnnotationPresentNative, "!(Ljava/lang/Class;)Z"),
+ NATIVE_METHOD(Executable, getSignatureAnnotation, "!()[Ljava/lang/String;"),
+ NATIVE_METHOD(Executable, isAnnotationPresentNative, "!(Ljava/lang/Class;)Z"),
};
-void register_java_lang_reflect_AbstractMethod(JNIEnv* env) {
- REGISTER_NATIVE_METHODS("java/lang/reflect/AbstractMethod");
+void register_java_lang_reflect_Executable(JNIEnv* env) {
+ REGISTER_NATIVE_METHODS("java/lang/reflect/Executable");
}
} // namespace art
diff --git a/runtime/native/java_lang_reflect_AbstractMethod.h b/runtime/native/java_lang_reflect_Executable.h
similarity index 72%
rename from runtime/native/java_lang_reflect_AbstractMethod.h
rename to runtime/native/java_lang_reflect_Executable.h
index 222e5a0..0cfed62 100644
--- a/runtime/native/java_lang_reflect_AbstractMethod.h
+++ b/runtime/native/java_lang_reflect_Executable.h
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_NATIVE_JAVA_LANG_REFLECT_ABSTRACTMETHOD_H_
-#define ART_RUNTIME_NATIVE_JAVA_LANG_REFLECT_ABSTRACTMETHOD_H_
+#ifndef ART_RUNTIME_NATIVE_JAVA_LANG_REFLECT_EXECUTABLE_H_
+#define ART_RUNTIME_NATIVE_JAVA_LANG_REFLECT_EXECUTABLE_H_
#include <jni.h>
namespace art {
-void register_java_lang_reflect_AbstractMethod(JNIEnv* env);
+void register_java_lang_reflect_Executable(JNIEnv* env);
} // namespace art
-#endif // ART_RUNTIME_NATIVE_JAVA_LANG_REFLECT_ABSTRACTMETHOD_H_
+#endif // ART_RUNTIME_NATIVE_JAVA_LANG_REFLECT_EXECUTABLE_H_