java_lang_Class.cc revision 54d220eb9cc51215d75b9e0fe921b94bebbb3fd6
1/* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include "java_lang_Class.h" 18 19#include "art_field-inl.h" 20#include "class_linker.h" 21#include "common_throws.h" 22#include "dex_file-inl.h" 23#include "jni_internal.h" 24#include "nth_caller_visitor.h" 25#include "mirror/class-inl.h" 26#include "mirror/class_loader.h" 27#include "mirror/field-inl.h" 28#include "mirror/method.h" 29#include "mirror/object-inl.h" 30#include "mirror/object_array-inl.h" 31#include "mirror/string-inl.h" 32#include "reflection.h" 33#include "scoped_thread_state_change.h" 34#include "scoped_fast_native_object_access.h" 35#include "ScopedLocalRef.h" 36#include "ScopedUtfChars.h" 37#include "utf.h" 38#include "well_known_classes.h" 39 40namespace art { 41 42ALWAYS_INLINE static inline mirror::Class* DecodeClass( 43 const ScopedFastNativeObjectAccess& soa, jobject java_class) 44 SHARED_REQUIRES(Locks::mutator_lock_) { 45 mirror::Class* c = soa.Decode<mirror::Class*>(java_class); 46 DCHECK(c != nullptr); 47 DCHECK(c->IsClass()); 48 // TODO: we could EnsureInitialized here, rather than on every reflective get/set or invoke . 49 // For now, we conservatively preserve the old dalvik behavior. A quick "IsInitialized" check 50 // every time probably doesn't make much difference to reflection performance anyway. 51 return c; 52} 53 54// "name" is in "binary name" format, e.g. "dalvik.system.Debug$1". 55static jclass Class_classForName(JNIEnv* env, jclass, jstring javaName, jboolean initialize, 56 jobject javaLoader) { 57 ScopedFastNativeObjectAccess soa(env); 58 ScopedUtfChars name(env, javaName); 59 if (name.c_str() == nullptr) { 60 return nullptr; 61 } 62 63 // We need to validate and convert the name (from x.y.z to x/y/z). This 64 // is especially handy for array types, since we want to avoid 65 // auto-generating bogus array classes. 66 if (!IsValidBinaryClassName(name.c_str())) { 67 soa.Self()->ThrowNewExceptionF("Ljava/lang/ClassNotFoundException;", 68 "Invalid name: %s", name.c_str()); 69 return nullptr; 70 } 71 72 std::string descriptor(DotToDescriptor(name.c_str())); 73 StackHandleScope<2> hs(soa.Self()); 74 Handle<mirror::ClassLoader> class_loader(hs.NewHandle(soa.Decode<mirror::ClassLoader*>(javaLoader))); 75 ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); 76 Handle<mirror::Class> c( 77 hs.NewHandle(class_linker->FindClass(soa.Self(), descriptor.c_str(), class_loader))); 78 if (c.Get() == nullptr) { 79 ScopedLocalRef<jthrowable> cause(env, env->ExceptionOccurred()); 80 env->ExceptionClear(); 81 jthrowable cnfe = reinterpret_cast<jthrowable>(env->NewObject(WellKnownClasses::java_lang_ClassNotFoundException, 82 WellKnownClasses::java_lang_ClassNotFoundException_init, 83 javaName, cause.get())); 84 if (cnfe != nullptr) { 85 // Make sure allocation didn't fail with an OOME. 86 env->Throw(cnfe); 87 } 88 return nullptr; 89 } 90 if (initialize) { 91 class_linker->EnsureInitialized(soa.Self(), c, true, true); 92 } 93 return soa.AddLocalReference<jclass>(c.Get()); 94} 95 96static jstring Class_getNameNative(JNIEnv* env, jobject javaThis) { 97 ScopedFastNativeObjectAccess soa(env); 98 StackHandleScope<1> hs(soa.Self()); 99 mirror::Class* const c = DecodeClass(soa, javaThis); 100 return soa.AddLocalReference<jstring>(mirror::Class::ComputeName(hs.NewHandle(c))); 101} 102 103static jobjectArray Class_getProxyInterfaces(JNIEnv* env, jobject javaThis) { 104 ScopedFastNativeObjectAccess soa(env); 105 mirror::Class* c = DecodeClass(soa, javaThis); 106 return soa.AddLocalReference<jobjectArray>(c->GetInterfaces()->Clone(soa.Self())); 107} 108 109static mirror::ObjectArray<mirror::Field>* GetDeclaredFields( 110 Thread* self, mirror::Class* klass, bool public_only, bool force_resolve) 111 SHARED_REQUIRES(Locks::mutator_lock_) { 112 StackHandleScope<1> hs(self); 113 IterationRange<StrideIterator<ArtField>> ifields = klass->GetIFields(); 114 IterationRange<StrideIterator<ArtField>> sfields = klass->GetSFields(); 115 size_t array_size = klass->NumInstanceFields() + klass->NumStaticFields(); 116 if (public_only) { 117 // Lets go subtract all the non public fields. 118 for (ArtField& field : ifields) { 119 if (!field.IsPublic()) { 120 --array_size; 121 } 122 } 123 for (ArtField& field : sfields) { 124 if (!field.IsPublic()) { 125 --array_size; 126 } 127 } 128 } 129 size_t array_idx = 0; 130 auto object_array = hs.NewHandle(mirror::ObjectArray<mirror::Field>::Alloc( 131 self, mirror::Field::ArrayClass(), array_size)); 132 if (object_array.Get() == nullptr) { 133 return nullptr; 134 } 135 for (ArtField& field : ifields) { 136 if (!public_only || field.IsPublic()) { 137 auto* reflect_field = mirror::Field::CreateFromArtField(self, &field, force_resolve); 138 if (reflect_field == nullptr) { 139 if (kIsDebugBuild) { 140 self->AssertPendingException(); 141 } 142 // Maybe null due to OOME or type resolving exception. 143 return nullptr; 144 } 145 object_array->SetWithoutChecks<false>(array_idx++, reflect_field); 146 } 147 } 148 for (ArtField& field : sfields) { 149 if (!public_only || field.IsPublic()) { 150 auto* reflect_field = mirror::Field::CreateFromArtField(self, &field, force_resolve); 151 if (reflect_field == nullptr) { 152 if (kIsDebugBuild) { 153 self->AssertPendingException(); 154 } 155 return nullptr; 156 } 157 object_array->SetWithoutChecks<false>(array_idx++, reflect_field); 158 } 159 } 160 DCHECK_EQ(array_idx, array_size); 161 return object_array.Get(); 162} 163 164static jobjectArray Class_getDeclaredFieldsUnchecked(JNIEnv* env, jobject javaThis, 165 jboolean publicOnly) { 166 ScopedFastNativeObjectAccess soa(env); 167 return soa.AddLocalReference<jobjectArray>( 168 GetDeclaredFields(soa.Self(), DecodeClass(soa, javaThis), publicOnly != JNI_FALSE, false)); 169} 170 171static jobjectArray Class_getDeclaredFields(JNIEnv* env, jobject javaThis) { 172 ScopedFastNativeObjectAccess soa(env); 173 return soa.AddLocalReference<jobjectArray>( 174 GetDeclaredFields(soa.Self(), DecodeClass(soa, javaThis), false, true)); 175} 176 177static jobjectArray Class_getPublicDeclaredFields(JNIEnv* env, jobject javaThis) { 178 ScopedFastNativeObjectAccess soa(env); 179 return soa.AddLocalReference<jobjectArray>( 180 GetDeclaredFields(soa.Self(), DecodeClass(soa, javaThis), true, true)); 181} 182 183// Performs a binary search through an array of fields, TODO: Is this fast enough if we don't use 184// the dex cache for lookups? I think CompareModifiedUtf8ToUtf16AsCodePointValues should be fairly 185// fast. 186ALWAYS_INLINE static inline ArtField* FindFieldByName( 187 Thread* self ATTRIBUTE_UNUSED, mirror::String* name, LengthPrefixedArray<ArtField>* fields) 188 SHARED_REQUIRES(Locks::mutator_lock_) { 189 if (fields == nullptr) { 190 return nullptr; 191 } 192 size_t low = 0; 193 size_t high = fields->Length(); 194 const uint16_t* const data = name->GetValue(); 195 const size_t length = name->GetLength(); 196 while (low < high) { 197 auto mid = (low + high) / 2; 198 ArtField& field = fields->At(mid); 199 int result = CompareModifiedUtf8ToUtf16AsCodePointValues(field.GetName(), data, length); 200 // Alternate approach, only a few % faster at the cost of more allocations. 201 // int result = field->GetStringName(self, true)->CompareTo(name); 202 if (result < 0) { 203 low = mid + 1; 204 } else if (result > 0) { 205 high = mid; 206 } else { 207 return &field; 208 } 209 } 210 if (kIsDebugBuild) { 211 for (ArtField& field : MakeIterationRangeFromLengthPrefixedArray(fields, sizeof(ArtField))) { 212 CHECK_NE(field.GetName(), name->ToModifiedUtf8()); 213 } 214 } 215 return nullptr; 216} 217 218ALWAYS_INLINE static inline mirror::Field* GetDeclaredField( 219 Thread* self, mirror::Class* c, mirror::String* name) 220 SHARED_REQUIRES(Locks::mutator_lock_) { 221 ArtField* art_field = FindFieldByName(self, name, c->GetIFieldsPtr()); 222 if (art_field != nullptr) { 223 return mirror::Field::CreateFromArtField(self, art_field, true); 224 } 225 art_field = FindFieldByName(self, name, c->GetSFieldsPtr()); 226 if (art_field != nullptr) { 227 return mirror::Field::CreateFromArtField(self, art_field, true); 228 } 229 return nullptr; 230} 231 232static jobject Class_getDeclaredFieldInternal(JNIEnv* env, jobject javaThis, jstring name) { 233 ScopedFastNativeObjectAccess soa(env); 234 auto* name_string = soa.Decode<mirror::String*>(name); 235 return soa.AddLocalReference<jobject>( 236 GetDeclaredField(soa.Self(), DecodeClass(soa, javaThis), name_string)); 237} 238 239static jobject Class_getDeclaredField(JNIEnv* env, jobject javaThis, jstring name) { 240 ScopedFastNativeObjectAccess soa(env); 241 auto* name_string = soa.Decode<mirror::String*>(name); 242 if (name_string == nullptr) { 243 ThrowNullPointerException("name == null"); 244 return nullptr; 245 } 246 auto* klass = DecodeClass(soa, javaThis); 247 mirror::Field* result = GetDeclaredField(soa.Self(), klass, name_string); 248 if (result == nullptr) { 249 std::string name_str = name_string->ToModifiedUtf8(); 250 // We may have a pending exception if we failed to resolve. 251 if (!soa.Self()->IsExceptionPending()) { 252 ThrowNoSuchFieldException(DecodeClass(soa, javaThis), name_str.c_str()); 253 } 254 return nullptr; 255 } 256 return soa.AddLocalReference<jobject>(result); 257} 258 259static jobject Class_getDeclaredConstructorInternal( 260 JNIEnv* env, jobject javaThis, jobjectArray args) { 261 ScopedFastNativeObjectAccess soa(env); 262 auto* klass = DecodeClass(soa, javaThis); 263 auto* params = soa.Decode<mirror::ObjectArray<mirror::Class>*>(args); 264 StackHandleScope<1> hs(soa.Self()); 265 auto* declared_constructor = klass->GetDeclaredConstructor(soa.Self(), hs.NewHandle(params)); 266 if (declared_constructor != nullptr) { 267 return soa.AddLocalReference<jobject>( 268 mirror::Constructor::CreateFromArtMethod(soa.Self(), declared_constructor)); 269 } 270 return nullptr; 271} 272 273static ALWAYS_INLINE inline bool MethodMatchesConstructor(ArtMethod* m, bool public_only) 274 SHARED_REQUIRES(Locks::mutator_lock_) { 275 DCHECK(m != nullptr); 276 return (!public_only || m->IsPublic()) && !m->IsStatic() && m->IsConstructor(); 277} 278 279static jobjectArray Class_getDeclaredConstructorsInternal( 280 JNIEnv* env, jobject javaThis, jboolean publicOnly) { 281 ScopedFastNativeObjectAccess soa(env); 282 StackHandleScope<2> hs(soa.Self()); 283 Handle<mirror::Class> h_klass = hs.NewHandle(DecodeClass(soa, javaThis)); 284 size_t constructor_count = 0; 285 // Two pass approach for speed. 286 for (auto& m : h_klass->GetDirectMethods(sizeof(void*))) { 287 constructor_count += MethodMatchesConstructor(&m, publicOnly != JNI_FALSE) ? 1u : 0u; 288 } 289 auto h_constructors = hs.NewHandle(mirror::ObjectArray<mirror::Constructor>::Alloc( 290 soa.Self(), mirror::Constructor::ArrayClass(), constructor_count)); 291 if (UNLIKELY(h_constructors.Get() == nullptr)) { 292 soa.Self()->AssertPendingException(); 293 return nullptr; 294 } 295 constructor_count = 0; 296 for (auto& m : h_klass->GetDirectMethods(sizeof(void*))) { 297 if (MethodMatchesConstructor(&m, publicOnly != JNI_FALSE)) { 298 auto* constructor = mirror::Constructor::CreateFromArtMethod(soa.Self(), &m); 299 if (UNLIKELY(constructor == nullptr)) { 300 soa.Self()->AssertPendingOOMException(); 301 return nullptr; 302 } 303 h_constructors->SetWithoutChecks<false>(constructor_count++, constructor); 304 } 305 } 306 return soa.AddLocalReference<jobjectArray>(h_constructors.Get()); 307} 308 309static jobject Class_getDeclaredMethodInternal(JNIEnv* env, jobject javaThis, 310 jobject name, jobjectArray args) { 311 // Covariant return types permit the class to define multiple 312 // methods with the same name and parameter types. Prefer to 313 // return a non-synthetic method in such situations. We may 314 // still return a synthetic method to handle situations like 315 // escalated visibility. We never return miranda methods that 316 // were synthesized by the runtime. 317 constexpr uint32_t kSkipModifiers = kAccMiranda | kAccSynthetic; 318 ScopedFastNativeObjectAccess soa(env); 319 StackHandleScope<3> hs(soa.Self()); 320 auto h_method_name = hs.NewHandle(soa.Decode<mirror::String*>(name)); 321 if (UNLIKELY(h_method_name.Get() == nullptr)) { 322 ThrowNullPointerException("name == null"); 323 return nullptr; 324 } 325 auto h_args = hs.NewHandle(soa.Decode<mirror::ObjectArray<mirror::Class>*>(args)); 326 Handle<mirror::Class> h_klass = hs.NewHandle(DecodeClass(soa, javaThis)); 327 ArtMethod* result = nullptr; 328 for (auto& m : h_klass->GetVirtualMethods(sizeof(void*))) { 329 auto* np_method = m.GetInterfaceMethodIfProxy(sizeof(void*)); 330 // May cause thread suspension. 331 mirror::String* np_name = np_method->GetNameAsString(soa.Self()); 332 if (!np_name->Equals(h_method_name.Get()) || !np_method->EqualParameters(h_args)) { 333 if (UNLIKELY(soa.Self()->IsExceptionPending())) { 334 return nullptr; 335 } 336 continue; 337 } 338 auto modifiers = m.GetAccessFlags(); 339 if ((modifiers & kSkipModifiers) == 0) { 340 return soa.AddLocalReference<jobject>(mirror::Method::CreateFromArtMethod(soa.Self(), &m)); 341 } 342 if ((modifiers & kAccMiranda) == 0) { 343 result = &m; // Remember as potential result if it's not a miranda method. 344 } 345 } 346 if (result == nullptr) { 347 for (auto& m : h_klass->GetDirectMethods(sizeof(void*))) { 348 auto modifiers = m.GetAccessFlags(); 349 if ((modifiers & kAccConstructor) != 0) { 350 continue; 351 } 352 auto* np_method = m.GetInterfaceMethodIfProxy(sizeof(void*)); 353 // May cause thread suspension. 354 mirror::String* np_name = np_method->GetNameAsString(soa.Self()); 355 if (np_name == nullptr) { 356 soa.Self()->AssertPendingException(); 357 return nullptr; 358 } 359 if (!np_name->Equals(h_method_name.Get()) || !np_method->EqualParameters(h_args)) { 360 if (UNLIKELY(soa.Self()->IsExceptionPending())) { 361 return nullptr; 362 } 363 continue; 364 } 365 if ((modifiers & kSkipModifiers) == 0) { 366 return soa.AddLocalReference<jobject>(mirror::Method::CreateFromArtMethod(soa.Self(), &m)); 367 } 368 // Direct methods cannot be miranda methods, so this potential result must be synthetic. 369 result = &m; 370 } 371 } 372 return result != nullptr ? 373 soa.AddLocalReference<jobject>(mirror::Method::CreateFromArtMethod(soa.Self(), result)) : 374 nullptr; 375} 376 377static jobjectArray Class_getDeclaredMethodsUnchecked(JNIEnv* env, jobject javaThis, 378 jboolean publicOnly) { 379 ScopedFastNativeObjectAccess soa(env); 380 StackHandleScope<2> hs(soa.Self()); 381 Handle<mirror::Class> klass = hs.NewHandle(DecodeClass(soa, javaThis)); 382 size_t num_methods = 0; 383 for (auto& m : klass->GetVirtualMethods(sizeof(void*))) { 384 auto modifiers = m.GetAccessFlags(); 385 if ((publicOnly == JNI_FALSE || (modifiers & kAccPublic) != 0) && 386 (modifiers & kAccMiranda) == 0) { 387 ++num_methods; 388 } 389 } 390 for (auto& m : klass->GetDirectMethods(sizeof(void*))) { 391 auto modifiers = m.GetAccessFlags(); 392 // Add non-constructor direct/static methods. 393 if ((publicOnly == JNI_FALSE || (modifiers & kAccPublic) != 0) && 394 (modifiers & kAccConstructor) == 0) { 395 ++num_methods; 396 } 397 } 398 auto ret = hs.NewHandle(mirror::ObjectArray<mirror::Method>::Alloc( 399 soa.Self(), mirror::Method::ArrayClass(), num_methods)); 400 num_methods = 0; 401 for (auto& m : klass->GetVirtualMethods(sizeof(void*))) { 402 auto modifiers = m.GetAccessFlags(); 403 if ((publicOnly == JNI_FALSE || (modifiers & kAccPublic) != 0) && 404 (modifiers & kAccMiranda) == 0) { 405 auto* method = mirror::Method::CreateFromArtMethod(soa.Self(), &m); 406 if (method == nullptr) { 407 soa.Self()->AssertPendingException(); 408 return nullptr; 409 } 410 ret->SetWithoutChecks<false>(num_methods++, method); 411 } 412 } 413 for (auto& m : klass->GetDirectMethods(sizeof(void*))) { 414 auto modifiers = m.GetAccessFlags(); 415 // Add non-constructor direct/static methods. 416 if ((publicOnly == JNI_FALSE || (modifiers & kAccPublic) != 0) && 417 (modifiers & kAccConstructor) == 0) { 418 auto* method = mirror::Method::CreateFromArtMethod(soa.Self(), &m); 419 if (method == nullptr) { 420 soa.Self()->AssertPendingException(); 421 return nullptr; 422 } 423 ret->SetWithoutChecks<false>(num_methods++, method); 424 } 425 } 426 return soa.AddLocalReference<jobjectArray>(ret.Get()); 427} 428 429static jobject Class_newInstance(JNIEnv* env, jobject javaThis) { 430 ScopedFastNativeObjectAccess soa(env); 431 StackHandleScope<4> hs(soa.Self()); 432 Handle<mirror::Class> klass = hs.NewHandle(DecodeClass(soa, javaThis)); 433 if (UNLIKELY(klass->GetPrimitiveType() != 0 || klass->IsInterface() || klass->IsArrayClass() || 434 klass->IsAbstract())) { 435 soa.Self()->ThrowNewExceptionF("Ljava/lang/InstantiationException;", 436 "%s cannot be instantiated", PrettyClass(klass.Get()).c_str()); 437 return nullptr; 438 } 439 auto caller = hs.NewHandle<mirror::Class>(nullptr); 440 // Verify that we can access the class. 441 if (!klass->IsPublic()) { 442 caller.Assign(GetCallingClass(soa.Self(), 1)); 443 if (caller.Get() != nullptr && !caller->CanAccess(klass.Get())) { 444 soa.Self()->ThrowNewExceptionF( 445 "Ljava/lang/IllegalAccessException;", "%s is not accessible from %s", 446 PrettyClass(klass.Get()).c_str(), PrettyClass(caller.Get()).c_str()); 447 return nullptr; 448 } 449 } 450 auto* constructor = klass->GetDeclaredConstructor( 451 soa.Self(), NullHandle<mirror::ObjectArray<mirror::Class>>()); 452 if (UNLIKELY(constructor == nullptr)) { 453 soa.Self()->ThrowNewExceptionF("Ljava/lang/InstantiationException;", 454 "%s has no zero argument constructor", 455 PrettyClass(klass.Get()).c_str()); 456 return nullptr; 457 } 458 // Invoke the string allocator to return an empty string for the string class. 459 if (klass->IsStringClass()) { 460 gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator(); 461 mirror::SetStringCountVisitor visitor(0); 462 mirror::Object* obj = mirror::String::Alloc<true>(soa.Self(), 0, allocator_type, visitor); 463 if (UNLIKELY(soa.Self()->IsExceptionPending())) { 464 return nullptr; 465 } else { 466 return soa.AddLocalReference<jobject>(obj); 467 } 468 } 469 auto receiver = hs.NewHandle(klass->AllocObject(soa.Self())); 470 if (UNLIKELY(receiver.Get() == nullptr)) { 471 soa.Self()->AssertPendingOOMException(); 472 return nullptr; 473 } 474 // Verify that we can access the constructor. 475 auto* declaring_class = constructor->GetDeclaringClass(); 476 if (!constructor->IsPublic()) { 477 if (caller.Get() == nullptr) { 478 caller.Assign(GetCallingClass(soa.Self(), 1)); 479 } 480 if (UNLIKELY(caller.Get() != nullptr && !VerifyAccess( 481 soa.Self(), receiver.Get(), declaring_class, constructor->GetAccessFlags(), 482 caller.Get()))) { 483 soa.Self()->ThrowNewExceptionF( 484 "Ljava/lang/IllegalAccessException;", "%s is not accessible from %s", 485 PrettyMethod(constructor).c_str(), PrettyClass(caller.Get()).c_str()); 486 return nullptr; 487 } 488 } 489 // Ensure that we are initialized. 490 if (UNLIKELY(!declaring_class->IsInitialized())) { 491 if (!Runtime::Current()->GetClassLinker()->EnsureInitialized( 492 soa.Self(), hs.NewHandle(declaring_class), true, true)) { 493 soa.Self()->AssertPendingException(); 494 return nullptr; 495 } 496 } 497 // Invoke the constructor. 498 JValue result; 499 uint32_t args[1] = { static_cast<uint32_t>(reinterpret_cast<uintptr_t>(receiver.Get())) }; 500 constructor->Invoke(soa.Self(), args, sizeof(args), &result, "V"); 501 if (UNLIKELY(soa.Self()->IsExceptionPending())) { 502 return nullptr; 503 } 504 // Constructors are ()V methods, so we shouldn't touch the result of InvokeMethod. 505 return soa.AddLocalReference<jobject>(receiver.Get()); 506} 507 508static JNINativeMethod gMethods[] = { 509 NATIVE_METHOD(Class, classForName, 510 "!(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;"), 511 NATIVE_METHOD(Class, getDeclaredConstructorInternal, 512 "!([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;"), 513 NATIVE_METHOD(Class, getDeclaredConstructorsInternal, "!(Z)[Ljava/lang/reflect/Constructor;"), 514 NATIVE_METHOD(Class, getDeclaredField, "!(Ljava/lang/String;)Ljava/lang/reflect/Field;"), 515 NATIVE_METHOD(Class, getDeclaredFieldInternal, "!(Ljava/lang/String;)Ljava/lang/reflect/Field;"), 516 NATIVE_METHOD(Class, getDeclaredFields, "!()[Ljava/lang/reflect/Field;"), 517 NATIVE_METHOD(Class, getDeclaredFieldsUnchecked, "!(Z)[Ljava/lang/reflect/Field;"), 518 NATIVE_METHOD(Class, getDeclaredMethodInternal, 519 "!(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;"), 520 NATIVE_METHOD(Class, getDeclaredMethodsUnchecked, 521 "!(Z)[Ljava/lang/reflect/Method;"), 522 NATIVE_METHOD(Class, getNameNative, "!()Ljava/lang/String;"), 523 NATIVE_METHOD(Class, getProxyInterfaces, "!()[Ljava/lang/Class;"), 524 NATIVE_METHOD(Class, getPublicDeclaredFields, "!()[Ljava/lang/reflect/Field;"), 525 NATIVE_METHOD(Class, newInstance, "!()Ljava/lang/Object;"), 526}; 527 528void register_java_lang_Class(JNIEnv* env) { 529 REGISTER_NATIVE_METHODS("java/lang/Class"); 530} 531 532} // namespace art 533