Remove some unnecessary items from WellKnownClasses.
Replace a few uses with alternatives, namely
mirror::{Constructor,Method,Field}::StaticClass().
Alternatively, we could use class roots in the ClassLinker.
And clear dalvik_system_VMRuntime_nonSdkApiUsageConsumer
in WellKnownClasses::Clear().
Test: testrunner.py --host
Bug: 74943277
Change-Id: I7561db76cd62d376c22efd4386dffd83ec74aa66
diff --git a/runtime/well_known_classes.cc b/runtime/well_known_classes.cc
index 742e713..f5d112c 100644
--- a/runtime/well_known_classes.cc
+++ b/runtime/well_known_classes.cc
@@ -58,10 +58,6 @@
jclass WellKnownClasses::java_lang_NoClassDefFoundError;
jclass WellKnownClasses::java_lang_Object;
jclass WellKnownClasses::java_lang_OutOfMemoryError;
-jclass WellKnownClasses::java_lang_reflect_Constructor;
-jclass WellKnownClasses::java_lang_reflect_Executable;
-jclass WellKnownClasses::java_lang_reflect_Field;
-jclass WellKnownClasses::java_lang_reflect_Method;
jclass WellKnownClasses::java_lang_reflect_Parameter;
jclass WellKnownClasses::java_lang_reflect_Parameter__array;
jclass WellKnownClasses::java_lang_reflect_Proxy;
@@ -145,7 +141,6 @@
jfieldID WellKnownClasses::java_lang_Throwable_stackTrace;
jfieldID WellKnownClasses::java_lang_Throwable_stackState;
jfieldID WellKnownClasses::java_lang_Throwable_suppressedExceptions;
-jfieldID WellKnownClasses::java_lang_reflect_Executable_artMethod;
jfieldID WellKnownClasses::java_lang_reflect_Proxy_h;
jfieldID WellKnownClasses::java_nio_ByteBuffer_address;
jfieldID WellKnownClasses::java_nio_ByteBuffer_hb;
@@ -333,10 +328,6 @@
java_lang_invoke_MethodHandle = CacheClass(env, "java/lang/invoke/MethodHandle");
java_lang_invoke_VarHandle = CacheClass(env, "java/lang/invoke/VarHandle");
java_lang_NoClassDefFoundError = CacheClass(env, "java/lang/NoClassDefFoundError");
- java_lang_reflect_Constructor = CacheClass(env, "java/lang/reflect/Constructor");
- java_lang_reflect_Executable = CacheClass(env, "java/lang/reflect/Executable");
- java_lang_reflect_Field = CacheClass(env, "java/lang/reflect/Field");
- java_lang_reflect_Method = CacheClass(env, "java/lang/reflect/Method");
java_lang_reflect_Parameter = CacheClass(env, "java/lang/reflect/Parameter");
java_lang_reflect_Parameter__array = CacheClass(env, "[Ljava/lang/reflect/Parameter;");
java_lang_reflect_Proxy = CacheClass(env, "java/lang/reflect/Proxy");
@@ -412,7 +403,6 @@
java_lang_Throwable_stackTrace = CacheField(env, java_lang_Throwable, false, "stackTrace", "[Ljava/lang/StackTraceElement;");
java_lang_Throwable_stackState = CacheField(env, java_lang_Throwable, false, "backtrace", "Ljava/lang/Object;");
java_lang_Throwable_suppressedExceptions = CacheField(env, java_lang_Throwable, false, "suppressedExceptions", "Ljava/util/List;");
- java_lang_reflect_Executable_artMethod = CacheField(env, java_lang_reflect_Executable, false, "artMethod", "J");
java_nio_ByteBuffer_address = CacheField(env, java_nio_ByteBuffer, false, "address", "J");
java_nio_ByteBuffer_hb = CacheField(env, java_nio_ByteBuffer, false, "hb", "[B");
java_nio_ByteBuffer_isReadOnly = CacheField(env, java_nio_ByteBuffer, false, "isReadOnly", "Z");
@@ -484,10 +474,6 @@
java_lang_NoClassDefFoundError = nullptr;
java_lang_Object = nullptr;
java_lang_OutOfMemoryError = nullptr;
- java_lang_reflect_Constructor = nullptr;
- java_lang_reflect_Executable = nullptr;
- java_lang_reflect_Field = nullptr;
- java_lang_reflect_Method = nullptr;
java_lang_reflect_Parameter = nullptr;
java_lang_reflect_Parameter__array = nullptr;
java_lang_reflect_Proxy = nullptr;
@@ -551,7 +537,7 @@
dalvik_system_DexFile_fileName = nullptr;
dalvik_system_DexPathList_dexElements = nullptr;
dalvik_system_DexPathList__Element_dexFile = nullptr;
- java_lang_reflect_Executable_artMethod = nullptr;
+ dalvik_system_VMRuntime_nonSdkApiUsageConsumer = nullptr;
java_lang_reflect_Proxy_h = nullptr;
java_lang_Thread_daemon = nullptr;
java_lang_Thread_group = nullptr;