diff options
author | 2017-02-14 11:10:34 -0800 | |
---|---|---|
committer | 2017-02-14 11:44:48 -0800 | |
commit | fa4333dcb481e564f54726b4e6f8153612df835e (patch) | |
tree | ae597c7587dc214434a180962c4373d3748f51ab | |
parent | 2d98ba68f13dc219c088a12f369c5778bf398f14 (diff) |
ART: Add operator == and != with nullptr to Handle
Get it in line with ObjPtr and prettify our code.
Test: m
Change-Id: I1322e2a9bc7a85d7f2441034a19bf4d807b81a0e
60 files changed, 324 insertions, 316 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 7af850a263..f7bea32d4c 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -960,7 +960,7 @@ static void EnsureVerifiedOrVerifyAtRuntime(jobject jclass_loader, const DexFile::ClassDef& class_def = dex_file->GetClassDef(i); const char* descriptor = dex_file->GetClassDescriptor(class_def); cls.Assign(class_linker->FindClass(soa.Self(), descriptor, class_loader)); - if (cls.Get() == nullptr) { + if (cls == nullptr) { soa.Self()->ClearException(); } else if (&cls->GetDexFile() == dex_file) { DCHECK(cls->IsErroneous() || cls->IsVerified() || cls->IsCompileTimeVerified()) @@ -1155,7 +1155,7 @@ void CompilerDriver::LoadImageClasses(TimingLogger* timings) { StackHandleScope<1> hs(self); Handle<mirror::Class> klass( hs.NewHandle(class_linker->FindSystemClass(self, descriptor.c_str()))); - if (klass.Get() == nullptr) { + if (klass == nullptr) { VLOG(compiler) << "Failed to find class " << descriptor; image_classes_->erase(it++); self->ClearException(); @@ -1182,13 +1182,13 @@ void CompilerDriver::LoadImageClasses(TimingLogger* timings) { Handle<mirror::DexCache> dex_cache(hs2.NewHandle(class_linker->RegisterDexFile(*dex_file, nullptr))); Handle<mirror::Class> klass(hs2.NewHandle( - (dex_cache.Get() != nullptr) + (dex_cache != nullptr) ? class_linker->ResolveType(*dex_file, exception_type_idx, dex_cache, ScopedNullHandle<mirror::ClassLoader>()) : nullptr)); - if (klass.Get() == nullptr) { + if (klass == nullptr) { const DexFile::TypeId& type_id = dex_file->GetTypeId(exception_type_idx); const char* descriptor = dex_file->GetTypeDescriptor(type_id); LOG(FATAL) << "Failed to resolve class " << descriptor; @@ -1877,7 +1877,7 @@ class ResolveTypeVisitor : public CompilationVisitor { Handle<mirror::DexCache> dex_cache(hs.NewHandle(class_linker->RegisterDexFile( dex_file, class_loader.Get()))); - ObjPtr<mirror::Class> klass = (dex_cache.Get() != nullptr) + ObjPtr<mirror::Class> klass = (dex_cache != nullptr) ? class_linker->ResolveType(dex_file, dex::TypeIndex(type_idx), dex_cache, class_loader) : nullptr; @@ -1978,7 +1978,7 @@ static void LoadAndUpdateStatus(const DexFile& dex_file, ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); Handle<mirror::Class> cls(hs.NewHandle<mirror::Class>( class_linker->FindClass(self, descriptor, class_loader))); - if (cls.Get() != nullptr) { + if (cls != nullptr) { // Check that the class is resolved with the current dex file. We might get // a boot image class, or a class in a different dex file for multidex, and // we should not update the status in that case. @@ -2126,7 +2126,7 @@ class VerifyClassVisitor : public CompilationVisitor { Handle<mirror::Class> klass( hs.NewHandle(class_linker->FindClass(soa.Self(), descriptor, class_loader))); verifier::MethodVerifier::FailureKind failure_kind; - if (klass.Get() == nullptr) { + if (klass == nullptr) { CHECK(soa.Self()->IsExceptionPending()); soa.Self()->ClearException(); @@ -2228,7 +2228,7 @@ class SetVerifiedClassVisitor : public CompilationVisitor { Handle<mirror::Class> klass( hs.NewHandle(class_linker->FindClass(soa.Self(), descriptor, class_loader))); // Class might have failed resolution. Then don't set it to verified. - if (klass.Get() != nullptr) { + if (klass != nullptr) { // Only do this if the class is resolved. If even resolution fails, quickening will go very, // very wrong. if (klass->IsResolved() && !klass->IsErroneousResolved()) { @@ -2290,7 +2290,7 @@ class InitializeClassVisitor : public CompilationVisitor { Handle<mirror::Class> klass( hs.NewHandle(manager_->GetClassLinker()->FindClass(soa.Self(), descriptor, class_loader))); - if (klass.Get() != nullptr && !SkipClass(jclass_loader, dex_file, klass.Get())) { + if (klass != nullptr && !SkipClass(jclass_loader, dex_file, klass.Get())) { // Only try to initialize classes that were successfully verified. if (klass->IsVerified()) { // Attempt to initialize the class but bail if we either need to initialize the super-class @@ -2540,7 +2540,7 @@ class CompileClassVisitor : public CompilationVisitor { Handle<mirror::Class> klass( hs.NewHandle(class_linker->FindClass(soa.Self(), descriptor, class_loader))); Handle<mirror::DexCache> dex_cache; - if (klass.Get() == nullptr) { + if (klass == nullptr) { soa.Self()->AssertPendingException(); soa.Self()->ClearException(); dex_cache = hs.NewHandle(class_linker->FindDexCache(soa.Self(), dex_file)); diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc index c72edb18a3..26f3ecd9be 100644 --- a/compiler/image_writer.cc +++ b/compiler/image_writer.cc @@ -1078,7 +1078,7 @@ ObjectArray<Object>* ImageWriter::CreateImageRoots(size_t oat_index) const { } Handle<ObjectArray<Object>> dex_caches( hs.NewHandle(ObjectArray<Object>::Alloc(self, object_array_class.Get(), dex_cache_count))); - CHECK(dex_caches.Get() != nullptr) << "Failed to allocate a dex cache array."; + CHECK(dex_caches != nullptr) << "Failed to allocate a dex cache array."; { ReaderMutexLock mu(self, *Locks::dex_lock_); size_t non_image_dex_caches = 0; diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index d68aa51b1b..bac16cd5df 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -1419,7 +1419,7 @@ void CodeGenerator::EmitJitRoots(uint8_t* code, QuickEntrypointEnum CodeGenerator::GetArrayAllocationEntrypoint(Handle<mirror::Class> array_klass) { ScopedObjectAccess soa(Thread::Current()); - if (array_klass.Get() == nullptr) { + if (array_klass == nullptr) { // This can only happen for non-primitive arrays, as primitive arrays can always // be resolved. return kQuickAllocArrayResolved32; diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index f0afccb782..f1e8239f76 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -380,7 +380,7 @@ bool HInliner::TryInline(HInvoke* invoke_instruction) { soa.Self(), class_linker->GetClassRoot(ClassLinker::kClassArrayClass), InlineCache::kIndividualCacheSize)); - if (inline_cache.Get() == nullptr) { + if (inline_cache == nullptr) { // We got an OOME. Just clear the exception, and don't inline. DCHECK(soa.Self()->IsExceptionPending()); soa.Self()->ClearException(); diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index a1c391f455..3374e42955 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -680,7 +680,7 @@ ArtMethod* HInstructionBuilder::ResolveMethod(uint16_t method_idx, InvokeType in Handle<mirror::Class> methods_class(hs.NewHandle(class_linker->ResolveReferencedClassOfMethod( method_idx, dex_compilation_unit_->GetDexCache(), class_loader))); - if (UNLIKELY(methods_class.Get() == nullptr)) { + if (UNLIKELY(methods_class == nullptr)) { // Clean up any exception left by type resolution. soa.Self()->ClearException(); return nullptr; @@ -702,7 +702,7 @@ ArtMethod* HInstructionBuilder::ResolveMethod(uint16_t method_idx, InvokeType in // Check access. The class linker has a fast path for looking into the dex cache // and does not check the access if it hits it. - if (compiling_class.Get() == nullptr) { + if (compiling_class == nullptr) { if (!resolved_method->IsPublic()) { return nullptr; } @@ -718,7 +718,7 @@ ArtMethod* HInstructionBuilder::ResolveMethod(uint16_t method_idx, InvokeType in // make this an invoke-unresolved to handle cross-dex invokes or abstract super methods, both of // which require runtime handling. if (invoke_type == kSuper) { - if (compiling_class.Get() == nullptr) { + if (compiling_class == nullptr) { // We could not determine the method's class we need to wait until runtime. DCHECK(Runtime::Current()->IsAotCompiler()); return nullptr; @@ -954,7 +954,7 @@ bool HInstructionBuilder::BuildNewInstance(dex::TypeIndex type_index, uint32_t d } // Consider classes we haven't resolved as potentially finalizable. - bool finalizable = (klass.Get() == nullptr) || klass->IsFinalizable(); + bool finalizable = (klass == nullptr) || klass->IsFinalizable(); AppendInstruction(new (arena_) HNewInstance( cls, @@ -972,7 +972,7 @@ static bool IsSubClass(mirror::Class* to_test, mirror::Class* super_class) } bool HInstructionBuilder::IsInitialized(Handle<mirror::Class> cls) const { - if (cls.Get() == nullptr) { + if (cls == nullptr) { return false; } @@ -1292,7 +1292,7 @@ bool HInstructionBuilder::IsOutermostCompilingClass(dex::TypeIndex type_index) c // When this happens we cannot establish a direct relation between the current // class and the outer class, so we return false. // (Note that this is only used for optimizing invokes and field accesses) - return (cls.Get() != nullptr) && (outer_class.Get() == cls.Get()); + return (cls != nullptr) && (outer_class.Get() == cls.Get()); } void HInstructionBuilder::BuildUnresolvedStaticFieldAccess(const Instruction& instruction, @@ -1340,7 +1340,7 @@ ArtField* HInstructionBuilder::ResolveField(uint16_t field_idx, bool is_static, } // Check access. - if (compiling_class.Get() == nullptr) { + if (compiling_class == nullptr) { if (!resolved_field->IsPublic()) { return nullptr; } @@ -1612,7 +1612,7 @@ void HInstructionBuilder::BuildFillWideArrayData(HInstruction* object, static TypeCheckKind ComputeTypeCheckKind(Handle<mirror::Class> cls) REQUIRES_SHARED(Locks::mutator_lock_) { - if (cls.Get() == nullptr) { + if (cls == nullptr) { return TypeCheckKind::kUnresolvedCheck; } else if (cls->IsInterface()) { return TypeCheckKind::kInterfaceCheck; @@ -1643,7 +1643,7 @@ HLoadClass* HInstructionBuilder::BuildLoadClass(dex::TypeIndex type_index, uint3 soa, dex_compilation_unit_->GetDexCache(), class_loader, type_index, dex_compilation_unit_)); bool needs_access_check = true; - if (klass.Get() != nullptr) { + if (klass != nullptr) { if (klass->IsPublic()) { needs_access_check = false; } else { @@ -1679,7 +1679,7 @@ HLoadClass* HInstructionBuilder::BuildLoadClass(dex::TypeIndex type_index, type_index, *actual_dex_file, klass, - klass.Get() != nullptr && (klass.Get() == GetOutermostCompilingClass()), + klass != nullptr && (klass.Get() == GetOutermostCompilingClass()), dex_pc, needs_access_check); diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 727ca7d893..8638e346fb 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -1214,7 +1214,7 @@ bool OptimizingCompiler::JitCompile(Thread* self, Handle<mirror::ObjectArray<mirror::Object>> roots( hs.NewHandle(mirror::ObjectArray<mirror::Object>::Alloc( self, class_linker->GetClassRoot(ClassLinker::kObjectArrayClass), number_of_roots))); - if (roots.Get() == nullptr) { + if (roots == nullptr) { // Out of memory, just clear the exception to avoid any Java exception uncaught problems. DCHECK(self->IsExceptionPending()); self->ClearException(); diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc index f07f02a719..be400925d5 100644 --- a/compiler/optimizing/sharpening.cc +++ b/compiler/optimizing/sharpening.cc @@ -163,7 +163,7 @@ HLoadClass::LoadKind HSharpening::SharpenClass(HLoadClass* load_class, if (!compiler_driver->GetSupportBootImageFixup()) { // compiler_driver_test. Do not sharpen. desired_load_kind = HLoadClass::LoadKind::kDexCacheViaMethod; - } else if ((klass.Get() != nullptr) && compiler_driver->IsImageClass( + } else if ((klass != nullptr) && compiler_driver->IsImageClass( dex_file.StringDataByIdx(dex_file.GetTypeId(type_index).descriptor_idx_))) { is_in_boot_image = true; desired_load_kind = codegen->GetCompilerOptions().GetCompilePic() @@ -175,7 +175,7 @@ HLoadClass::LoadKind HSharpening::SharpenClass(HLoadClass* load_class, desired_load_kind = HLoadClass::LoadKind::kBssEntry; } } else { - is_in_boot_image = (klass.Get() != nullptr) && + is_in_boot_image = (klass != nullptr) && runtime->GetHeap()->ObjectIsInBootImageSpace(klass.Get()); if (runtime->UseJitCompilation()) { // TODO: Make sure we don't set the "compile PIC" flag for JIT as that's bogus. @@ -183,7 +183,7 @@ HLoadClass::LoadKind HSharpening::SharpenClass(HLoadClass* load_class, if (is_in_boot_image) { // TODO: Use direct pointers for all non-moving spaces, not just boot image. Bug: 29530787 desired_load_kind = HLoadClass::LoadKind::kBootImageAddress; - } else if (klass.Get() != nullptr) { + } else if (klass != nullptr) { desired_load_kind = HLoadClass::LoadKind::kJitTableAddress; } else { // Class not loaded yet. This happens when the dex code requesting diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc index 5fc9972d09..c892b25ed3 100644 --- a/compiler/verifier_deps_test.cc +++ b/compiler/verifier_deps_test.cc @@ -233,7 +233,7 @@ class VerifierDepsTest : public CommonCompilerTest { const DexFile::ClassDef& class_def = dex_file->GetClassDef(i); const char* descriptor = dex_file->GetClassDescriptor(class_def); cls.Assign(class_linker_->FindClass(soa.Self(), descriptor, class_loader_handle)); - if (cls.Get() == nullptr) { + if (cls == nullptr) { CHECK(soa.Self()->IsExceptionPending()); soa.Self()->ClearException(); } else if (set.find(class_def.class_idx_) == set.end()) { diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index ce63e18921..9a3b28b16e 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -1473,7 +1473,7 @@ class OatDumper { Runtime* const runtime = Runtime::Current(); Handle<mirror::DexCache> dex_cache( hs->NewHandle(runtime->GetClassLinker()->RegisterDexFile(*dex_file, nullptr))); - CHECK(dex_cache.Get() != nullptr); + CHECK(dex_cache != nullptr); DCHECK(options_.class_loader_ != nullptr); return verifier::MethodVerifier::VerifyMethodAndDump( soa.Self(), vios, dex_method_idx, dex_file, dex_cache, *options_.class_loader_, @@ -2950,7 +2950,7 @@ class IMTDumper { const DexFile::ClassDef& class_def = dex_file->GetClassDef(class_def_index); const char* descriptor = dex_file->GetClassDescriptor(class_def); h_klass.Assign(class_linker->FindClass(self, descriptor, h_class_loader)); - if (h_klass.Get() == nullptr) { + if (h_klass == nullptr) { std::cerr << "Warning: could not load " << descriptor << std::endl; continue; } diff --git a/runtime/arch/stub_test.cc b/runtime/arch/stub_test.cc index 0bf08a6d97..207bf9d365 100644 --- a/runtime/arch/stub_test.cc +++ b/runtime/arch/stub_test.cc @@ -984,7 +984,7 @@ TEST_F(StubTest, AllocObject) { while (length > 10) { Handle<mirror::Object> h(hsp->NewHandle<mirror::Object>( mirror::ObjectArray<mirror::Object>::Alloc(soa.Self(), ca.Get(), length / 4))); - if (self->IsExceptionPending() || h.Get() == nullptr) { + if (self->IsExceptionPending() || h == nullptr) { self->ClearException(); // Try a smaller length @@ -1003,7 +1003,7 @@ TEST_F(StubTest, AllocObject) { // Allocate simple objects till it fails. while (!self->IsExceptionPending()) { Handle<mirror::Object> h = hsp->NewHandle(c->AllocObject(soa.Self())); - if (!self->IsExceptionPending() && h.Get() != nullptr) { + if (!self->IsExceptionPending() && h != nullptr) { handles.push_back(h); } } diff --git a/runtime/art_method.cc b/runtime/art_method.cc index 4902ad42d7..6b52959ee7 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -274,7 +274,7 @@ uint32_t ArtMethod::FindCatchBlock(Handle<mirror::Class> exception_type, *has_no_move_exception = (first_catch_instr->Opcode() != Instruction::MOVE_EXCEPTION); } // Put the exception back. - if (exception.Get() != nullptr) { + if (exception != nullptr) { self->SetException(exception.Get()); } return found_dex_pc; @@ -489,7 +489,7 @@ bool ArtMethod::EqualParameters(Handle<mirror::ObjectArray<mirror::Class>> param const auto& proto_id = dex_file->GetMethodPrototype(method_id); const DexFile::TypeList* proto_params = dex_file->GetProtoParameters(proto_id); auto count = proto_params != nullptr ? proto_params->Size() : 0u; - auto param_len = params.Get() != nullptr ? params->GetLength() : 0u; + auto param_len = params != nullptr ? params->GetLength() : 0u; if (param_len != count) { return false; } diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 7db83688e2..091ea145cc 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -405,7 +405,7 @@ bool ClassLinker::InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> b auto class_class_size = mirror::Class::ClassClassSize(image_pointer_size_); Handle<mirror::Class> java_lang_Class(hs.NewHandle(down_cast<mirror::Class*>( heap->AllocNonMovableObject<true>(self, nullptr, class_class_size, VoidFunctor())))); - CHECK(java_lang_Class.Get() != nullptr); + CHECK(java_lang_Class != nullptr); mirror::Class::SetClassClass(java_lang_Class.Get()); java_lang_Class->SetClass(java_lang_Class.Get()); if (kUseBakerReadBarrier) { @@ -425,7 +425,7 @@ bool ClassLinker::InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> b // java_lang_Object comes next so that object_array_class can be created. Handle<mirror::Class> java_lang_Object(hs.NewHandle( AllocClass(self, java_lang_Class.Get(), mirror::Object::ClassSize(image_pointer_size_)))); - CHECK(java_lang_Object.Get() != nullptr); + CHECK(java_lang_Object != nullptr); // backfill Object as the super class of Class. java_lang_Class->SetSuperClass(java_lang_Object.Get()); mirror::Class::SetStatus(java_lang_Object, mirror::Class::kStatusLoaded, self); @@ -624,9 +624,9 @@ bool ClassLinker::InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> b // Setup the single, global copy of "iftable". auto java_lang_Cloneable = hs.NewHandle(FindSystemClass(self, "Ljava/lang/Cloneable;")); - CHECK(java_lang_Cloneable.Get() != nullptr); + CHECK(java_lang_Cloneable != nullptr); auto java_io_Serializable = hs.NewHandle(FindSystemClass(self, "Ljava/io/Serializable;")); - CHECK(java_io_Serializable.Get() != nullptr); + CHECK(java_io_Serializable != nullptr); // We assume that Cloneable/Serializable don't have superinterfaces -- normally we'd have to // crawl up and explicitly list all of the supers as well. array_iftable_.Read()->SetInterface(0, java_lang_Cloneable.Get()); @@ -1615,7 +1615,7 @@ bool ClassLinker::AddImageSpace( DCHECK(out_dex_files != nullptr); DCHECK(error_msg != nullptr); const uint64_t start_time = NanoTime(); - const bool app_image = class_loader.Get() != nullptr; + const bool app_image = class_loader != nullptr; const ImageHeader& header = space->GetImageHeader(); ObjPtr<mirror::Object> dex_caches_object = header.GetImageRoot(ImageHeader::kDexCaches); DCHECK(dex_caches_object != nullptr); @@ -1645,7 +1645,7 @@ bool ClassLinker::AddImageSpace( "Class loader should be the last image root."); MutableHandle<mirror::ClassLoader> image_class_loader(hs.NewHandle( app_image ? header.GetImageRoot(ImageHeader::kClassLoader)->AsClassLoader() : nullptr)); - DCHECK(class_roots.Get() != nullptr); + DCHECK(class_roots != nullptr); if (class_roots->GetLength() != static_cast<int32_t>(kClassRootsMax)) { *error_msg = StringPrintf("Expected %d class roots but got %d", class_roots->GetLength(), @@ -2074,7 +2074,7 @@ void ClassLinker::VisitClassesWithoutClassesLock(ClassVisitor* visitor) { ObjPtr<mirror::Class> array_of_class = FindArrayClass(self, &class_type); classes.Assign( mirror::ObjectArray<mirror::Class>::Alloc(self, array_of_class, class_table_size)); - CHECK(classes.Get() != nullptr); // OOME. + CHECK(classes != nullptr); // OOME. GetClassInToObjectArray accumulator(classes.Get()); VisitClasses(&accumulator); if (accumulator.Succeeded()) { @@ -2152,7 +2152,7 @@ mirror::DexCache* ClassLinker::AllocDexCache(ObjPtr<mirror::String>* out_locatio DCHECK(out_location != nullptr); auto dex_cache(hs.NewHandle(ObjPtr<mirror::DexCache>::DownCast( GetClassRoot(kJavaLangDexCache)->AllocObject(self)))); - if (dex_cache.Get() == nullptr) { + if (dex_cache == nullptr) { self->AssertPendingOOMException(); return nullptr; } @@ -2453,7 +2453,7 @@ mirror::Class* ClassLinker::FindClass(Thread* self, return EnsureResolved(self, descriptor, klass); } // Class is not yet loaded. - if (descriptor[0] != '[' && class_loader.Get() == nullptr) { + if (descriptor[0] != '[' && class_loader == nullptr) { // Non-array class and the boot class loader, search the boot class path. ClassPathEntry pair = FindInClassPath(descriptor, hash, boot_class_path_); if (pair.second != nullptr) { @@ -2616,14 +2616,14 @@ mirror::Class* ClassLinker::DefineClass(Thread* self, } } - if (klass.Get() == nullptr) { + if (klass == nullptr) { // Allocate a class with the status of not ready. // Interface object should get the right size here. Regular class will // figure out the right size later and be replaced with one of the right // size when the class becomes resolved. klass.Assign(AllocClass(self, SizeOfClassWithoutEmbeddedTables(dex_file, dex_class_def))); } - if (UNLIKELY(klass.Get() == nullptr)) { + if (UNLIKELY(klass == nullptr)) { self->AssertPendingOOMException(); return nullptr; } @@ -2716,7 +2716,7 @@ mirror::Class* ClassLinker::DefineClass(Thread* self, return nullptr; } self->AssertNoPendingException(); - CHECK(h_new_class.Get() != nullptr) << descriptor; + CHECK(h_new_class != nullptr) << descriptor; CHECK(h_new_class->IsResolved() && !h_new_class->IsErroneousResolved()) << descriptor; // Instrumentation may have updated entrypoints for all methods of all @@ -2997,7 +2997,7 @@ void ClassLinker::SetupClass(const DexFile& dex_file, const DexFile::ClassDef& dex_class_def, Handle<mirror::Class> klass, ObjPtr<mirror::ClassLoader> class_loader) { - CHECK(klass.Get() != nullptr); + CHECK(klass != nullptr); CHECK(klass->GetDexCache() != nullptr); CHECK_EQ(mirror::Class::kStatusNotReady, klass->GetStatus()); const char* descriptor = dex_file.GetClassDescriptor(dex_class_def); @@ -3367,7 +3367,7 @@ ObjPtr<mirror::DexCache> ClassLinker::RegisterDexFile(const DexFile& dex_file, WriterMutexLock mu(self, *Locks::dex_lock_); old_data = FindDexCacheDataLocked(dex_file); old_dex_cache = DecodeDexCache(self, old_data); - if (old_dex_cache == nullptr && h_dex_cache.Get() != nullptr) { + if (old_dex_cache == nullptr && h_dex_cache != nullptr) { // Do InitializeDexCache while holding dex lock to make sure two threads don't call it at the // same time with the same dex cache. Since the .bss is shared this can cause failing DCHECK // that the arrays are null. @@ -3383,12 +3383,12 @@ ObjPtr<mirror::DexCache> ClassLinker::RegisterDexFile(const DexFile& dex_file, if (old_dex_cache != nullptr) { // Another thread managed to initialize the dex cache faster, so use that DexCache. // If this thread encountered OOME, ignore it. - DCHECK_EQ(h_dex_cache.Get() == nullptr, self->IsExceptionPending()); + DCHECK_EQ(h_dex_cache == nullptr, self->IsExceptionPending()); self->ClearException(); // We cannot call EnsureSameClassLoader() while holding the dex_lock_. return EnsureSameClassLoader(self, old_dex_cache, old_data, h_class_loader.Get()); } - if (h_dex_cache.Get() == nullptr) { + if (h_dex_cache == nullptr) { self->AssertPendingOOMException(); return nullptr; } @@ -3517,12 +3517,12 @@ mirror::Class* ClassLinker::CreateArrayClass(Thread* self, const char* descripto StackHandleScope<2> hs(self); MutableHandle<mirror::Class> component_type(hs.NewHandle(FindClass(self, descriptor + 1, class_loader))); - if (component_type.Get() == nullptr) { + if (component_type == nullptr) { DCHECK(self->IsExceptionPending()); // We need to accept erroneous classes as component types. const size_t component_hash = ComputeModifiedUtf8Hash(descriptor + 1); component_type.Assign(LookupClass(self, descriptor + 1, component_hash, class_loader.Get())); - if (component_type.Get() == nullptr) { + if (component_type == nullptr) { DCHECK(self->IsExceptionPending()); return nullptr; } else { @@ -3583,9 +3583,9 @@ mirror::Class* ClassLinker::CreateArrayClass(Thread* self, const char* descripto new_class.Assign(GetClassRoot(kLongArrayClass)); } } - if (new_class.Get() == nullptr) { + if (new_class == nullptr) { new_class.Assign(AllocClass(self, mirror::Array::ClassSize(image_pointer_size_))); - if (new_class.Get() == nullptr) { + if (new_class == nullptr) { self->AssertPendingOOMException(); return nullptr; } @@ -3818,8 +3818,8 @@ bool ClassLinker::AttemptSupertypeVerification(Thread* self, Handle<mirror::Class> klass, Handle<mirror::Class> supertype) { DCHECK(self != nullptr); - DCHECK(klass.Get() != nullptr); - DCHECK(supertype.Get() != nullptr); + DCHECK(klass != nullptr); + DCHECK(supertype != nullptr); if (!supertype->IsVerified() && !supertype->IsErroneous()) { VerifyClass(self, supertype); @@ -3836,13 +3836,13 @@ bool ClassLinker::AttemptSupertypeVerification(Thread* self, LOG(WARNING) << error_msg << " in " << klass->GetDexCache()->GetLocation()->ToModifiedUtf8(); StackHandleScope<1> hs(self); Handle<mirror::Throwable> cause(hs.NewHandle(self->GetException())); - if (cause.Get() != nullptr) { + if (cause != nullptr) { // Set during VerifyClass call (if at all). self->ClearException(); } // Change into a verify error. ThrowVerifyError(klass.Get(), "%s", error_msg.c_str()); - if (cause.Get() != nullptr) { + if (cause != nullptr) { self->GetException()->SetCause(cause.Get()); } ClassReference ref(klass->GetDexCache()->GetDexFile(), klass->GetDexClassDefIndex()); @@ -3921,7 +3921,7 @@ verifier::MethodVerifier::FailureKind ClassLinker::VerifyClass( StackHandleScope<2> hs(self); MutableHandle<mirror::Class> supertype(hs.NewHandle(klass->GetSuperClass())); // If we have a superclass and we get a hard verification failure we can return immediately. - if (supertype.Get() != nullptr && !AttemptSupertypeVerification(self, klass, supertype)) { + if (supertype != nullptr && !AttemptSupertypeVerification(self, klass, supertype)) { CHECK(self->IsExceptionPending()) << "Verification error should be pending."; return verifier::MethodVerifier::kHardFailure; } @@ -3936,14 +3936,14 @@ verifier::MethodVerifier::FailureKind ClassLinker::VerifyClass( // but choose not to for an optimization. If the interfaces is being verified due to a class // initialization (which would need all the default interfaces to be verified) the class code // will trigger the recursive verification anyway. - if ((supertype.Get() == nullptr || supertype->IsVerified()) // See (1) + if ((supertype == nullptr || supertype->IsVerified()) // See (1) && !klass->IsInterface()) { // See (2) int32_t iftable_count = klass->GetIfTableCount(); MutableHandle<mirror::Class> iface(hs.NewHandle<mirror::Class>(nullptr)); // Loop through all interfaces this class has defined. It doesn't matter the order. for (int32_t i = 0; i < iftable_count; i++) { iface.Assign(klass->GetIfTable()->GetInterface(i)); - DCHECK(iface.Get() != nullptr); + DCHECK(iface != nullptr); // We only care if we have default interfaces and can skip if we are already verified... if (LIKELY(!iface->HasDefaultMethods() || iface->IsVerified())) { continue; @@ -3963,7 +3963,7 @@ verifier::MethodVerifier::FailureKind ClassLinker::VerifyClass( // At this point if verification failed, then supertype is the "first" supertype that failed // verification (without a specific order). If verification succeeded, then supertype is either // null or the original superclass of klass and is verified. - DCHECK(supertype.Get() == nullptr || + DCHECK(supertype == nullptr || supertype.Get() == klass->GetSuperClass() || !supertype->IsVerified()); @@ -4004,7 +4004,7 @@ verifier::MethodVerifier::FailureKind ClassLinker::VerifyClass( if (verifier_failure == verifier::MethodVerifier::kNoFailure) { // Even though there were no verifier failures we need to respect whether the super-class and // super-default-interfaces were verified or requiring runtime reverification. - if (supertype.Get() == nullptr || supertype->IsVerified()) { + if (supertype == nullptr || supertype->IsVerified()) { mirror::Class::SetStatus(klass, mirror::Class::kStatusVerified, self); } else { CHECK_EQ(supertype->GetStatus(), mirror::Class::kStatusRetryVerificationAtRuntime); @@ -4187,7 +4187,7 @@ mirror::Class* ClassLinker::CreateProxyClass(ScopedObjectAccessAlreadyRunnable& StackHandleScope<10> hs(self); MutableHandle<mirror::Class> klass(hs.NewHandle( AllocClass(self, GetClassRoot(kJavaLangClass), sizeof(mirror::Class)))); - if (klass.Get() == nullptr) { + if (klass == nullptr) { CHECK(self->IsExceptionPending()); // OOME. return nullptr; } @@ -4611,7 +4611,7 @@ bool ClassLinker::InitializeClass(Thread* self, Handle<mirror::Class> klass, MutableHandle<mirror::Class> handle_scope_iface(hs_iface.NewHandle<mirror::Class>(nullptr)); for (size_t i = 0; i < num_direct_interfaces; i++) { handle_scope_iface.Assign(mirror::Class::GetDirectInterface(self, klass.Get(), i)); - CHECK(handle_scope_iface.Get() != nullptr); + CHECK(handle_scope_iface != nullptr); CHECK(handle_scope_iface->IsInterface()); if (handle_scope_iface->HasBeenRecursivelyInitialized()) { // We have already done this for this interface. Skip it. @@ -4890,7 +4890,7 @@ static bool HasSameSignatureWithDifferentClassLoaders(Thread* self, { StackHandleScope<1> hs(self); Handle<mirror::Class> return_type(hs.NewHandle(method1->GetReturnType(true /* resolve */))); - if (UNLIKELY(return_type.Get() == nullptr)) { + if (UNLIKELY(return_type == nullptr)) { ThrowSignatureCheckResolveReturnTypeException(klass, super_klass, method1, method1); return false; } @@ -4940,7 +4940,7 @@ static bool HasSameSignatureWithDifferentClassLoaders(Thread* self, dex::TypeIndex param_type_idx = types1->GetTypeItem(i).type_idx_; Handle<mirror::Class> param_type(hs.NewHandle( method1->GetClassFromTypeIndex(param_type_idx, true /* resolve */))); - if (UNLIKELY(param_type.Get() == nullptr)) { + if (UNLIKELY(param_type == nullptr)) { ThrowSignatureCheckResolveArgException(klass, super_klass, method1, method1, i, param_type_idx); return false; @@ -5022,7 +5022,7 @@ bool ClassLinker::EnsureInitialized(Thread* self, Handle<mirror::Class> c, bool can_init_fields, bool can_init_parents) { - DCHECK(c.Get() != nullptr); + DCHECK(c != nullptr); if (c->IsInitialized()) { EnsureSkipAccessChecksMethods(c, image_pointer_size_); self->AssertNoPendingException(); @@ -5202,7 +5202,7 @@ bool ClassLinker::LinkClass(Thread* self, klass->SetMethodsPtrUnchecked(nullptr, 0, 0); klass->SetSFieldsPtrUnchecked(nullptr); klass->SetIFieldsPtrUnchecked(nullptr); - if (UNLIKELY(h_new_class.Get() == nullptr)) { + if (UNLIKELY(h_new_class == nullptr)) { self->AssertPendingOOMException(); mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorUnresolved, self); return false; @@ -5746,7 +5746,7 @@ bool ClassLinker::LinkVirtualMethods( MutableHandle<mirror::PointerArray> vtable; if (super_class->ShouldHaveEmbeddedVTable()) { vtable = hs.NewHandle(AllocPointerArray(self, max_count)); - if (UNLIKELY(vtable.Get() == nullptr)) { + if (UNLIKELY(vtable == nullptr)) { self->AssertPendingOOMException(); return false; } @@ -5775,7 +5775,7 @@ bool ClassLinker::LinkVirtualMethods( } vtable = hs.NewHandle(down_cast<mirror::PointerArray*>( super_vtable->CopyOf(self, max_count))); - if (UNLIKELY(vtable.Get() == nullptr)) { + if (UNLIKELY(vtable == nullptr)) { self->AssertPendingOOMException(); return false; } @@ -5911,7 +5911,7 @@ bool ClassLinker::LinkVirtualMethods( CHECK_LE(actual_count, max_count); if (actual_count < max_count) { vtable.Assign(down_cast<mirror::PointerArray*>(vtable->CopyOf(self, actual_count))); - if (UNLIKELY(vtable.Get() == nullptr)) { + if (UNLIKELY(vtable == nullptr)) { self->AssertPendingOOMException(); return false; } @@ -5964,8 +5964,8 @@ static bool ContainsOverridingMethodOf(Thread* self, PointerSize image_pointer_size) REQUIRES_SHARED(Locks::mutator_lock_) { DCHECK(self != nullptr); - DCHECK(iface.Get() != nullptr); - DCHECK(iftable.Get() != nullptr); + DCHECK(iface != nullptr); + DCHECK(iftable != nullptr); DCHECK_GE(ifstart, 0u); DCHECK_LT(ifstart, iftable->Count()); DCHECK_EQ(iface.Get(), iftable->GetInterface(ifstart)); @@ -6050,7 +6050,7 @@ ClassLinker::DefaultMethodSearchResult ClassLinker::FindDefaultMethodImplementat << "This will be a fatal error in subsequent versions of android. " << "Continuing anyway."; } - if (UNLIKELY(chosen_iface.Get() != nullptr)) { + if (UNLIKELY(chosen_iface != nullptr)) { // We have multiple default impls of the same method. This is a potential default conflict. // We need to check if this possibly conflicting method is either a superclass of the chosen // default implementation or is overridden by a non-default interface method. In either case @@ -6505,7 +6505,7 @@ bool ClassLinker::SetupInterfaceLookupTable(Thread* self, Handle<mirror::Class> StackHandleScope<1> hs(self); const bool has_superclass = klass->HasSuperClass(); const size_t super_ifcount = has_superclass ? klass->GetSuperClass()->GetIfTableCount() : 0U; - const bool have_interfaces = interfaces.Get() != nullptr; + const bool have_interfaces = interfaces != nullptr; const size_t num_interfaces = have_interfaces ? interfaces->GetLength() : klass->NumDirectInterfaces(); if (num_interfaces == 0) { @@ -6551,7 +6551,7 @@ bool ClassLinker::SetupInterfaceLookupTable(Thread* self, Handle<mirror::Class> } // Create the interface function table. MutableHandle<mirror::IfTable> iftable(hs.NewHandle(AllocIfTable(self, ifcount))); - if (UNLIKELY(iftable.Get() == nullptr)) { + if (UNLIKELY(iftable == nullptr)) { self->AssertPendingOOMException(); return false; } @@ -6589,7 +6589,7 @@ bool ClassLinker::SetupInterfaceLookupTable(Thread* self, Handle<mirror::Class> DCHECK_NE(num_interfaces, 0U); iftable.Assign(down_cast<mirror::IfTable*>( iftable->CopyOf(self, new_ifcount * mirror::IfTable::kMax))); - if (UNLIKELY(iftable.Get() == nullptr)) { + if (UNLIKELY(iftable == nullptr)) { self->AssertPendingOOMException(); return false; } @@ -6630,7 +6630,7 @@ static void CheckClassOwnsVTableEntries(Thread* self, Handle<mirror::PointerArray> check_vtable(hs.NewHandle(klass->GetVTableDuringLinking())); ObjPtr<mirror::Class> super_temp = (klass->HasSuperClass()) ? klass->GetSuperClass() : nullptr; Handle<mirror::Class> superclass(hs.NewHandle(super_temp)); - int32_t super_vtable_length = (superclass.Get() != nullptr) ? superclass->GetVTableLength() : 0; + int32_t super_vtable_length = (superclass != nullptr) ? superclass->GetVTableLength() : 0; for (int32_t i = 0; i < check_vtable->GetLength(); ++i) { ArtMethod* m = check_vtable->GetElementPtrSize<ArtMethod*>(i, pointer_size); CHECK(m != nullptr); @@ -7289,7 +7289,7 @@ bool ClassLinker::LinkInterfaceMethods( // For a new interface, however, we need the whole vtable in case a new // interface method is implemented in the whole superclass. using_virtuals = false; - DCHECK(vtable.Get() != nullptr); + DCHECK(vtable != nullptr); input_vtable_array = vtable; input_array_length = input_vtable_array->GetLength(); } @@ -7432,7 +7432,7 @@ bool ClassLinker::LinkInterfaceMethods( if (fill_tables) { vtable.Assign(helper.UpdateVtable(default_translations, vtable.Get())); - if (UNLIKELY(vtable.Get() == nullptr)) { + if (UNLIKELY(vtable == nullptr)) { // The helper has already called self->AssertPendingOOMException(); return false; } @@ -7452,12 +7452,12 @@ bool ClassLinker::LinkInterfaceMethods( } bool ClassLinker::LinkInstanceFields(Thread* self, Handle<mirror::Class> klass) { - CHECK(klass.Get() != nullptr); + CHECK(klass != nullptr); return LinkFields(self, klass, false, nullptr); } bool ClassLinker::LinkStaticFields(Thread* self, Handle<mirror::Class> klass, size_t* class_size) { - CHECK(klass.Get() != nullptr); + CHECK(klass != nullptr); return LinkFields(self, klass, true, class_size); } @@ -7713,7 +7713,7 @@ void ClassLinker::CreateReferenceInstanceOffsets(Handle<mirror::Class> klass) { mirror::String* ClassLinker::ResolveString(const DexFile& dex_file, dex::StringIndex string_idx, Handle<mirror::DexCache> dex_cache) { - DCHECK(dex_cache.Get() != nullptr); + DCHECK(dex_cache != nullptr); Thread::PoisonObjectPointersIfDebug(); ObjPtr<mirror::String> resolved = dex_cache->GetResolvedString(string_idx); if (resolved != nullptr) { @@ -7729,7 +7729,7 @@ mirror::String* ClassLinker::ResolveString(const DexFile& dex_file, mirror::String* ClassLinker::LookupString(const DexFile& dex_file, dex::StringIndex string_idx, Handle<mirror::DexCache> dex_cache) { - DCHECK(dex_cache.Get() != nullptr); + DCHECK(dex_cache != nullptr); ObjPtr<mirror::String> resolved = dex_cache->GetResolvedString(string_idx); if (resolved != nullptr) { return resolved.Ptr(); @@ -7783,7 +7783,7 @@ mirror::Class* ClassLinker::ResolveType(const DexFile& dex_file, dex::TypeIndex type_idx, Handle<mirror::DexCache> dex_cache, Handle<mirror::ClassLoader> class_loader) { - DCHECK(dex_cache.Get() != nullptr); + DCHECK(dex_cache != nullptr); Thread::PoisonObjectPointersIfDebug(); ObjPtr<mirror::Class> resolved = dex_cache->GetResolvedType(type_idx); if (resolved == nullptr) { @@ -7821,7 +7821,7 @@ ArtMethod* ClassLinker::ResolveMethod(const DexFile& dex_file, Handle<mirror::ClassLoader> class_loader, ArtMethod* referrer, InvokeType type) { - DCHECK(dex_cache.Get() != nullptr); + DCHECK(dex_cache != nullptr); // Check for hit in the dex cache. ArtMethod* resolved = dex_cache->GetResolvedMethod(method_idx, image_pointer_size_); Thread::PoisonObjectPointersIfDebug(); @@ -8060,7 +8060,7 @@ ArtField* ClassLinker::ResolveField(const DexFile& dex_file, Handle<mirror::DexCache> dex_cache, Handle<mirror::ClassLoader> class_loader, bool is_static) { - DCHECK(dex_cache.Get() != nullptr); + DCHECK(dex_cache != nullptr); ArtField* resolved = dex_cache->GetResolvedField(field_idx, image_pointer_size_); Thread::PoisonObjectPointersIfDebug(); if (resolved != nullptr) { @@ -8101,7 +8101,7 @@ ArtField* ClassLinker::ResolveFieldJLS(const DexFile& dex_file, uint32_t field_idx, Handle<mirror::DexCache> dex_cache, Handle<mirror::ClassLoader> class_loader) { - DCHECK(dex_cache.Get() != nullptr); + DCHECK(dex_cache != nullptr); ArtField* resolved = dex_cache->GetResolvedField(field_idx, image_pointer_size_); Thread::PoisonObjectPointersIfDebug(); if (resolved != nullptr) { @@ -8132,7 +8132,7 @@ mirror::MethodType* ClassLinker::ResolveMethodType(const DexFile& dex_file, Handle<mirror::DexCache> dex_cache, Handle<mirror::ClassLoader> class_loader) { DCHECK(Runtime::Current()->IsMethodHandlesEnabled()); - DCHECK(dex_cache.Get() != nullptr); + DCHECK(dex_cache != nullptr); ObjPtr<mirror::MethodType> resolved = dex_cache->GetResolvedMethodType(proto_idx); if (resolved != nullptr) { @@ -8146,7 +8146,7 @@ mirror::MethodType* ClassLinker::ResolveMethodType(const DexFile& dex_file, const DexFile::ProtoId& proto_id = dex_file.GetProtoId(proto_idx); Handle<mirror::Class> return_type(hs.NewHandle( ResolveType(dex_file, proto_id.return_type_idx_, dex_cache, class_loader))); - if (return_type.Get() == nullptr) { + if (return_type == nullptr) { DCHECK(self->IsExceptionPending()); return nullptr; } @@ -8161,7 +8161,7 @@ mirror::MethodType* ClassLinker::ResolveMethodType(const DexFile& dex_file, ObjPtr<mirror::Class> array_of_class = FindArrayClass(self, &class_type); Handle<mirror::ObjectArray<mirror::Class>> method_params(hs.NewHandle( mirror::ObjectArray<mirror::Class>::Alloc(self, array_of_class, num_method_args))); - if (method_params.Get() == nullptr) { + if (method_params == nullptr) { DCHECK(self->IsExceptionPending()); return nullptr; } @@ -8172,7 +8172,7 @@ mirror::MethodType* ClassLinker::ResolveMethodType(const DexFile& dex_file, for (; it.HasNext(); it.Next()) { const dex::TypeIndex type_idx = it.GetTypeIdx(); param_class.Assign(ResolveType(dex_file, type_idx, dex_cache, class_loader)); - if (param_class.Get() == nullptr) { + if (param_class == nullptr) { DCHECK(self->IsExceptionPending()); return nullptr; } @@ -8352,7 +8352,7 @@ jobject ClassLinker::CreatePathClassLoader(Thread* self, jni::DecodeArtField(WellKnownClasses::dalvik_system_DexPathList_dexElements); Handle<mirror::Class> dex_elements_class(hs.NewHandle(dex_elements_field->GetType<true>())); - DCHECK(dex_elements_class.Get() != nullptr); + DCHECK(dex_elements_class != nullptr); DCHECK(dex_elements_class->IsArrayClass()); Handle<mirror::ObjectArray<mirror::Object>> h_dex_elements(hs.NewHandle( mirror::ObjectArray<mirror::Object>::Alloc(self, @@ -8381,21 +8381,21 @@ jobject ClassLinker::CreatePathClassLoader(Thread* self, Handle<mirror::LongArray> h_long_array = hs2.NewHandle(mirror::LongArray::Alloc( self, kDexFileIndexStart + 1)); - DCHECK(h_long_array.Get() != nullptr); + DCHECK(h_long_array != nullptr); h_long_array->Set(kDexFileIndexStart, reinterpret_cast<intptr_t>(dex_file)); Handle<mirror::Object> h_dex_file = hs2.NewHandle( cookie_field->GetDeclaringClass()->AllocObject(self)); - DCHECK(h_dex_file.Get() != nullptr); + DCHECK(h_dex_file != nullptr); cookie_field->SetObject<false>(h_dex_file.Get(), h_long_array.Get()); Handle<mirror::String> h_file_name = hs2.NewHandle( mirror::String::AllocFromModifiedUtf8(self, dex_file->GetLocation().c_str())); - DCHECK(h_file_name.Get() != nullptr); + DCHECK(h_file_name != nullptr); file_name_field->SetObject<false>(h_dex_file.Get(), h_file_name.Get()); Handle<mirror::Object> h_element = hs2.NewHandle(h_dex_element_class->AllocObject(self)); - DCHECK(h_element.Get() != nullptr); + DCHECK(h_element != nullptr); element_file_field->SetObject<false>(h_element.Get(), h_dex_file.Get()); h_dex_elements->Set(index, h_element.Get()); @@ -8406,7 +8406,7 @@ jobject ClassLinker::CreatePathClassLoader(Thread* self, // Create DexPathList. Handle<mirror::Object> h_dex_path_list = hs.NewHandle( dex_elements_field->GetDeclaringClass()->AllocObject(self)); - DCHECK(h_dex_path_list.Get() != nullptr); + DCHECK(h_dex_path_list != nullptr); // Set elements. dex_elements_field->SetObject<false>(h_dex_path_list.Get(), h_dex_elements.Get()); @@ -8415,7 +8415,7 @@ jobject ClassLinker::CreatePathClassLoader(Thread* self, soa.Decode<mirror::Class>(WellKnownClasses::dalvik_system_PathClassLoader)); Handle<mirror::Object> h_path_class_loader = hs.NewHandle( h_path_class_class->AllocObject(self)); - DCHECK(h_path_class_loader.Get() != nullptr); + DCHECK(h_path_class_loader != nullptr); // Set DexPathList. ArtField* path_list_field = jni::DecodeArtField(WellKnownClasses::dalvik_system_BaseDexClassLoader_pathList); diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc index 03105cb6fb..e94dae64d3 100644 --- a/runtime/class_linker_test.cc +++ b/runtime/class_linker_test.cc @@ -185,7 +185,7 @@ class ClassLinkerTest : public CommonRuntimeTest { void AssertArrayClass(const std::string& array_descriptor, Handle<mirror::Class> array) REQUIRES_SHARED(Locks::mutator_lock_) { - ASSERT_TRUE(array.Get() != nullptr); + ASSERT_TRUE(array != nullptr); ASSERT_TRUE(array->GetClass() != nullptr); ASSERT_EQ(array->GetClass(), array->GetClass()->GetClass()); EXPECT_TRUE(array->GetClass()->GetSuperClass() != nullptr); @@ -409,7 +409,7 @@ class ClassLinkerTest : public CommonRuntimeTest { StackHandleScope<1> hs(self); Handle<mirror::Class> klass( hs.NewHandle(class_linker_->FindSystemClass(self, descriptor.c_str()))); - ASSERT_TRUE(klass.Get() != nullptr); + ASSERT_TRUE(klass != nullptr); std::string temp; EXPECT_STREQ(descriptor.c_str(), klass.Get()->GetDescriptor(&temp)); EXPECT_EQ(class_loader, klass->GetClassLoader()); @@ -1411,13 +1411,13 @@ TEST_F(ClassLinkerTest, IsBootStrapClassLoaded) { // java.lang.Object is a bootstrap class. Handle<mirror::Class> jlo_class( hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "Ljava/lang/Object;"))); - ASSERT_TRUE(jlo_class.Get() != nullptr); + ASSERT_TRUE(jlo_class != nullptr); EXPECT_TRUE(jlo_class.Get()->IsBootStrapClassLoaded()); // Statics is not a bootstrap class. Handle<mirror::Class> statics( hs.NewHandle(class_linker_->FindClass(soa.Self(), "LStatics;", class_loader))); - ASSERT_TRUE(statics.Get() != nullptr); + ASSERT_TRUE(statics != nullptr); EXPECT_FALSE(statics.Get()->IsBootStrapClassLoaded()); } @@ -1431,11 +1431,11 @@ TEST_F(ClassLinkerTest, RegisterDexFileName) { ReaderMutexLock mu(soa.Self(), *Locks::dex_lock_); for (const ClassLinker::DexCacheData& data : class_linker->GetDexCachesData()) { dex_cache.Assign(soa.Self()->DecodeJObject(data.weak_root)->AsDexCache()); - if (dex_cache.Get() != nullptr) { + if (dex_cache != nullptr) { break; } } - ASSERT_TRUE(dex_cache.Get() != nullptr); + ASSERT_TRUE(dex_cache != nullptr); } // Make a copy of the dex cache and change the name. dex_cache.Assign(dex_cache->Clone(soa.Self())->AsDexCache()); @@ -1487,7 +1487,7 @@ TEST_F(ClassLinkerMethodHandlesTest, TestResolveMethodTypes) { class_linker_->ResolveMethodType(dex_file, method1_id.proto_idx_, dex_cache, class_loader)); // Assert that the method type was resolved successfully. - ASSERT_TRUE(method1_type.Get() != nullptr); + ASSERT_TRUE(method1_type != nullptr); // Assert that the return type and the method arguments are as we expect. Handle<mirror::Class> string_class( diff --git a/runtime/class_table_test.cc b/runtime/class_table_test.cc index f1248eb00c..18c2b827fe 100644 --- a/runtime/class_table_test.cc +++ b/runtime/class_table_test.cc @@ -80,7 +80,7 @@ TEST_F(ClassTableTest, ClassTable) { Handle<mirror::Class> h_Y( hs.NewHandle(class_linker_->FindClass(soa.Self(), descriptor_y, class_loader))); Handle<mirror::Object> obj_X = hs.NewHandle(h_X->AllocObject(soa.Self())); - ASSERT_TRUE(obj_X.Get() != nullptr); + ASSERT_TRUE(obj_X != nullptr); ClassTable table; EXPECT_EQ(table.NumZygoteClasses(class_loader.Get()), 0u); EXPECT_EQ(table.NumNonZygoteClasses(class_loader.Get()), 0u); diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 1a0cec075c..cfdc6e1afb 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -1765,13 +1765,13 @@ static JDWP::JdwpError GetFieldValueImpl(JDWP::RefTypeId ref_type_id, JDWP::Obje StackHandleScope<2> hs(self); MutableHandle<mirror::Object> o(hs.NewHandle(Dbg::GetObjectRegistry()->Get<mirror::Object*>(object_id, &error))); - if ((!is_static && o.Get() == nullptr) || error != JDWP::ERR_NONE) { + if ((!is_static && o == nullptr) || error != JDWP::ERR_NONE) { return JDWP::ERR_INVALID_OBJECT; } ArtField* f = FromFieldId(field_id); mirror::Class* receiver_class = c; - if (receiver_class == nullptr && o.Get() != nullptr) { + if (receiver_class == nullptr && o != nullptr) { receiver_class = o->GetClass(); } @@ -1899,7 +1899,7 @@ static JDWP::JdwpError SetFieldValueImpl(JDWP::ObjectId object_id, JDWP::FieldId StackHandleScope<2> hs(self); MutableHandle<mirror::Object> o(hs.NewHandle(Dbg::GetObjectRegistry()->Get<mirror::Object*>(object_id, &error))); - if ((!is_static && o.Get() == nullptr) || error != JDWP::ERR_NONE) { + if ((!is_static && o == nullptr) || error != JDWP::ERR_NONE) { return JDWP::ERR_INVALID_OBJECT; } ArtField* f = FromFieldId(field_id); @@ -2867,7 +2867,7 @@ void Dbg::PostLocationEvent(ArtMethod* m, int dex_pc, mirror::Object* this_objec StackHandleScope<1> hs(self); Handle<mirror::Throwable> pending_exception(hs.NewHandle(self->GetException())); self->ClearException(); - if (kIsDebugBuild && pending_exception.Get() != nullptr) { + if (kIsDebugBuild && pending_exception != nullptr) { const DexFile::CodeItem* code_item = location.method->GetCodeItem(); const Instruction* instr = Instruction::At(&code_item->insns_[location.dex_pc]); CHECK_EQ(Instruction::MOVE_EXCEPTION, instr->Opcode()); @@ -2875,7 +2875,7 @@ void Dbg::PostLocationEvent(ArtMethod* m, int dex_pc, mirror::Object* this_objec gJdwpState->PostLocationEvent(&location, this_object, event_flags, return_value); - if (pending_exception.Get() != nullptr) { + if (pending_exception != nullptr) { self->SetException(pending_exception.Get()); } } @@ -4027,7 +4027,7 @@ void Dbg::ExecuteMethod(DebugInvokeReq* pReq) { ExecuteMethodWithoutPendingException(soa, pReq); // If an exception was pending before the invoke, restore it now. - if (old_exception.Get() != nullptr) { + if (old_exception != nullptr) { soa.Self()->SetException(old_exception.Get()); } } @@ -4356,9 +4356,9 @@ void Dbg::DdmSendThreadNotification(Thread* t, uint32_t type) { ScopedObjectAccessUnchecked soa(Thread::Current()); StackHandleScope<1> hs(soa.Self()); Handle<mirror::String> name(hs.NewHandle(t->GetThreadName())); - size_t char_count = (name.Get() != nullptr) ? name->GetLength() : 0; - const jchar* chars = (name.Get() != nullptr) ? name->GetValue() : nullptr; - bool is_compressed = (name.Get() != nullptr) ? name->IsCompressed() : false; + size_t char_count = (name != nullptr) ? name->GetLength() : 0; + const jchar* chars = (name != nullptr) ? name->GetValue() : nullptr; + bool is_compressed = (name != nullptr) ? name->IsCompressed() : false; std::vector<uint8_t> bytes; JDWP::Append4BE(bytes, t->GetThreadId()); diff --git a/runtime/dex_file_annotations.cc b/runtime/dex_file_annotations.cc index 16a447b0a6..a95f94cabb 100644 --- a/runtime/dex_file_annotations.cc +++ b/runtime/dex_file_annotations.cc @@ -252,7 +252,7 @@ mirror::Object* ProcessEncodedAnnotation(Handle<mirror::Class> klass, const uint ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); Handle<mirror::Class> annotation_class(hs.NewHandle( class_linker->ResolveType(klass->GetDexFile(), dex::TypeIndex(type_index), klass.Get()))); - if (annotation_class.Get() == nullptr) { + if (annotation_class == nullptr) { LOG(INFO) << "Unable to resolve " << klass->PrettyClass() << " annotation class " << type_index; DCHECK(Thread::Current()->IsExceptionPending()); Thread::Current()->ClearException(); @@ -481,7 +481,7 @@ bool ProcessAnnotationValue(Handle<mirror::Class> klass, break; } case DexFile::kDexAnnotationArray: - if (result_style == DexFile::kAllRaw || array_class.Get() == nullptr) { + if (result_style == DexFile::kAllRaw || array_class == nullptr) { return false; } else { ScopedObjectAccessUnchecked soa(self); @@ -491,7 +491,7 @@ bool ProcessAnnotationValue(Handle<mirror::Class> klass, Handle<mirror::Array> new_array(hs.NewHandle(mirror::Array::Alloc<true>( self, array_class.Get(), size, array_class->GetComponentSizeShift(), Runtime::Current()->GetHeap()->GetCurrentAllocator()))); - if (new_array.Get() == nullptr) { + if (new_array == nullptr) { LOG(ERROR) << "Annotation element array allocation failed with size " << size; return false; } @@ -631,8 +631,8 @@ mirror::Object* CreateAnnotationMember(Handle<mirror::Class> klass, } Handle<mirror::Method> method_object(hs.NewHandle(method_obj_ptr)); - if (new_member.Get() == nullptr || string_name.Get() == nullptr || - method_object.Get() == nullptr || method_return.Get() == nullptr) { + if (new_member == nullptr || string_name == nullptr || + method_object == nullptr || method_return == nullptr) { LOG(ERROR) << StringPrintf("Failed creating annotation element (m=%p n=%p a=%p r=%p", new_member.Get(), string_name.Get(), method_object.Get(), method_return.Get()); return nullptr; @@ -740,7 +740,7 @@ mirror::ObjectArray<mirror::String>* GetSignatureValue(Handle<mirror::Class> kla ObjPtr<mirror::Class> string_class = mirror::String::GetJavaLangString(); Handle<mirror::Class> string_array_class(hs.NewHandle( Runtime::Current()->GetClassLinker()->FindArrayClass(Thread::Current(), &string_class))); - if (string_array_class.Get() == nullptr) { + if (string_array_class == nullptr) { return nullptr; } mirror::Object* obj = @@ -766,7 +766,7 @@ mirror::ObjectArray<mirror::Class>* GetThrowsValue(Handle<mirror::Class> klass, ObjPtr<mirror::Class> class_class = mirror::Class::GetJavaLangClass(); Handle<mirror::Class> class_array_class(hs.NewHandle( Runtime::Current()->GetClassLinker()->FindArrayClass(Thread::Current(), &class_class))); - if (class_array_class.Get() == nullptr) { + if (class_array_class == nullptr) { return nullptr; } mirror::Object* obj = @@ -796,7 +796,7 @@ mirror::ObjectArray<mirror::Object>* ProcessAnnotationSet( uint32_t size = annotation_set->size_; Handle<mirror::ObjectArray<mirror::Object>> result(hs.NewHandle( mirror::ObjectArray<mirror::Object>::Alloc(self, annotation_array_class.Get(), size))); - if (result.Get() == nullptr) { + if (result == nullptr) { return nullptr; } @@ -854,7 +854,7 @@ mirror::ObjectArray<mirror::Object>* ProcessAnnotationSetRefList( } Handle<mirror::ObjectArray<mirror::Object>> annotation_array_array(hs.NewHandle( mirror::ObjectArray<mirror::Object>::Alloc(self, annotation_array_array_class, size))); - if (annotation_array_array.Get() == nullptr) { + if (annotation_array_array == nullptr) { LOG(ERROR) << "Annotation set ref array allocation failed"; return nullptr; } @@ -1056,7 +1056,7 @@ bool GetParametersMetadataForMethod(ArtMethod* method, ObjPtr<mirror::Class> string_class = mirror::String::GetJavaLangString(); Handle<mirror::Class> string_array_class(hs.NewHandle( Runtime::Current()->GetClassLinker()->FindArrayClass(Thread::Current(), &string_class))); - if (UNLIKELY(string_array_class.Get() == nullptr)) { + if (UNLIKELY(string_array_class == nullptr)) { return false; } @@ -1067,13 +1067,13 @@ bool GetParametersMetadataForMethod(ArtMethod* method, "names", string_array_class, DexFile::kDexAnnotationArray)); - if (names_obj.Get() == nullptr) { + if (names_obj == nullptr) { return false; } // Extract the parameters' access flags int[]. Handle<mirror::Class> int_array_class(hs.NewHandle(mirror::IntArray::GetArrayClass())); - if (UNLIKELY(int_array_class.Get() == nullptr)) { + if (UNLIKELY(int_array_class == nullptr)) { return false; } Handle<mirror::Object> access_flags_obj = @@ -1082,7 +1082,7 @@ bool GetParametersMetadataForMethod(ArtMethod* method, "accessFlags", int_array_class, DexFile::kDexAnnotationArray)); - if (access_flags_obj.Get() == nullptr) { + if (access_flags_obj == nullptr) { return false; } @@ -1146,7 +1146,7 @@ mirror::ObjectArray<mirror::Class>* GetDeclaredClasses(Handle<mirror::Class> kla ObjPtr<mirror::Class> class_class = mirror::Class::GetJavaLangClass(); Handle<mirror::Class> class_array_class(hs.NewHandle( Runtime::Current()->GetClassLinker()->FindArrayClass(hs.Self(), &class_class))); - if (class_array_class.Get() == nullptr) { + if (class_array_class == nullptr) { return nullptr; } mirror::Object* obj = diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc index fb8139b7c6..6301362e09 100644 --- a/runtime/entrypoints/entrypoint_utils.cc +++ b/runtime/entrypoints/entrypoint_utils.cc @@ -39,7 +39,7 @@ namespace art { void CheckReferenceResult(Handle<mirror::Object> o, Thread* self) { - if (o.Get() == nullptr) { + if (o == nullptr) { return; } // Make sure that the result is an instance of the type this method was expected to return. diff --git a/runtime/entrypoints/quick/quick_field_entrypoints.cc b/runtime/entrypoints/quick/quick_field_entrypoints.cc index 4544aef148..822c5a8d9d 100644 --- a/runtime/entrypoints/quick/quick_field_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_field_entrypoints.cc @@ -48,7 +48,7 @@ ALWAYS_INLINE static inline ArtField* FindInstanceField(uint32_t field_idx, StackHandleScope<1> hs(self); HandleWrapper<mirror::Object> h(hs.NewHandleWrapper(obj)); ArtField* field = FindFieldFromCode<type, kAccessCheck>(field_idx, referrer, self, size); - if (LIKELY(field != nullptr) && UNLIKELY(h.Get() == nullptr)) { + if (LIKELY(field != nullptr) && UNLIKELY(h == nullptr)) { ThrowNullPointerExceptionForFieldAccess(field, /*is_read*/FindFieldTypeIsRead(type)); return nullptr; } diff --git a/runtime/gc/reference_queue_test.cc b/runtime/gc/reference_queue_test.cc index 3ca3353562..613b034f59 100644 --- a/runtime/gc/reference_queue_test.cc +++ b/runtime/gc/reference_queue_test.cc @@ -38,11 +38,11 @@ TEST_F(ReferenceQueueTest, EnqueueDequeue) { auto ref_class = hs.NewHandle( Runtime::Current()->GetClassLinker()->FindClass(self, "Ljava/lang/ref/WeakReference;", ScopedNullHandle<mirror::ClassLoader>())); - ASSERT_TRUE(ref_class.Get() != nullptr); + ASSERT_TRUE(ref_class != nullptr); auto ref1(hs.NewHandle(ref_class->AllocObject(self)->AsReference())); - ASSERT_TRUE(ref1.Get() != nullptr); + ASSERT_TRUE(ref1 != nullptr); auto ref2(hs.NewHandle(ref_class->AllocObject(self)->AsReference())); - ASSERT_TRUE(ref2.Get() != nullptr); + ASSERT_TRUE(ref2 != nullptr); queue.EnqueueReference(ref1.Get()); ASSERT_TRUE(!queue.IsEmpty()); ASSERT_EQ(queue.GetLength(), 1U); @@ -73,15 +73,15 @@ TEST_F(ReferenceQueueTest, Dump) { auto weak_ref_class = hs.NewHandle( Runtime::Current()->GetClassLinker()->FindClass(self, "Ljava/lang/ref/WeakReference;", ScopedNullHandle<mirror::ClassLoader>())); - ASSERT_TRUE(weak_ref_class.Get() != nullptr); + ASSERT_TRUE(weak_ref_class != nullptr); auto finalizer_ref_class = hs.NewHandle( Runtime::Current()->GetClassLinker()->FindClass(self, "Ljava/lang/ref/FinalizerReference;", ScopedNullHandle<mirror::ClassLoader>())); - ASSERT_TRUE(finalizer_ref_class.Get() != nullptr); + ASSERT_TRUE(finalizer_ref_class != nullptr); auto ref1(hs.NewHandle(weak_ref_class->AllocObject(self)->AsReference())); - ASSERT_TRUE(ref1.Get() != nullptr); + ASSERT_TRUE(ref1 != nullptr); auto ref2(hs.NewHandle(finalizer_ref_class->AllocObject(self)->AsReference())); - ASSERT_TRUE(ref2.Get() != nullptr); + ASSERT_TRUE(ref2 != nullptr); queue.EnqueueReference(ref1.Get()); oss.str(""); diff --git a/runtime/gc/space/space_create_test.cc b/runtime/gc/space/space_create_test.cc index 7bc4dc40e4..ca5f306264 100644 --- a/runtime/gc/space/space_create_test.cc +++ b/runtime/gc/space/space_create_test.cc @@ -108,7 +108,7 @@ TEST_P(SpaceCreateTest, ZygoteSpaceTestBody) { &ptr1_bytes_allocated, &ptr1_usable_size, &ptr1_bytes_tl_bulk_allocated))); - EXPECT_TRUE(ptr1.Get() != nullptr); + EXPECT_TRUE(ptr1 != nullptr); EXPECT_LE(1U * MB, ptr1_bytes_allocated); EXPECT_LE(1U * MB, ptr1_usable_size); EXPECT_LE(ptr1_usable_size, ptr1_bytes_allocated); @@ -126,7 +126,7 @@ TEST_P(SpaceCreateTest, ZygoteSpaceTestBody) { &ptr3_bytes_allocated, &ptr3_usable_size, &ptr3_bytes_tl_bulk_allocated))); - EXPECT_TRUE(ptr3.Get() != nullptr); + EXPECT_TRUE(ptr3 != nullptr); EXPECT_LE(8U * MB, ptr3_bytes_allocated); EXPECT_LE(8U * MB, ptr3_usable_size); EXPECT_LE(ptr3_usable_size, ptr3_bytes_allocated); @@ -154,7 +154,7 @@ TEST_P(SpaceCreateTest, ZygoteSpaceTestBody) { &ptr6_bytes_allocated, &ptr6_usable_size, &ptr6_bytes_tl_bulk_allocated))); - EXPECT_TRUE(ptr6.Get() != nullptr); + EXPECT_TRUE(ptr6 != nullptr); EXPECT_LE(9U * MB, ptr6_bytes_allocated); EXPECT_LE(9U * MB, ptr6_usable_size); EXPECT_LE(ptr6_usable_size, ptr6_bytes_allocated); @@ -193,7 +193,7 @@ TEST_P(SpaceCreateTest, ZygoteSpaceTestBody) { &ptr1_bytes_allocated, &ptr1_usable_size, &ptr1_bytes_tl_bulk_allocated)); - EXPECT_TRUE(ptr1.Get() != nullptr); + EXPECT_TRUE(ptr1 != nullptr); EXPECT_LE(1U * MB, ptr1_bytes_allocated); EXPECT_LE(1U * MB, ptr1_usable_size); EXPECT_LE(ptr1_usable_size, ptr1_bytes_allocated); @@ -210,7 +210,7 @@ TEST_P(SpaceCreateTest, ZygoteSpaceTestBody) { &ptr3_bytes_allocated, &ptr3_usable_size, &ptr3_bytes_tl_bulk_allocated)); - EXPECT_TRUE(ptr3.Get() != nullptr); + EXPECT_TRUE(ptr3 != nullptr); EXPECT_LE(2U * MB, ptr3_bytes_allocated); EXPECT_LE(2U * MB, ptr3_usable_size); EXPECT_LE(ptr3_usable_size, ptr3_bytes_allocated); @@ -242,7 +242,7 @@ TEST_P(SpaceCreateTest, AllocAndFreeTestBody) { &ptr1_bytes_allocated, &ptr1_usable_size, &ptr1_bytes_tl_bulk_allocated))); - EXPECT_TRUE(ptr1.Get() != nullptr); + EXPECT_TRUE(ptr1 != nullptr); EXPECT_LE(1U * MB, ptr1_bytes_allocated); EXPECT_LE(1U * MB, ptr1_usable_size); EXPECT_LE(ptr1_usable_size, ptr1_bytes_allocated); @@ -260,7 +260,7 @@ TEST_P(SpaceCreateTest, AllocAndFreeTestBody) { &ptr3_bytes_allocated, &ptr3_usable_size, &ptr3_bytes_tl_bulk_allocated))); - EXPECT_TRUE(ptr3.Get() != nullptr); + EXPECT_TRUE(ptr3 != nullptr); EXPECT_LE(8U * MB, ptr3_bytes_allocated); EXPECT_LE(8U * MB, ptr3_usable_size); EXPECT_LE(ptr3_usable_size, ptr3_bytes_allocated); @@ -288,7 +288,7 @@ TEST_P(SpaceCreateTest, AllocAndFreeTestBody) { &ptr6_bytes_allocated, &ptr6_usable_size, &ptr6_bytes_tl_bulk_allocated))); - EXPECT_TRUE(ptr6.Get() != nullptr); + EXPECT_TRUE(ptr6 != nullptr); EXPECT_LE(9U * MB, ptr6_bytes_allocated); EXPECT_LE(9U * MB, ptr6_usable_size); EXPECT_LE(ptr6_usable_size, ptr6_bytes_allocated); diff --git a/runtime/gc/space/space_test.h b/runtime/gc/space/space_test.h index cbb3d73497..1fe3fb2e86 100644 --- a/runtime/gc/space/space_test.h +++ b/runtime/gc/space/space_test.h @@ -200,7 +200,7 @@ void SpaceTest<Super>::SizeFootPrintGrowthLimitAndTrimBody(MallocSpace* space, } footprint = space->GetFootprint(); EXPECT_GE(space->Size(), footprint); // invariant - if (object.Get() != nullptr) { // allocation succeeded + if (object != nullptr) { // allocation succeeded lots_of_objects[i] = object.Get(); size_t allocation_size = space->AllocationSize(object.Get(), nullptr); EXPECT_EQ(bytes_allocated, allocation_size); @@ -296,7 +296,7 @@ void SpaceTest<Super>::SizeFootPrintGrowthLimitAndTrimBody(MallocSpace* space, large_object.Assign(AllocWithGrowth(space, self, three_quarters_space, &bytes_allocated, nullptr, &bytes_tl_bulk_allocated)); } - EXPECT_TRUE(large_object.Get() != nullptr); + EXPECT_TRUE(large_object != nullptr); // Sanity check footprint footprint = space->GetFootprint(); diff --git a/runtime/handle.h b/runtime/handle.h index e4b6d29a55..ccff575495 100644 --- a/runtime/handle.h +++ b/runtime/handle.h @@ -81,6 +81,14 @@ class Handle : public ValueObject { return reference_; } + ALWAYS_INLINE bool operator!=(std::nullptr_t) const REQUIRES_SHARED(Locks::mutator_lock_) { + return !IsNull(); + } + + ALWAYS_INLINE bool operator==(std::nullptr_t) const REQUIRES_SHARED(Locks::mutator_lock_) { + return IsNull(); + } + protected: template<typename S> explicit Handle(StackReference<S>* reference) diff --git a/runtime/imtable_test.cc b/runtime/imtable_test.cc index 8cbe2916ec..17149dfe44 100644 --- a/runtime/imtable_test.cc +++ b/runtime/imtable_test.cc @@ -53,7 +53,7 @@ class ImTableTest : public CommonRuntimeTest { ObjPtr<mirror::ClassLoader>::DownCast(self->DecodeJObject(jclass_loader_a))); Handle<mirror::Class> h_class_a( hs.NewHandle(class_linker->FindClass(self, class_name.c_str(), h_class_loader))); - if (h_class_a.Get() == nullptr) { + if (h_class_a == nullptr) { LOG(ERROR) << self->GetException()->Dump(); CHECK(false) << "h_class_a == nullptr"; } @@ -63,7 +63,7 @@ class ImTableTest : public CommonRuntimeTest { ObjPtr<mirror::ClassLoader>::DownCast(self->DecodeJObject(jclass_loader_b))); Handle<mirror::Class> h_class_b( hs.NewHandle(class_linker->FindClass(self, class_name.c_str(), h_class_loader))); - if (h_class_b.Get() == nullptr) { + if (h_class_b == nullptr) { LOG(ERROR) << self->GetException()->Dump(); CHECK(false) << "h_class_b == nullptr"; } diff --git a/runtime/indirect_reference_table_test.cc b/runtime/indirect_reference_table_test.cc index bf4cab24cc..6aefe239a9 100644 --- a/runtime/indirect_reference_table_test.cc +++ b/runtime/indirect_reference_table_test.cc @@ -64,13 +64,13 @@ TEST_F(IndirectReferenceTableTest, BasicTest) { StackHandleScope<4> hs(soa.Self()); ASSERT_TRUE(c != nullptr); Handle<mirror::Object> obj0 = hs.NewHandle(c->AllocObject(soa.Self())); - ASSERT_TRUE(obj0.Get() != nullptr); + ASSERT_TRUE(obj0 != nullptr); Handle<mirror::Object> obj1 = hs.NewHandle(c->AllocObject(soa.Self())); - ASSERT_TRUE(obj1.Get() != nullptr); + ASSERT_TRUE(obj1 != nullptr); Handle<mirror::Object> obj2 = hs.NewHandle(c->AllocObject(soa.Self())); - ASSERT_TRUE(obj2.Get() != nullptr); + ASSERT_TRUE(obj2 != nullptr); Handle<mirror::Object> obj3 = hs.NewHandle(c->AllocObject(soa.Self())); - ASSERT_TRUE(obj3.Get() != nullptr); + ASSERT_TRUE(obj3 != nullptr); const IRTSegmentState cookie = kIRTFirstSegment; @@ -282,15 +282,15 @@ TEST_F(IndirectReferenceTableTest, Holes) { StackHandleScope<5> hs(soa.Self()); ASSERT_TRUE(c != nullptr); Handle<mirror::Object> obj0 = hs.NewHandle(c->AllocObject(soa.Self())); - ASSERT_TRUE(obj0.Get() != nullptr); + ASSERT_TRUE(obj0 != nullptr); Handle<mirror::Object> obj1 = hs.NewHandle(c->AllocObject(soa.Self())); - ASSERT_TRUE(obj1.Get() != nullptr); + ASSERT_TRUE(obj1 != nullptr); Handle<mirror::Object> obj2 = hs.NewHandle(c->AllocObject(soa.Self())); - ASSERT_TRUE(obj2.Get() != nullptr); + ASSERT_TRUE(obj2 != nullptr); Handle<mirror::Object> obj3 = hs.NewHandle(c->AllocObject(soa.Self())); - ASSERT_TRUE(obj3.Get() != nullptr); + ASSERT_TRUE(obj3 != nullptr); Handle<mirror::Object> obj4 = hs.NewHandle(c->AllocObject(soa.Self())); - ASSERT_TRUE(obj4.Get() != nullptr); + ASSERT_TRUE(obj4 != nullptr); std::string error_msg; @@ -491,7 +491,7 @@ TEST_F(IndirectReferenceTableTest, Resize) { StackHandleScope<1> hs(soa.Self()); ASSERT_TRUE(c != nullptr); Handle<mirror::Object> obj0 = hs.NewHandle(c->AllocObject(soa.Self())); - ASSERT_TRUE(obj0.Get() != nullptr); + ASSERT_TRUE(obj0 != nullptr); std::string error_msg; IndirectReferenceTable irt(kTableMax, diff --git a/runtime/intern_table_test.cc b/runtime/intern_table_test.cc index 3991d6550d..f0d0260482 100644 --- a/runtime/intern_table_test.cc +++ b/runtime/intern_table_test.cc @@ -36,10 +36,10 @@ TEST_F(InternTableTest, Intern) { Handle<mirror::String> foo_3( hs.NewHandle(mirror::String::AllocFromModifiedUtf8(soa.Self(), "foo"))); Handle<mirror::String> bar(hs.NewHandle(intern_table.InternStrong(3, "bar"))); - ASSERT_TRUE(foo_1.Get() != nullptr); - ASSERT_TRUE(foo_2.Get() != nullptr); - ASSERT_TRUE(foo_3.Get() != nullptr); - ASSERT_TRUE(bar.Get() != nullptr); + ASSERT_TRUE(foo_1 != nullptr); + ASSERT_TRUE(foo_2 != nullptr); + ASSERT_TRUE(foo_3 != nullptr); + ASSERT_TRUE(bar != nullptr); EXPECT_EQ(foo_1.Get(), foo_2.Get()); EXPECT_TRUE(foo_1->Equals("foo")); EXPECT_TRUE(foo_2->Equals("foo")); @@ -204,9 +204,9 @@ TEST_F(InternTableTest, LookupStrong) { Handle<mirror::String> foo(hs.NewHandle(intern_table.InternStrong(3, "foo"))); Handle<mirror::String> bar(hs.NewHandle(intern_table.InternStrong(3, "bar"))); Handle<mirror::String> foobar(hs.NewHandle(intern_table.InternStrong(6, "foobar"))); - ASSERT_TRUE(foo.Get() != nullptr); - ASSERT_TRUE(bar.Get() != nullptr); - ASSERT_TRUE(foobar.Get() != nullptr); + ASSERT_TRUE(foo != nullptr); + ASSERT_TRUE(bar != nullptr); + ASSERT_TRUE(foobar != nullptr); ASSERT_TRUE(foo->Equals("foo")); ASSERT_TRUE(bar->Equals("bar")); ASSERT_TRUE(foobar->Equals("foobar")); diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index 28bcb97105..d7bfda87e1 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -542,7 +542,7 @@ bool DoInvokePolymorphic(Thread* self, Handle<mirror::MethodHandleImpl> method_handle(hs.NewHandle( ObjPtr<mirror::MethodHandleImpl>::DownCast( MakeObjPtr(shadow_frame.GetVRegReference(vRegC))))); - if (UNLIKELY(method_handle.Get() == nullptr)) { + if (UNLIKELY(method_handle == nullptr)) { // Note that the invoke type is kVirtual here because a call to a signature // polymorphic method is shaped like a virtual call at the bytecode level. ThrowNullPointerExceptionForMethodAccess(invoke_method_idx, InvokeType::kVirtual); @@ -564,7 +564,7 @@ bool DoInvokePolymorphic(Thread* self, hs.NewHandle<mirror::ClassLoader>(caller_class->GetClassLoader())))); // This implies we couldn't resolve one or more types in this method handle. - if (UNLIKELY(callsite_type.Get() == nullptr)) { + if (UNLIKELY(callsite_type == nullptr)) { CHECK(self->IsExceptionPending()); return false; } diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc index 545cc1ad42..c7e84420d3 100644 --- a/runtime/interpreter/unstarted_runtime.cc +++ b/runtime/interpreter/unstarted_runtime.cc @@ -124,7 +124,7 @@ static void UnstartedRuntimeFindClass(Thread* self, Handle<mirror::String> class const std::string& method_name, bool initialize_class, bool abort_if_not_found) REQUIRES_SHARED(Locks::mutator_lock_) { - CHECK(className.Get() != nullptr); + CHECK(className != nullptr); std::string descriptor(DotToDescriptor(className->ToModifiedUtf8().c_str())); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); @@ -239,7 +239,7 @@ void UnstartedRuntime::UnstartedClassNewInstance( Handle<mirror::Class> h_klass(hs.NewHandle(klass)); // Check that it's not null. - if (h_klass.Get() == nullptr) { + if (h_klass == nullptr) { AbortTransactionOrFail(self, "Class reference is null for newInstance"); return; } @@ -263,7 +263,7 @@ void UnstartedRuntime::UnstartedClassNewInstance( auto* cons = h_klass->FindDeclaredDirectMethod("<init>", "()V", cl->GetImagePointerSize()); if (cons != nullptr) { Handle<mirror::Object> h_obj(hs.NewHandle(klass->AllocObject(self))); - CHECK(h_obj.Get() != nullptr); // We don't expect OOM at compile-time. + CHECK(h_obj != nullptr); // We don't expect OOM at compile-time. EnterInterpreterFromInvoke(self, cons, h_obj.Get(), nullptr, nullptr); if (!self->IsExceptionPending()) { result->SetL(h_obj.Get()); @@ -542,7 +542,7 @@ static void GetResourceAsStream(Thread* self, // Create byte array for content. Handle<mirror::ByteArray> h_array(hs.NewHandle(mirror::ByteArray::Alloc(self, map_size))); - if (h_array.Get() == nullptr) { + if (h_array == nullptr) { AbortTransactionOrFail(self, "Could not find/create byte array class"); return; } @@ -556,7 +556,7 @@ static void GetResourceAsStream(Thread* self, runtime->GetClassLinker()->FindClass(self, "Ljava/io/ByteArrayInputStream;", ScopedNullHandle<mirror::ClassLoader>()))); - if (h_class.Get() == nullptr) { + if (h_class == nullptr) { AbortTransactionOrFail(self, "Could not find ByteArrayInputStream class"); return; } @@ -566,7 +566,7 @@ static void GetResourceAsStream(Thread* self, } Handle<mirror::Object> h_obj(hs.NewHandle(h_class->AllocObject(self))); - if (h_obj.Get() == nullptr) { + if (h_obj == nullptr) { AbortTransactionOrFail(self, "Could not allocate ByteArrayInputStream object"); return; } @@ -800,7 +800,7 @@ static void GetSystemProperty(Thread* self, StackHandleScope<4> hs(self); Handle<mirror::String> h_key( hs.NewHandle(reinterpret_cast<mirror::String*>(shadow_frame->GetVRegReference(arg_offset)))); - if (h_key.Get() == nullptr) { + if (h_key == nullptr) { AbortTransactionOrFail(self, "getProperty key was null"); return; } @@ -815,7 +815,7 @@ static void GetSystemProperty(Thread* self, class_linker->FindClass(self, "Ljava/lang/AndroidHardcodedSystemProperties;", ScopedNullHandle<mirror::ClassLoader>()))); - if (h_props_class.Get() == nullptr) { + if (h_props_class == nullptr) { AbortTransactionOrFail(self, "Could not find AndroidHardcodedSystemProperties"); return; } @@ -837,7 +837,7 @@ static void GetSystemProperty(Thread* self, ObjPtr<mirror::Object> props = static_properties->GetObject(h_props_class.Get()); Handle<mirror::ObjectArray<mirror::ObjectArray<mirror::String>>> h_2string_array(hs.NewHandle( props->AsObjectArray<mirror::ObjectArray<mirror::String>>())); - if (h_2string_array.Get() == nullptr) { + if (h_2string_array == nullptr) { AbortTransactionOrFail(self, "Field %s is null", kAndroidHardcodedSystemPropertiesFieldName); return; } @@ -849,7 +849,7 @@ static void GetSystemProperty(Thread* self, hs.NewHandle<mirror::ObjectArray<mirror::String>>(nullptr)); for (int32_t i = 0; i < prop_count; ++i) { h_string_array.Assign(h_2string_array->Get(i)); - if (h_string_array.Get() == nullptr || + if (h_string_array == nullptr || h_string_array->GetLength() != 2 || h_string_array->Get(0) == nullptr) { AbortTransactionOrFail(self, @@ -924,7 +924,7 @@ static ObjPtr<mirror::Object> CreateInstanceOf(Thread* self, const char* class_d StackHandleScope<2> hs(self); Handle<mirror::Class> h_class(hs.NewHandle(klass)); Handle<mirror::Object> h_obj(hs.NewHandle(h_class->AllocObject(self))); - if (h_obj.Get() != nullptr) { + if (h_obj != nullptr) { ArtMethod* init_method = h_class->FindDirectMethod( "<init>", "()V", class_linker->GetImagePointerSize()); if (init_method == nullptr) { diff --git a/runtime/interpreter/unstarted_runtime_test.cc b/runtime/interpreter/unstarted_runtime_test.cc index 31be587e9c..16b7b55e00 100644 --- a/runtime/interpreter/unstarted_runtime_test.cc +++ b/runtime/interpreter/unstarted_runtime_test.cc @@ -960,7 +960,7 @@ TEST_F(UnstartedRuntimeTest, ThreadLocalGet) { class_linker->FindClass(self, "Lsun/misc/FloatingDecimal;", ScopedNullHandle<mirror::ClassLoader>())); - ASSERT_TRUE(floating_decimal.Get() != nullptr); + ASSERT_TRUE(floating_decimal != nullptr); ASSERT_TRUE(class_linker->EnsureInitialized(self, floating_decimal, true, true)); ArtMethod* caller_method = floating_decimal->FindDeclaredDirectMethod( @@ -1014,7 +1014,7 @@ TEST_F(UnstartedRuntimeTest, FloatConversion) { class_linker->FindClass(self, "Ljava/lang/Double;", ScopedNullHandle<mirror::ClassLoader>())); - ASSERT_TRUE(double_class.Get() != nullptr); + ASSERT_TRUE(double_class != nullptr); ASSERT_TRUE(class_linker->EnsureInitialized(self, double_class, true, true)); ArtMethod* method = double_class->FindDeclaredDirectMethod("toString", diff --git a/runtime/jdwp/object_registry.cc b/runtime/jdwp/object_registry.cc index 4615574947..bd7251baeb 100644 --- a/runtime/jdwp/object_registry.cc +++ b/runtime/jdwp/object_registry.cc @@ -57,7 +57,7 @@ JDWP::ObjectId ObjectRegistry::Add(ObjPtr<mirror::Object> o) { // Template instantiations must be declared below. template<class T> JDWP::ObjectId ObjectRegistry::Add(Handle<T> obj_h) { - if (obj_h.Get() == nullptr) { + if (obj_h == nullptr) { return 0; } return InternalAdd(obj_h); @@ -76,7 +76,7 @@ JDWP::ObjectId ObjectRegistry::Add(Handle<mirror::Throwable> obj_h); template<class T> JDWP::ObjectId ObjectRegistry::InternalAdd(Handle<T> obj_h) { - CHECK(obj_h.Get() != nullptr); + CHECK(obj_h != nullptr); Thread* const self = Thread::Current(); self->AssertNoPendingException(); diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc index 3c641b0b75..547b5b8a2d 100644 --- a/runtime/jni_internal.cc +++ b/runtime/jni_internal.cc @@ -196,7 +196,7 @@ static jfieldID FindFieldID(const ScopedObjectAccess& soa, jclass jni_class, con StackHandleScope<2> hs(soa.Self()); Handle<mirror::Class> c( hs.NewHandle(EnsureInitialized(soa.Self(), soa.Decode<mirror::Class>(jni_class)))); - if (c.Get() == nullptr) { + if (c == nullptr) { return nullptr; } ArtField* field = nullptr; diff --git a/runtime/jobject_comparator.cc b/runtime/jobject_comparator.cc index 443f095d05..4c45e3839b 100644 --- a/runtime/jobject_comparator.cc +++ b/runtime/jobject_comparator.cc @@ -34,9 +34,9 @@ bool JobjectComparator::operator()(jobject jobj1, jobject jobj2) const { StackHandleScope<2> hs(soa.Self()); Handle<mirror::Object> obj1(hs.NewHandle(soa.Decode<mirror::Object>(jobj1))); Handle<mirror::Object> obj2(hs.NewHandle(soa.Decode<mirror::Object>(jobj2))); - if (obj1.Get() == nullptr) { + if (obj1 == nullptr) { return true; - } else if (obj2.Get() == nullptr) { + } else if (obj2 == nullptr) { return false; } // Sort by class... diff --git a/runtime/method_handles.cc b/runtime/method_handles.cc index 99886e5c2f..834abbbc7b 100644 --- a/runtime/method_handles.cc +++ b/runtime/method_handles.cc @@ -220,7 +220,7 @@ bool ConvertJValueCommon( StackHandleScope<2> hs(Thread::Current()); Handle<mirror::Class> h_to(hs.NewHandle(to)); Handle<mirror::Object> h_obj(hs.NewHandle(src_value.GetL())); - if (h_obj.Get() != nullptr && !to->IsAssignableFrom(h_obj->GetClass())) { + if (h_obj != nullptr && !to->IsAssignableFrom(h_obj->GetClass())) { ThrowClassCastException(h_to.Get(), h_obj->GetClass()); return false; } @@ -599,7 +599,7 @@ static inline bool DoCallTransform(ArtMethod* called_method, // Something went wrong while creating the emulated stack frame, we should // throw the pending exception. - if (sf.Get() == nullptr) { + if (sf == nullptr) { DCHECK(self->IsExceptionPending()); return false; } diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc index cc548b9cc8..f283ec3e9d 100644 --- a/runtime/mirror/array.cc +++ b/runtime/mirror/array.cc @@ -52,7 +52,7 @@ static Array* RecursiveCreateMultiArray(Thread* self, Array::Alloc<true>(self, array_class.Get(), array_length, array_class->GetComponentSizeShift(), Runtime::Current()->GetHeap()->GetCurrentAllocator()))); - if (UNLIKELY(new_array.Get() == nullptr)) { + if (UNLIKELY(new_array == nullptr)) { CHECK(self->IsExceptionPending()); return nullptr; } @@ -98,14 +98,14 @@ Array* Array::CreateMultiArray(Thread* self, Handle<Class> element_class, StackHandleScope<1> hs(self); MutableHandle<mirror::Class> array_class( hs.NewHandle(class_linker->FindArrayClass(self, &element_class_ptr))); - if (UNLIKELY(array_class.Get() == nullptr)) { + if (UNLIKELY(array_class == nullptr)) { CHECK(self->IsExceptionPending()); return nullptr; } for (int32_t i = 1; i < dimensions->GetLength(); ++i) { ObjPtr<mirror::Class> array_class_ptr = array_class.Get(); array_class.Assign(class_linker->FindArrayClass(self, &array_class_ptr)); - if (UNLIKELY(array_class.Get() == nullptr)) { + if (UNLIKELY(array_class == nullptr)) { CHECK(self->IsExceptionPending()); return nullptr; } diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc index 1b8f3f83e7..9a9a5d8398 100644 --- a/runtime/mirror/class.cc +++ b/runtime/mirror/class.cc @@ -81,7 +81,7 @@ ClassExt* Class::EnsureExtDataPresent(Thread* self) { self->ClearException(); // Allocate the ClassExt Handle<ClassExt> new_ext(hs.NewHandle(ClassExt::Alloc(self))); - if (new_ext.Get() == nullptr) { + if (new_ext == nullptr) { // OOM allocating the classExt. // TODO Should we restore the suppressed exception? self->AssertPendingOOMException(); @@ -103,7 +103,7 @@ ClassExt* Class::EnsureExtDataPresent(Thread* self) { DCHECK(!set || h_this->GetExtData() == new_ext.Get()); CHECK(!ret.IsNull()); // Restore the exception if there was one. - if (throwable.Get() != nullptr) { + if (throwable != nullptr) { self->SetException(throwable.Get()); } return ret.Ptr(); @@ -269,10 +269,10 @@ void Class::DumpClass(std::ostream& os, int flags) { os << "----- " << (IsInterface() ? "interface" : "class") << " " << "'" << GetDescriptor(&temp) << "' cl=" << GetClassLoader() << " -----\n", os << " objectSize=" << SizeOf() << " " - << "(" << (h_super.Get() != nullptr ? h_super->SizeOf() : -1) << " from super)\n", + << "(" << (h_super != nullptr ? h_super->SizeOf() : -1) << " from super)\n", os << StringPrintf(" access=0x%04x.%04x\n", GetAccessFlags() >> 16, GetAccessFlags() & kAccJavaFlagsMask); - if (h_super.Get() != nullptr) { + if (h_super != nullptr) { os << " super='" << h_super->PrettyClass() << "' (cl=" << h_super->GetClassLoader() << ")\n"; } @@ -297,7 +297,7 @@ void Class::DumpClass(std::ostream& os, int flags) { } else { // After this point, this may have moved due to GetDirectInterface. os << " vtable (" << h_this->NumVirtualMethods() << " entries, " - << (h_super.Get() != nullptr ? h_super->NumVirtualMethods() : 0) << " in super):\n"; + << (h_super != nullptr ? h_super->NumVirtualMethods() : 0) << " in super):\n"; for (size_t i = 0; i < NumVirtualMethods(); ++i) { os << StringPrintf(" %2zd: %s\n", i, ArtMethod::PrettyMethod( h_this->GetVirtualMethodDuringLinking(i, image_pointer_size)).c_str()); @@ -971,7 +971,7 @@ ObjPtr<Class> Class::ResolveDirectInterface(Thread* self, Handle<Class> klass, u } ObjPtr<Class> Class::GetCommonSuperClass(Handle<Class> klass) { - DCHECK(klass.Get() != nullptr); + DCHECK(klass != nullptr); DCHECK(!klass->IsInterface()); DCHECK(!IsInterface()); ObjPtr<Class> common_super_class = this; @@ -1165,7 +1165,7 @@ ObjPtr<Method> Class::GetDeclaredMethodInternal( constexpr uint32_t kSkipModifiers = kAccMiranda | kAccSynthetic; StackHandleScope<3> hs(self); auto h_method_name = hs.NewHandle(name); - if (UNLIKELY(h_method_name.Get() == nullptr)) { + if (UNLIKELY(h_method_name == nullptr)) { ThrowNullPointerException("name == null"); return nullptr; } diff --git a/runtime/mirror/class_ext.cc b/runtime/mirror/class_ext.cc index efd949e031..7270079a8f 100644 --- a/runtime/mirror/class_ext.cc +++ b/runtime/mirror/class_ext.cc @@ -58,8 +58,8 @@ bool ClassExt::ExtendObsoleteArrays(Thread* self, uint32_t increase) { Handle<ObjectArray<DexCache>> old_dex_caches(hs.NewHandle(h_this->GetObsoleteDexCaches())); ClassLinker* cl = Runtime::Current()->GetClassLinker(); size_t new_len; - if (old_methods.Get() == nullptr) { - CHECK(old_dex_caches.Get() == nullptr); + if (old_methods == nullptr) { + CHECK(old_dex_caches == nullptr); new_len = increase; } else { CHECK_EQ(old_methods->GetLength(), old_dex_caches->GetLength()); diff --git a/runtime/mirror/dex_cache_test.cc b/runtime/mirror/dex_cache_test.cc index 8f978e122c..5a2ab7151c 100644 --- a/runtime/mirror/dex_cache_test.cc +++ b/runtime/mirror/dex_cache_test.cc @@ -47,7 +47,7 @@ TEST_F(DexCacheTest, Open) { soa.Self(), *java_lang_dex_file_, Runtime::Current()->GetLinearAlloc()))); - ASSERT_TRUE(dex_cache.Get() != nullptr); + ASSERT_TRUE(dex_cache != nullptr); EXPECT_TRUE(dex_cache->StaticStringSize() == dex_cache->NumStrings() || java_lang_dex_file_->NumStringIds() == dex_cache->NumStrings()); @@ -95,10 +95,10 @@ TEST_F(DexCacheTest, TestResolvedFieldAccess) { soa.Decode<mirror::ClassLoader>(jclass_loader))); Handle<mirror::Class> klass1 = hs.NewHandle(class_linker_->FindClass(soa.Self(), "Lpackage1/Package1;", class_loader)); - ASSERT_TRUE(klass1.Get() != nullptr); + ASSERT_TRUE(klass1 != nullptr); Handle<mirror::Class> klass2 = hs.NewHandle(class_linker_->FindClass(soa.Self(), "Lpackage2/Package2;", class_loader)); - ASSERT_TRUE(klass2.Get() != nullptr); + ASSERT_TRUE(klass2 != nullptr); EXPECT_EQ(klass1->GetDexCache(), klass2->GetDexCache()); EXPECT_NE(klass1->NumStaticFields(), 0u); diff --git a/runtime/mirror/emulated_stack_frame.cc b/runtime/mirror/emulated_stack_frame.cc index 978cc32320..be0eac05c9 100644 --- a/runtime/mirror/emulated_stack_frame.cc +++ b/runtime/mirror/emulated_stack_frame.cc @@ -173,13 +173,13 @@ mirror::EmulatedStackFrame* EmulatedStackFrame::CreateFromShadowFrameAndArgs( Handle<mirror::ObjectArray<mirror::Object>> references(hs.NewHandle( mirror::ObjectArray<mirror::Object>::Alloc(self, array_class, refs_size))); - if (references.Get() == nullptr) { + if (references == nullptr) { DCHECK(self->IsExceptionPending()); return nullptr; } Handle<ByteArray> stack_frame(hs.NewHandle(ByteArray::Alloc(self, frame_size))); - if (stack_frame.Get() == nullptr) { + if (stack_frame == nullptr) { DCHECK(self->IsExceptionPending()); return nullptr; } diff --git a/runtime/mirror/field-inl.h b/runtime/mirror/field-inl.h index c03f20a991..2496989337 100644 --- a/runtime/mirror/field-inl.h +++ b/runtime/mirror/field-inl.h @@ -33,7 +33,7 @@ inline mirror::Field* Field::CreateFromArtField(Thread* self, ArtField* field, b // Try to resolve type before allocating since this is a thread suspension point. Handle<mirror::Class> type = hs.NewHandle(field->GetType<true>()); - if (type.Get() == nullptr) { + if (type == nullptr) { if (force_resolve) { if (kIsDebugBuild) { self->AssertPendingException(); @@ -49,7 +49,7 @@ inline mirror::Field* Field::CreateFromArtField(Thread* self, ArtField* field, b } } auto ret = hs.NewHandle(ObjPtr<Field>::DownCast(StaticClass()->AllocObject(self))); - if (UNLIKELY(ret.Get() == nullptr)) { + if (UNLIKELY(ret == nullptr)) { self->AssertPendingOOMException(); return nullptr; } diff --git a/runtime/mirror/method_type_test.cc b/runtime/mirror/method_type_test.cc index 637bafd75e..41231ef617 100644 --- a/runtime/mirror/method_type_test.cc +++ b/runtime/mirror/method_type_test.cc @@ -51,7 +51,7 @@ static mirror::MethodType* CreateMethodType(const std::string& return_type, Handle<mirror::Class> return_clazz = hs.NewHandle(class_linker->FindClass( soa.Self(), FullyQualifiedType(return_type).c_str(), boot_class_loader)); - CHECK(return_clazz.Get() != nullptr); + CHECK(return_clazz != nullptr); ObjPtr<mirror::Class> class_type = mirror::Class::GetJavaLangClass(); mirror::Class* class_array_type = class_linker->FindArrayClass(self, &class_type); diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc index 6a4ec9dca7..e761e4db7a 100644 --- a/runtime/mirror/object_test.cc +++ b/runtime/mirror/object_test.cc @@ -530,8 +530,8 @@ TEST_F(ObjectTest, InstanceOf) { Handle<Object> x(hs.NewHandle(X->AllocObject(soa.Self()))); Handle<Object> y(hs.NewHandle(Y->AllocObject(soa.Self()))); - ASSERT_TRUE(x.Get() != nullptr); - ASSERT_TRUE(y.Get() != nullptr); + ASSERT_TRUE(x != nullptr); + ASSERT_TRUE(y != nullptr); EXPECT_TRUE(x->InstanceOf(X)); EXPECT_FALSE(x->InstanceOf(Y)); @@ -650,7 +650,7 @@ TEST_F(ObjectTest, FindInstanceField) { ScopedObjectAccess soa(Thread::Current()); StackHandleScope<1> hs(soa.Self()); Handle<String> s(hs.NewHandle(String::AllocFromModifiedUtf8(soa.Self(), "ABC"))); - ASSERT_TRUE(s.Get() != nullptr); + ASSERT_TRUE(s != nullptr); Class* c = s->GetClass(); ASSERT_TRUE(c != nullptr); @@ -684,9 +684,9 @@ TEST_F(ObjectTest, FindStaticField) { ScopedObjectAccess soa(Thread::Current()); StackHandleScope<4> hs(soa.Self()); Handle<String> s(hs.NewHandle(String::AllocFromModifiedUtf8(soa.Self(), "ABC"))); - ASSERT_TRUE(s.Get() != nullptr); + ASSERT_TRUE(s != nullptr); Handle<Class> c(hs.NewHandle(s->GetClass())); - ASSERT_TRUE(c.Get() != nullptr); + ASSERT_TRUE(c != nullptr); // Wrong type. EXPECT_TRUE(c->FindDeclaredStaticField("CASE_INSENSITIVE_ORDER", "I") == nullptr); diff --git a/runtime/monitor_test.cc b/runtime/monitor_test.cc index 4fbfe4781c..27ce149342 100644 --- a/runtime/monitor_test.cc +++ b/runtime/monitor_test.cc @@ -77,7 +77,7 @@ static void FillHeap(Thread* self, ClassLinker* class_linker, while (length > 10) { MutableHandle<mirror::Object> h((*hsp)->NewHandle<mirror::Object>( mirror::ObjectArray<mirror::Object>::Alloc(self, ca.Get(), length / 4))); - if (self->IsExceptionPending() || h.Get() == nullptr) { + if (self->IsExceptionPending() || h == nullptr) { self->ClearException(); // Try a smaller length @@ -95,7 +95,7 @@ static void FillHeap(Thread* self, ClassLinker* class_linker, // Allocate simple objects till it fails. while (!self->IsExceptionPending()) { MutableHandle<mirror::Object> h = (*hsp)->NewHandle<mirror::Object>(c->AllocObject(self)); - if (!self->IsExceptionPending() && h.Get() != nullptr) { + if (!self->IsExceptionPending() && h != nullptr) { handles->push_back(h); } } diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc index 24308d9e81..6bfccdc8fb 100644 --- a/runtime/native/dalvik_system_VMRuntime.cc +++ b/runtime/native/dalvik_system_VMRuntime.cc @@ -350,7 +350,7 @@ static void PreloadDexCachesResolveField(Handle<mirror::DexCache> dex_cache, uin Thread* const self = Thread::Current(); StackHandleScope<1> hs(self); Handle<mirror::Class> klass(hs.NewHandle(dex_cache->GetResolvedType(field_id.class_idx_))); - if (klass.Get() == nullptr) { + if (klass == nullptr) { return; } if (is_static) { @@ -512,7 +512,7 @@ static void VMRuntime_preloadDexCaches(JNIEnv* env, jobject) { CHECK(dex_file != nullptr); StackHandleScope<1> hs(soa.Self()); Handle<mirror::DexCache> dex_cache(hs.NewHandle(linker->RegisterDexFile(*dex_file, nullptr))); - CHECK(dex_cache.Get() != nullptr); // Boot class path dex caches are never unloaded. + CHECK(dex_cache != nullptr); // Boot class path dex caches are never unloaded. if (kPreloadDexCachesStrings) { for (size_t j = 0; j < dex_cache->NumStrings(); j++) { PreloadDexCachesResolveString(dex_cache, dex::StringIndex(j), strings); diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc index 5438a6ddb4..256787b2a1 100644 --- a/runtime/native/java_lang_Class.cc +++ b/runtime/native/java_lang_Class.cc @@ -81,7 +81,7 @@ static jclass Class_classForName(JNIEnv* env, jclass, jstring javaName, jboolean ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); Handle<mirror::Class> c( hs.NewHandle(class_linker->FindClass(soa.Self(), descriptor.c_str(), class_loader))); - if (c.Get() == nullptr) { + if (c == nullptr) { ScopedLocalRef<jthrowable> cause(env, env->ExceptionOccurred()); env->ExceptionClear(); jthrowable cnfe = reinterpret_cast<jthrowable>( @@ -137,7 +137,7 @@ static mirror::ObjectArray<mirror::Field>* GetDeclaredFields( size_t array_idx = 0; auto object_array = hs.NewHandle(mirror::ObjectArray<mirror::Field>::Alloc( self, mirror::Field::ArrayClass(), array_size)); - if (object_array.Get() == nullptr) { + if (object_array == nullptr) { return nullptr; } for (ArtField& field : ifields) { @@ -267,7 +267,7 @@ static mirror::Field* GetPublicFieldRecursive( Handle<mirror::String> h_name(hs.NewHandle(name)); // We search the current class, its direct interfaces then its superclass. - while (h_clazz.Get() != nullptr) { + while (h_clazz != nullptr) { mirror::Field* result = GetDeclaredField(self, h_clazz.Get(), h_name.Get()); if ((result != nullptr) && (result->GetAccessFlags() & kAccPublic)) { return result; @@ -319,14 +319,14 @@ static jobject Class_getDeclaredField(JNIEnv* env, jobject javaThis, jstring nam ScopedFastNativeObjectAccess soa(env); StackHandleScope<3> hs(soa.Self()); Handle<mirror::String> h_string = hs.NewHandle(soa.Decode<mirror::String>(name)); - if (h_string.Get() == nullptr) { + if (h_string == nullptr) { ThrowNullPointerException("name == null"); return nullptr; } Handle<mirror::Class> h_klass = hs.NewHandle(DecodeClass(soa, javaThis)); Handle<mirror::Field> result = hs.NewHandle(GetDeclaredField(soa.Self(), h_klass.Get(), h_string.Get())); - if (result.Get() == nullptr) { + if (result == nullptr) { std::string name_str = h_string->ToModifiedUtf8(); if (name_str == "value" && h_klass->IsStringClass()) { // We log the error for this specific case, as the user might just swallow the exception. @@ -377,7 +377,7 @@ static jobjectArray Class_getDeclaredConstructorsInternal( } auto h_constructors = hs.NewHandle(mirror::ObjectArray<mirror::Constructor>::Alloc( soa.Self(), mirror::Constructor::ArrayClass(), constructor_count)); - if (UNLIKELY(h_constructors.Get() == nullptr)) { + if (UNLIKELY(h_constructors == nullptr)) { soa.Self()->AssertPendingException(); return nullptr; } @@ -428,7 +428,7 @@ static jobjectArray Class_getDeclaredMethodsUnchecked(JNIEnv* env, jobject javaT } auto ret = hs.NewHandle(mirror::ObjectArray<mirror::Method>::Alloc( soa.Self(), mirror::Method::ArrayClass(), num_methods)); - if (ret.Get() == nullptr) { + if (ret == nullptr) { soa.Self()->AssertPendingOOMException(); return nullptr; } @@ -645,7 +645,7 @@ static jobject Class_newInstance(JNIEnv* env, jobject javaThis) { // Verify that we can access the class. if (!klass->IsPublic()) { caller.Assign(GetCallingClass(soa.Self(), 1)); - if (caller.Get() != nullptr && !caller->CanAccess(klass.Get())) { + if (caller != nullptr && !caller->CanAccess(klass.Get())) { soa.Self()->ThrowNewExceptionF( "Ljava/lang/IllegalAccessException;", "%s is not accessible from %s", klass->PrettyClass().c_str(), caller->PrettyClass().c_str()); @@ -673,17 +673,17 @@ static jobject Class_newInstance(JNIEnv* env, jobject javaThis) { } } auto receiver = hs.NewHandle(klass->AllocObject(soa.Self())); - if (UNLIKELY(receiver.Get() == nullptr)) { + if (UNLIKELY(receiver == nullptr)) { soa.Self()->AssertPendingOOMException(); return nullptr; } // Verify that we can access the constructor. auto* declaring_class = constructor->GetDeclaringClass(); if (!constructor->IsPublic()) { - if (caller.Get() == nullptr) { + if (caller == nullptr) { caller.Assign(GetCallingClass(soa.Self(), 1)); } - if (UNLIKELY(caller.Get() != nullptr && !VerifyAccess(receiver.Get(), + if (UNLIKELY(caller != nullptr && !VerifyAccess(receiver.Get(), declaring_class, constructor->GetAccessFlags(), caller.Get()))) { diff --git a/runtime/native/java_lang_invoke_MethodHandleImpl.cc b/runtime/native/java_lang_invoke_MethodHandleImpl.cc index 72a37f875d..9113841909 100644 --- a/runtime/native/java_lang_invoke_MethodHandleImpl.cc +++ b/runtime/native/java_lang_invoke_MethodHandleImpl.cc @@ -57,7 +57,7 @@ static jobject MethodHandleImpl_getMemberInternal(JNIEnv* env, jobject thiz) { } } - if (UNLIKELY(h_object.Get() == nullptr)) { + if (UNLIKELY(h_object == nullptr)) { soa.Self()->AssertPendingOOMException(); return nullptr; } diff --git a/runtime/native/java_lang_reflect_Executable.cc b/runtime/native/java_lang_reflect_Executable.cc index ee59c4a9e2..2a3942829f 100644 --- a/runtime/native/java_lang_reflect_Executable.cc +++ b/runtime/native/java_lang_reflect_Executable.cc @@ -103,7 +103,7 @@ static jobjectArray Executable_getParameters0(JNIEnv* env, jobject javaMethod) { } // Validate the MethodParameters system annotation data. - if (UNLIKELY(names.Get() == nullptr || access_flags.Get() == nullptr)) { + if (UNLIKELY(names == nullptr || access_flags == nullptr)) { ThrowIllegalArgumentException( StringPrintf("Missing parameter metadata for names or access flags for %s", art_method->PrettyMethod().c_str()).c_str()); @@ -132,7 +132,7 @@ static jobjectArray Executable_getParameters0(JNIEnv* env, jobject javaMethod) { mirror::ObjectArray<mirror::Object>::Alloc(self, parameter_array_class.Get(), names_count)); - if (UNLIKELY(parameter_array.Get() == nullptr)) { + if (UNLIKELY(parameter_array == nullptr)) { self->AssertPendingException(); return nullptr; } @@ -154,7 +154,7 @@ static jobjectArray Executable_getParameters0(JNIEnv* env, jobject javaMethod) { // Allocate / initialize the Parameter to add to parameter_array. parameter.Assign(parameter_class->AllocObject(self)); - if (UNLIKELY(parameter.Get() == nullptr)) { + if (UNLIKELY(parameter == nullptr)) { self->AssertPendingOOMException(); return nullptr; } diff --git a/runtime/native/libcore_util_CharsetUtils.cc b/runtime/native/libcore_util_CharsetUtils.cc index 2590452678..e51b6d2a89 100644 --- a/runtime/native/libcore_util_CharsetUtils.cc +++ b/runtime/native/libcore_util_CharsetUtils.cc @@ -155,7 +155,7 @@ static jbyteArray charsToBytes(JNIEnv* env, jstring java_string, jint offset, ji ScopedObjectAccess soa(env); StackHandleScope<1> hs(soa.Self()); Handle<mirror::String> string(hs.NewHandle(soa.Decode<mirror::String>(java_string))); - if (string.Get() == nullptr) { + if (string == nullptr) { return nullptr; } @@ -192,7 +192,7 @@ static jbyteArray CharsetUtils_toUtf8Bytes(JNIEnv* env, jclass, jstring java_str ScopedObjectAccess soa(env); StackHandleScope<1> hs(soa.Self()); Handle<mirror::String> string(hs.NewHandle(soa.Decode<mirror::String>(java_string))); - if (string.Get() == nullptr) { + if (string == nullptr) { return nullptr; } diff --git a/runtime/oat_file_assistant_test.cc b/runtime/oat_file_assistant_test.cc index 6cfe3d1315..9b35489330 100644 --- a/runtime/oat_file_assistant_test.cc +++ b/runtime/oat_file_assistant_test.cc @@ -1059,7 +1059,7 @@ TEST_F(OatFileAssistantTest, DexOptStatusValues) { ClassLinker* linker = Runtime::Current()->GetClassLinker(); Handle<mirror::Class> dexfile( hs.NewHandle(linker->FindSystemClass(soa.Self(), "Ldalvik/system/DexFile;"))); - ASSERT_FALSE(dexfile.Get() == nullptr); + ASSERT_FALSE(dexfile == nullptr); linker->EnsureInitialized(soa.Self(), dexfile, true, true); for (std::pair<OatFileAssistant::DexOptNeeded, const char*> field : mapping) { diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc index a46b47075c..70796148a4 100644 --- a/runtime/oat_file_manager.cc +++ b/runtime/oat_file_manager.cc @@ -342,7 +342,7 @@ static void GetDexFilesFromDexElementsArray( ScopedObjectAccessAlreadyRunnable& soa, Handle<mirror::ObjectArray<mirror::Object>> dex_elements, std::priority_queue<DexFileAndClassPair>* queue) REQUIRES_SHARED(Locks::mutator_lock_) { - if (dex_elements.Get() == nullptr) { + if (dex_elements == nullptr) { // Nothing to do. return; } @@ -463,14 +463,14 @@ bool OatFileManager::HasCollisions(const OatFile* oat_file, hs.NewHandle(soa.Decode<mirror::ClassLoader>(class_loader)); Handle<mirror::ObjectArray<mirror::Object>> h_dex_elements = hs.NewHandle(soa.Decode<mirror::ObjectArray<mirror::Object>>(dex_elements)); - if (h_class_loader.Get() != nullptr && + if (h_class_loader != nullptr && GetDexFilesFromClassLoader(soa, h_class_loader.Get(), &queue)) { class_loader_ok = true; // In this case, also take into account the dex_elements array, if given. We don't need to // read it otherwise, as we'll compare against all open oat files anyways. GetDexFilesFromDexElementsArray(soa, h_dex_elements, &queue); - } else if (h_class_loader.Get() != nullptr) { + } else if (h_class_loader != nullptr) { VLOG(class_linker) << "Something unsupported with " << mirror::Class::PrettyClass(h_class_loader->GetClass()); } @@ -658,7 +658,7 @@ std::vector<std::unique_ptr<const DexFile>> OatFileManager::OpenDexFilesFromOat( Handle<mirror::ClassLoader> h_loader( hs.NewHandle(soa.Decode<mirror::ClassLoader>(class_loader))); // Can not load app image without class loader. - if (h_loader.Get() != nullptr) { + if (h_loader != nullptr) { std::string temp_error_msg; // Add image space has a race condition since other threads could be reading from the // spaces array. diff --git a/runtime/object_lock.cc b/runtime/object_lock.cc index 39ab52fb2d..f6db544276 100644 --- a/runtime/object_lock.cc +++ b/runtime/object_lock.cc @@ -24,7 +24,7 @@ namespace art { template <typename T> ObjectLock<T>::ObjectLock(Thread* self, Handle<T> object) : self_(self), obj_(object) { - CHECK(object.Get() != nullptr); + CHECK(object != nullptr); obj_->MonitorEnter(self_); } @@ -50,7 +50,7 @@ void ObjectLock<T>::NotifyAll() { template <typename T> ObjectTryLock<T>::ObjectTryLock(Thread* self, Handle<T> object) : self_(self), obj_(object) { - CHECK(object.Get() != nullptr); + CHECK(object != nullptr); acquired_ = obj_->MonitorTryEnter(self_) != nullptr; } diff --git a/runtime/openjdkjvmti/ti_class_loader.cc b/runtime/openjdkjvmti/ti_class_loader.cc index afec0bfac0..d05f579407 100644 --- a/runtime/openjdkjvmti/ti_class_loader.cc +++ b/runtime/openjdkjvmti/ti_class_loader.cc @@ -119,11 +119,11 @@ art::ObjPtr<art::mirror::LongArray> ClassLoaderHelper::AllocateNewDexFileCookie( art::Handle<art::mirror::LongArray> cookie, const art::DexFile* dex_file) { art::StackHandleScope<1> hs(self); - CHECK(cookie.Get() != nullptr); + CHECK(cookie != nullptr); CHECK_GE(cookie->GetLength(), 1); art::Handle<art::mirror::LongArray> new_cookie( hs.NewHandle(art::mirror::LongArray::Alloc(self, cookie->GetLength() + 1))); - if (new_cookie.Get() == nullptr) { + if (new_cookie == nullptr) { self->AssertPendingOOMException(); return nullptr; } @@ -183,13 +183,13 @@ art::ObjPtr<art::mirror::Object> ClassLoaderHelper::FindSourceDexFileObject( // Start navigating the fields of the loader (now known to be a BaseDexClassLoader derivative) art::Handle<art::mirror::Object> path_list( hs.NewHandle(path_list_field->GetObject(loader.Get()))); - CHECK(path_list.Get() != nullptr); + CHECK(path_list != nullptr); CHECK(!self->IsExceptionPending()); art::Handle<art::mirror::ObjectArray<art::mirror::Object>> dex_elements_list(hs.NewHandle( dex_path_list_element_field->GetObject(path_list.Get())-> AsObjectArray<art::mirror::Object>())); CHECK(!self->IsExceptionPending()); - CHECK(dex_elements_list.Get() != nullptr); + CHECK(dex_elements_list != nullptr); size_t num_elements = dex_elements_list->GetLength(); // Iterate over the DexPathList$Element to find the right one for (size_t i = 0; i < num_elements; i++) { diff --git a/runtime/openjdkjvmti/ti_redefine.cc b/runtime/openjdkjvmti/ti_redefine.cc index 843fd8c8e4..310fc8eb45 100644 --- a/runtime/openjdkjvmti/ti_redefine.cc +++ b/runtime/openjdkjvmti/ti_redefine.cc @@ -939,7 +939,7 @@ bool Redefiner::ClassRedefinition::FinishRemainingAllocations( art::Handle<art::mirror::Object> dex_file_obj(hs.NewHandle( ClassLoaderHelper::FindSourceDexFileObject(driver_->self_, loader))); holder->SetJavaDexFile(klass_index, dex_file_obj.Get()); - if (dex_file_obj.Get() == nullptr) { + if (dex_file_obj == nullptr) { // TODO Better error msg. RecordFailure(ERR(INTERNAL), "Unable to find dex file!"); return false; @@ -1212,13 +1212,13 @@ bool Redefiner::ClassRedefinition::EnsureClassAllocationsFinished() { art::StackHandleScope<2> hs(driver_->self_); art::Handle<art::mirror::Class> klass(hs.NewHandle( driver_->self_->DecodeJObject(klass_)->AsClass())); - if (klass.Get() == nullptr) { + if (klass == nullptr) { RecordFailure(ERR(INVALID_CLASS), "Unable to decode class argument!"); return false; } // Allocate the classExt art::Handle<art::mirror::ClassExt> ext(hs.NewHandle(klass->EnsureExtDataPresent(driver_->self_))); - if (ext.Get() == nullptr) { + if (ext == nullptr) { // No memory. Clear exception (it's not useful) and return error. // TODO This doesn't need to be fatal. We could just not support obsolete methods after hitting // this case. diff --git a/runtime/openjdkjvmti/ti_threadgroup.cc b/runtime/openjdkjvmti/ti_threadgroup.cc index e63ce6576a..142387433e 100644 --- a/runtime/openjdkjvmti/ti_threadgroup.cc +++ b/runtime/openjdkjvmti/ti_threadgroup.cc @@ -155,7 +155,7 @@ jvmtiError ThreadGroupUtil::GetThreadGroupInfo(jvmtiEnv* env, static bool IsInDesiredThreadGroup(art::Handle<art::mirror::Object> desired_thread_group, art::ObjPtr<art::mirror::Object> peer) REQUIRES_SHARED(art::Locks::mutator_lock_) { - CHECK(desired_thread_group.Get() != nullptr); + CHECK(desired_thread_group != nullptr); art::ArtField* thread_group_field = art::jni::DecodeArtField(art::WellKnownClasses::java_lang_Thread_group); @@ -167,7 +167,7 @@ static bool IsInDesiredThreadGroup(art::Handle<art::mirror::Object> desired_thre static void GetThreads(art::Handle<art::mirror::Object> thread_group, std::vector<art::ObjPtr<art::mirror::Object>>* thread_peers) REQUIRES_SHARED(art::Locks::mutator_lock_) REQUIRES(!art::Locks::thread_list_lock_) { - CHECK(thread_group.Get() != nullptr); + CHECK(thread_group != nullptr); art::MutexLock mu(art::Thread::Current(), *art::Locks::thread_list_lock_); for (art::Thread* t : art::Runtime::Current()->GetThreadList()->GetList()) { @@ -187,7 +187,7 @@ static void GetThreads(art::Handle<art::mirror::Object> thread_group, static void GetChildThreadGroups(art::Handle<art::mirror::Object> thread_group, std::vector<art::ObjPtr<art::mirror::Object>>* thread_groups) REQUIRES_SHARED(art::Locks::mutator_lock_) { - CHECK(thread_group.Get() != nullptr); + CHECK(thread_group != nullptr); // Get the ThreadGroup[] "groups" out of this thread group... art::ArtField* groups_field = diff --git a/runtime/proxy_test.cc b/runtime/proxy_test.cc index 1292a819a3..5748475163 100644 --- a/runtime/proxy_test.cc +++ b/runtime/proxy_test.cc @@ -114,8 +114,8 @@ TEST_F(ProxyTest, ProxyClassHelper) { class_linker_->FindClass(soa.Self(), "LInterfaces$I;", class_loader))); Handle<mirror::Class> J(hs.NewHandle( class_linker_->FindClass(soa.Self(), "LInterfaces$J;", class_loader))); - ASSERT_TRUE(I.Get() != nullptr); - ASSERT_TRUE(J.Get() != nullptr); + ASSERT_TRUE(I != nullptr); + ASSERT_TRUE(J != nullptr); std::vector<mirror::Class*> interfaces; interfaces.push_back(I.Get()); @@ -123,7 +123,7 @@ TEST_F(ProxyTest, ProxyClassHelper) { Handle<mirror::Class> proxy_class(hs.NewHandle( GenerateProxyClass(soa, jclass_loader, "$Proxy1234", interfaces))); interfaces.clear(); // Don't least possibly stale objects in the array as good practice. - ASSERT_TRUE(proxy_class.Get() != nullptr); + ASSERT_TRUE(proxy_class != nullptr); ASSERT_TRUE(proxy_class->IsProxyClass()); ASSERT_TRUE(proxy_class->IsInitialized()); @@ -148,8 +148,8 @@ TEST_F(ProxyTest, ProxyFieldHelper) { class_linker_->FindClass(soa.Self(), "LInterfaces$I;", class_loader))); Handle<mirror::Class> J(hs.NewHandle( class_linker_->FindClass(soa.Self(), "LInterfaces$J;", class_loader))); - ASSERT_TRUE(I.Get() != nullptr); - ASSERT_TRUE(J.Get() != nullptr); + ASSERT_TRUE(I != nullptr); + ASSERT_TRUE(J != nullptr); Handle<mirror::Class> proxyClass; { @@ -159,7 +159,7 @@ TEST_F(ProxyTest, ProxyFieldHelper) { proxyClass = hs.NewHandle(GenerateProxyClass(soa, jclass_loader, "$Proxy1234", interfaces)); } - ASSERT_TRUE(proxyClass.Get() != nullptr); + ASSERT_TRUE(proxyClass != nullptr); ASSERT_TRUE(proxyClass->IsProxyClass()); ASSERT_TRUE(proxyClass->IsInitialized()); @@ -171,10 +171,10 @@ TEST_F(ProxyTest, ProxyFieldHelper) { Handle<mirror::Class> interfacesFieldClass( hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[Ljava/lang/Class;"))); - ASSERT_TRUE(interfacesFieldClass.Get() != nullptr); + ASSERT_TRUE(interfacesFieldClass != nullptr); Handle<mirror::Class> throwsFieldClass( hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[[Ljava/lang/Class;"))); - ASSERT_TRUE(throwsFieldClass.Get() != nullptr); + ASSERT_TRUE(throwsFieldClass != nullptr); // Test "Class[] interfaces" field. ArtField* field = &static_fields->At(0); @@ -208,10 +208,10 @@ TEST_F(ProxyTest, CheckArtMirrorFieldsOfProxyStaticFields) { proxyClass1 = hs.NewHandle(GenerateProxyClass(soa, jclass_loader, "$Proxy1", interfaces)); } - ASSERT_TRUE(proxyClass0.Get() != nullptr); + ASSERT_TRUE(proxyClass0 != nullptr); ASSERT_TRUE(proxyClass0->IsProxyClass()); ASSERT_TRUE(proxyClass0->IsInitialized()); - ASSERT_TRUE(proxyClass1.Get() != nullptr); + ASSERT_TRUE(proxyClass1 != nullptr); ASSERT_TRUE(proxyClass1->IsProxyClass()); ASSERT_TRUE(proxyClass1->IsInitialized()); diff --git a/runtime/reference_table_test.cc b/runtime/reference_table_test.cc index 9523e92d7c..4ccfb6d83b 100644 --- a/runtime/reference_table_test.cc +++ b/runtime/reference_table_test.cc @@ -48,12 +48,12 @@ static mirror::Object* CreateWeakReference(mirror::Object* referent) class_linker->FindClass(self, "Ljava/lang/ref/WeakReference;", ScopedNullHandle<mirror::ClassLoader>()))); - CHECK(h_ref_class.Get() != nullptr); + CHECK(h_ref_class != nullptr); CHECK(class_linker->EnsureInitialized(self, h_ref_class, true, true)); Handle<mirror::Object> h_ref_instance(scope.NewHandle<mirror::Object>( h_ref_class->AllocObject(self))); - CHECK(h_ref_instance.Get() != nullptr); + CHECK(h_ref_instance != nullptr); ArtMethod* constructor = h_ref_class->FindDeclaredDirectMethod( "<init>", "(Ljava/lang/Object;)V", class_linker->GetImagePointerSize()); diff --git a/runtime/reflection.cc b/runtime/reflection.cc index a2b4cb37a9..3c64d40720 100644 --- a/runtime/reflection.cc +++ b/runtime/reflection.cc @@ -231,8 +231,8 @@ class ArgArray { hs.NewHandle<mirror::ObjectArray<mirror::Object>>(raw_args)); for (size_t i = 1, args_offset = 0; i < shorty_len_; ++i, ++args_offset) { arg.Assign(args->Get(args_offset)); - if (((shorty_[i] == 'L') && (arg.Get() != nullptr)) || - ((arg.Get() == nullptr && shorty_[i] != 'L'))) { + if (((shorty_[i] == 'L') && (arg != nullptr)) || + ((arg == nullptr && shorty_[i] != 'L'))) { // TODO: The method's parameter's type must have been previously resolved, yet // we've seen cases where it's not b/34440020. ObjPtr<mirror::Class> dst_class( @@ -242,7 +242,7 @@ class ArgArray { CHECK(self->IsExceptionPending()); return false; } - if (UNLIKELY(arg.Get() == nullptr || !arg->InstanceOf(dst_class))) { + if (UNLIKELY(arg == nullptr || !arg->InstanceOf(dst_class))) { ThrowIllegalArgumentException( StringPrintf("method %s argument %zd has type %s, got %s", m->PrettyMethod(false).c_str(), @@ -254,13 +254,13 @@ class ArgArray { } #define DO_FIRST_ARG(match_descriptor, get_fn, append) { \ - if (LIKELY(arg.Get() != nullptr && \ + if (LIKELY(arg != nullptr && \ arg->GetClass()->DescriptorEquals(match_descriptor))) { \ ArtField* primitive_field = arg->GetClass()->GetInstanceField(0); \ append(primitive_field-> get_fn(arg.Get())); #define DO_ARG(match_descriptor, get_fn, append) \ - } else if (LIKELY(arg.Get() != nullptr && \ + } else if (LIKELY(arg != nullptr && \ arg->GetClass<>()->DescriptorEquals(match_descriptor))) { \ ArtField* primitive_field = arg->GetClass()->GetInstanceField(0); \ append(primitive_field-> get_fn(arg.Get())); diff --git a/runtime/runtime_callbacks_test.cc b/runtime/runtime_callbacks_test.cc index f1e78b40e0..abe99e0d50 100644 --- a/runtime/runtime_callbacks_test.cc +++ b/runtime/runtime_callbacks_test.cc @@ -294,7 +294,7 @@ TEST_F(ClassLoadCallbackRuntimeCallbacksTest, ClassLoadCallback) { const char* descriptor_y = "LY;"; Handle<mirror::Class> h_Y( hs.NewHandle(class_linker_->FindClass(soa.Self(), descriptor_y, class_loader))); - ASSERT_TRUE(h_Y.Get() != nullptr); + ASSERT_TRUE(h_Y != nullptr); bool expect1 = Expect({ "PreDefine:LY; <art-gtest-XandY.jar>", "PreDefine:LX; <art-gtest-XandY.jar>", diff --git a/runtime/thread.cc b/runtime/thread.cc index 7b6540436a..f33da18e5f 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -874,7 +874,7 @@ void Thread::CreatePeer(const char* name, bool as_daemon, jobject thread_group) ScopedObjectAccess soa(self); StackHandleScope<1> hs(self); MutableHandle<mirror::String> peer_thread_name(hs.NewHandle(GetThreadName())); - if (peer_thread_name.Get() == nullptr) { + if (peer_thread_name == nullptr) { // The Thread constructor should have set the Thread.name to a // non-null value. However, because we can run without code // available (in the compiler, in tests), we manually assign the @@ -887,7 +887,7 @@ void Thread::CreatePeer(const char* name, bool as_daemon, jobject thread_group) peer_thread_name.Assign(GetThreadName()); } // 'thread_name' may have been null, so don't trust 'peer_thread_name' to be non-null. - if (peer_thread_name.Get() != nullptr) { + if (peer_thread_name != nullptr) { SetThreadName(peer_thread_name->ToModifiedUtf8().c_str()); } } @@ -2284,7 +2284,7 @@ class BuildInternalStackTraceVisitor : public StackVisitor { Handle<mirror::ObjectArray<mirror::Object>> trace( hs.NewHandle( mirror::ObjectArray<mirror::Object>::Alloc(hs.Self(), array_class, depth + 1))); - if (trace.Get() == nullptr) { + if (trace == nullptr) { // Acquire uninterruptible_ in all paths. self_->StartAssertNoThreadSuspension("Building internal stack trace"); self_->AssertPendingOOMException(); @@ -2479,14 +2479,14 @@ jobjectArray Thread::InternalStackTraceToStackTraceElementArray( std::string class_name(PrettyDescriptor(descriptor)); class_name_object.Assign( mirror::String::AllocFromModifiedUtf8(soa.Self(), class_name.c_str())); - if (class_name_object.Get() == nullptr) { + if (class_name_object == nullptr) { soa.Self()->AssertPendingOOMException(); return nullptr; } const char* source_file = method->GetDeclaringClassSourceFile(); if (source_file != nullptr) { source_name_object.Assign(mirror::String::AllocFromModifiedUtf8(soa.Self(), source_file)); - if (source_name_object.Get() == nullptr) { + if (source_name_object == nullptr) { soa.Self()->AssertPendingOOMException(); return nullptr; } @@ -2496,7 +2496,7 @@ jobjectArray Thread::InternalStackTraceToStackTraceElementArray( CHECK(method_name != nullptr); Handle<mirror::String> method_name_object( hs.NewHandle(mirror::String::AllocFromModifiedUtf8(soa.Self(), method_name))); - if (method_name_object.Get() == nullptr) { + if (method_name_object == nullptr) { return nullptr; } ObjPtr<mirror::StackTraceElement> obj =mirror::StackTraceElement::Alloc(soa.Self(), @@ -2554,7 +2554,7 @@ void Thread::ThrowNewWrappedException(const char* exception_class_descriptor, auto* cl = runtime->GetClassLinker(); Handle<mirror::Class> exception_class( hs.NewHandle(cl->FindClass(this, exception_class_descriptor, class_loader))); - if (UNLIKELY(exception_class.Get() == nullptr)) { + if (UNLIKELY(exception_class == nullptr)) { CHECK(IsExceptionPending()); LOG(ERROR) << "No exception class " << PrettyDescriptor(exception_class_descriptor); return; @@ -2570,7 +2570,7 @@ void Thread::ThrowNewWrappedException(const char* exception_class_descriptor, hs.NewHandle(ObjPtr<mirror::Throwable>::DownCast(exception_class->AllocObject(this)))); // If we couldn't allocate the exception, throw the pre-allocated out of memory exception. - if (exception.Get() == nullptr) { + if (exception == nullptr) { SetException(Runtime::Current()->GetPreAllocatedOutOfMemoryError()); return; } diff --git a/runtime/transaction_test.cc b/runtime/transaction_test.cc index a43c967092..97c1228038 100644 --- a/runtime/transaction_test.cc +++ b/runtime/transaction_test.cc @@ -35,7 +35,7 @@ class TransactionTest : public CommonRuntimeTest { StackHandleScope<2> hs(soa.Self()); Handle<mirror::ClassLoader> class_loader( hs.NewHandle(soa.Decode<mirror::ClassLoader>(jclass_loader))); - ASSERT_TRUE(class_loader.Get() != nullptr); + ASSERT_TRUE(class_loader != nullptr); // Load and initialize java.lang.ExceptionInInitializerError and the exception class used // to abort transaction so they can be thrown during class initialization if the transaction @@ -43,26 +43,26 @@ class TransactionTest : public CommonRuntimeTest { MutableHandle<mirror::Class> h_klass( hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "Ljava/lang/ExceptionInInitializerError;"))); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); class_linker_->EnsureInitialized(soa.Self(), h_klass, true, true); ASSERT_TRUE(h_klass->IsInitialized()); h_klass.Assign(class_linker_->FindSystemClass(soa.Self(), Transaction::kAbortExceptionSignature)); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); class_linker_->EnsureInitialized(soa.Self(), h_klass, true, true); ASSERT_TRUE(h_klass->IsInitialized()); // Load and verify utility class. h_klass.Assign(class_linker_->FindClass(soa.Self(), "LTransaction$AbortHelperClass;", class_loader)); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); class_linker_->VerifyClass(soa.Self(), h_klass); ASSERT_TRUE(h_klass->IsVerified()); // Load and verify tested class. h_klass.Assign(class_linker_->FindClass(soa.Self(), tested_class_signature, class_loader)); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); class_linker_->VerifyClass(soa.Self(), h_klass); ASSERT_TRUE(h_klass->IsVerified()); @@ -95,12 +95,12 @@ TEST_F(TransactionTest, Object_class) { StackHandleScope<2> hs(soa.Self()); Handle<mirror::Class> h_klass( hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "Ljava/lang/Object;"))); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); Transaction transaction; Runtime::Current()->EnterTransactionMode(&transaction); Handle<mirror::Object> h_obj(hs.NewHandle(h_klass->AllocObject(soa.Self()))); - ASSERT_TRUE(h_obj.Get() != nullptr); + ASSERT_TRUE(h_obj != nullptr); ASSERT_EQ(h_obj->GetClass(), h_klass.Get()); Runtime::Current()->ExitTransactionMode(); @@ -115,9 +115,9 @@ TEST_F(TransactionTest, Object_monitor) { StackHandleScope<2> hs(soa.Self()); Handle<mirror::Class> h_klass( hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "Ljava/lang/Object;"))); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); Handle<mirror::Object> h_obj(hs.NewHandle(h_klass->AllocObject(soa.Self()))); - ASSERT_TRUE(h_obj.Get() != nullptr); + ASSERT_TRUE(h_obj != nullptr); ASSERT_EQ(h_obj->GetClass(), h_klass.Get()); // Lock object's monitor outside the transaction. @@ -144,7 +144,7 @@ TEST_F(TransactionTest, Array_length) { StackHandleScope<2> hs(soa.Self()); Handle<mirror::Class> h_klass( hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[Ljava/lang/Object;"))); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); constexpr int32_t kArraySize = 2; @@ -157,7 +157,7 @@ TEST_F(TransactionTest, Array_length) { mirror::Array::Alloc<true>(soa.Self(), h_klass.Get(), kArraySize, h_klass->GetComponentSizeShift(), Runtime::Current()->GetHeap()->GetCurrentAllocator()))); - ASSERT_TRUE(h_obj.Get() != nullptr); + ASSERT_TRUE(h_obj != nullptr); ASSERT_EQ(h_obj->GetClass(), h_klass.Get()); Runtime::Current()->ExitTransactionMode(); @@ -172,11 +172,11 @@ TEST_F(TransactionTest, StaticFieldsTest) { StackHandleScope<4> hs(soa.Self()); Handle<mirror::ClassLoader> class_loader( hs.NewHandle(soa.Decode<mirror::ClassLoader>(LoadDex("Transaction")))); - ASSERT_TRUE(class_loader.Get() != nullptr); + ASSERT_TRUE(class_loader != nullptr); Handle<mirror::Class> h_klass( hs.NewHandle(class_linker_->FindClass(soa.Self(), "LStaticFieldsTest;", class_loader))); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); bool success = class_linker_->EnsureInitialized(soa.Self(), h_klass, true, true); ASSERT_TRUE(success); ASSERT_TRUE(h_klass->IsInitialized()); @@ -232,9 +232,9 @@ TEST_F(TransactionTest, StaticFieldsTest) { // Create a java.lang.Object instance to set objectField. Handle<mirror::Class> object_klass( hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "Ljava/lang/Object;"))); - ASSERT_TRUE(object_klass.Get() != nullptr); + ASSERT_TRUE(object_klass != nullptr); Handle<mirror::Object> h_obj(hs.NewHandle(h_klass->AllocObject(soa.Self()))); - ASSERT_TRUE(h_obj.Get() != nullptr); + ASSERT_TRUE(h_obj != nullptr); ASSERT_EQ(h_obj->GetClass(), h_klass.Get()); // Modify fields inside transaction then rollback changes. @@ -270,11 +270,11 @@ TEST_F(TransactionTest, InstanceFieldsTest) { StackHandleScope<5> hs(soa.Self()); Handle<mirror::ClassLoader> class_loader( hs.NewHandle(soa.Decode<mirror::ClassLoader>(LoadDex("Transaction")))); - ASSERT_TRUE(class_loader.Get() != nullptr); + ASSERT_TRUE(class_loader != nullptr); Handle<mirror::Class> h_klass( hs.NewHandle(class_linker_->FindClass(soa.Self(), "LInstanceFieldsTest;", class_loader))); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); bool success = class_linker_->EnsureInitialized(soa.Self(), h_klass, true, true); ASSERT_TRUE(success); ASSERT_TRUE(h_klass->IsInitialized()); @@ -282,7 +282,7 @@ TEST_F(TransactionTest, InstanceFieldsTest) { // Allocate an InstanceFieldTest object. Handle<mirror::Object> h_instance(hs.NewHandle(h_klass->AllocObject(soa.Self()))); - ASSERT_TRUE(h_instance.Get() != nullptr); + ASSERT_TRUE(h_instance != nullptr); // Lookup fields. ArtField* booleanField = h_klass->FindDeclaredInstanceField("booleanField", "Z"); @@ -334,9 +334,9 @@ TEST_F(TransactionTest, InstanceFieldsTest) { // Create a java.lang.Object instance to set objectField. Handle<mirror::Class> object_klass( hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "Ljava/lang/Object;"))); - ASSERT_TRUE(object_klass.Get() != nullptr); + ASSERT_TRUE(object_klass != nullptr); Handle<mirror::Object> h_obj(hs.NewHandle(h_klass->AllocObject(soa.Self()))); - ASSERT_TRUE(h_obj.Get() != nullptr); + ASSERT_TRUE(h_obj != nullptr); ASSERT_EQ(h_obj->GetClass(), h_klass.Get()); // Modify fields inside transaction then rollback changes. @@ -372,11 +372,11 @@ TEST_F(TransactionTest, StaticArrayFieldsTest) { StackHandleScope<4> hs(soa.Self()); Handle<mirror::ClassLoader> class_loader( hs.NewHandle(soa.Decode<mirror::ClassLoader>(LoadDex("Transaction")))); - ASSERT_TRUE(class_loader.Get() != nullptr); + ASSERT_TRUE(class_loader != nullptr); Handle<mirror::Class> h_klass( hs.NewHandle(class_linker_->FindClass(soa.Self(), "LStaticArrayFieldsTest;", class_loader))); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); bool success = class_linker_->EnsureInitialized(soa.Self(), h_klass, true, true); ASSERT_TRUE(success); ASSERT_TRUE(h_klass->IsInitialized()); @@ -451,9 +451,9 @@ TEST_F(TransactionTest, StaticArrayFieldsTest) { // Create a java.lang.Object instance to set objectField. Handle<mirror::Class> object_klass( hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "Ljava/lang/Object;"))); - ASSERT_TRUE(object_klass.Get() != nullptr); + ASSERT_TRUE(object_klass != nullptr); Handle<mirror::Object> h_obj(hs.NewHandle(h_klass->AllocObject(soa.Self()))); - ASSERT_TRUE(h_obj.Get() != nullptr); + ASSERT_TRUE(h_obj != nullptr); ASSERT_EQ(h_obj->GetClass(), h_klass.Get()); // Modify fields inside transaction then rollback changes. @@ -489,15 +489,15 @@ TEST_F(TransactionTest, ResolveString) { StackHandleScope<3> hs(soa.Self()); Handle<mirror::ClassLoader> class_loader( hs.NewHandle(soa.Decode<mirror::ClassLoader>(LoadDex("Transaction")))); - ASSERT_TRUE(class_loader.Get() != nullptr); + ASSERT_TRUE(class_loader != nullptr); Handle<mirror::Class> h_klass( hs.NewHandle(class_linker_->FindClass(soa.Self(), "LTransaction$ResolveString;", class_loader))); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); Handle<mirror::DexCache> h_dex_cache(hs.NewHandle(h_klass->GetDexCache())); - ASSERT_TRUE(h_dex_cache.Get() != nullptr); + ASSERT_TRUE(h_dex_cache != nullptr); const DexFile* const dex_file = h_dex_cache->GetDexFile(); ASSERT_TRUE(dex_file != nullptr); @@ -538,12 +538,12 @@ TEST_F(TransactionTest, EmptyClass) { StackHandleScope<2> hs(soa.Self()); Handle<mirror::ClassLoader> class_loader( hs.NewHandle(soa.Decode<mirror::ClassLoader>(LoadDex("Transaction")))); - ASSERT_TRUE(class_loader.Get() != nullptr); + ASSERT_TRUE(class_loader != nullptr); Handle<mirror::Class> h_klass( hs.NewHandle(class_linker_->FindClass(soa.Self(), "LTransaction$EmptyStatic;", class_loader))); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); class_linker_->VerifyClass(soa.Self(), h_klass); ASSERT_TRUE(h_klass->IsVerified()); @@ -562,12 +562,12 @@ TEST_F(TransactionTest, StaticFieldClass) { StackHandleScope<2> hs(soa.Self()); Handle<mirror::ClassLoader> class_loader( hs.NewHandle(soa.Decode<mirror::ClassLoader>(LoadDex("Transaction")))); - ASSERT_TRUE(class_loader.Get() != nullptr); + ASSERT_TRUE(class_loader != nullptr); Handle<mirror::Class> h_klass( hs.NewHandle(class_linker_->FindClass(soa.Self(), "LTransaction$StaticFieldClass;", class_loader))); - ASSERT_TRUE(h_klass.Get() != nullptr); + ASSERT_TRUE(h_klass != nullptr); class_linker_->VerifyClass(soa.Self(), h_klass); ASSERT_TRUE(h_klass->IsVerified()); diff --git a/runtime/verifier/verifier_deps.cc b/runtime/verifier/verifier_deps.cc index 113160785c..000cf7c393 100644 --- a/runtime/verifier/verifier_deps.cc +++ b/runtime/verifier/verifier_deps.cc @@ -890,12 +890,12 @@ bool VerifierDeps::VerifyAssignability(Handle<mirror::ClassLoader> class_loader, source.Assign( FindClassAndClearException(class_linker, self, source_desc.c_str(), class_loader)); - if (destination.Get() == nullptr) { + if (destination == nullptr) { LOG(INFO) << "VerifiersDeps: Could not resolve class " << destination_desc; return false; } - if (source.Get() == nullptr) { + if (source == nullptr) { LOG(INFO) << "VerifierDeps: Could not resolve class " << source_desc; return false; } @@ -925,7 +925,7 @@ bool VerifierDeps::VerifyClasses(Handle<mirror::ClassLoader> class_loader, cls.Assign(FindClassAndClearException(class_linker, self, descriptor, class_loader)); if (entry.IsResolved()) { - if (cls.Get() == nullptr) { + if (cls == nullptr) { LOG(INFO) << "VerifierDeps: Could not resolve class " << descriptor; return false; } else if (entry.GetAccessFlags() != GetAccessFlags(cls.Get())) { @@ -939,7 +939,7 @@ bool VerifierDeps::VerifyClasses(Handle<mirror::ClassLoader> class_loader, << std::dec; return false; } - } else if (cls.Get() != nullptr) { + } else if (cls != nullptr) { LOG(INFO) << "VerifierDeps: Unexpected successful resolution of class " << descriptor; return false; } diff --git a/test/626-const-class-linking/clear_dex_cache_types.cc b/test/626-const-class-linking/clear_dex_cache_types.cc index c0aedc199f..b35dff48ee 100644 --- a/test/626-const-class-linking/clear_dex_cache_types.cc +++ b/test/626-const-class-linking/clear_dex_cache_types.cc @@ -49,7 +49,7 @@ extern "C" JNIEXPORT void JNICALL Java_Main_nativeDumpClasses(JNIEnv*, jclass, j StackHandleScope<1> hs(soa.Self()); Handle<mirror::ObjectArray<mirror::Object>> classes = hs.NewHandle(soa.Decode<mirror::ObjectArray<mirror::Object>>(array)); - CHECK(classes.Get() != nullptr); + CHECK(classes != nullptr); for (size_t i = 0, length = classes->GetLength(); i != length; ++i) { CHECK(classes->Get(i) != nullptr) << i; CHECK(classes->Get(i)->IsClass()) |