ART: Add operator == and != with nullptr to Handle
Get it in line with ObjPtr and prettify our code.
Test: m
Change-Id: I1322e2a9bc7a85d7f2441034a19bf4d807b81a0e
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 7af850a..f7bea32 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -960,7 +960,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 c72edb1..26f3ecd 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -1078,7 +1078,7 @@
}
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 d68aa51..bac16cd 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -1419,7 +1419,7 @@
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 f0afccb..f1e8239 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -380,7 +380,7 @@
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 a1c391f..3374e42 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -680,7 +680,7 @@
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 @@
// 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 @@
// 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 @@
}
// 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 @@
}
bool HInstructionBuilder::IsInitialized(Handle<mirror::Class> cls) const {
- if (cls.Get() == nullptr) {
+ if (cls == nullptr) {
return false;
}
@@ -1292,7 +1292,7 @@
// 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 @@
}
// Check access.
- if (compiling_class.Get() == nullptr) {
+ if (compiling_class == nullptr) {
if (!resolved_field->IsPublic()) {
return nullptr;
}
@@ -1612,7 +1612,7 @@
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 @@
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 @@
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 727ca7d..8638e34 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -1214,7 +1214,7 @@
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 f07f02a..be40092 100644
--- a/compiler/optimizing/sharpening.cc
+++ b/compiler/optimizing/sharpening.cc
@@ -163,7 +163,7 @@
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 @@
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 @@
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 5fc9972..c892b25 100644
--- a/compiler/verifier_deps_test.cc
+++ b/compiler/verifier_deps_test.cc
@@ -233,7 +233,7 @@
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 ce63e18..9a3b28b 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -1473,7 +1473,7 @@
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 @@
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 0bf08a6..207bf9d 100644
--- a/runtime/arch/stub_test.cc
+++ b/runtime/arch/stub_test.cc
@@ -984,7 +984,7 @@
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 @@
// 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 4902ad4..6b52959 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -274,7 +274,7 @@
*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 @@
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 7db8368..091ea14 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -405,7 +405,7 @@
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 @@
// 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 @@
// 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 @@
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 @@
"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 @@
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 @@
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 @@
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 @@
}
}
- 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
// 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 @@
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 @@
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 @@
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 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
<< "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 @@
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 @@
}
// 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 @@
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 @@
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 @@
// 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 @@
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::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 @@
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::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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 03105cb..e94dae6 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -185,7 +185,7 @@
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 @@
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 @@
// 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 @@
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 @@
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 f1248eb..18c2b82 100644
--- a/runtime/class_table_test.cc
+++ b/runtime/class_table_test.cc
@@ -80,7 +80,7 @@
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 1a0cec0..cfdc6e1 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -1765,13 +1765,13 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 16a447b..a95f94c 100644
--- a/runtime/dex_file_annotations.cc
+++ b/runtime/dex_file_annotations.cc
@@ -252,7 +252,7 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
"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 @@
"accessFlags",
int_array_class,
DexFile::kDexAnnotationArray));
- if (access_flags_obj.Get() == nullptr) {
+ if (access_flags_obj == nullptr) {
return false;
}
@@ -1146,7 +1146,7 @@
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 fb8139b..6301362 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 4544aef..822c5a8 100644
--- a/runtime/entrypoints/quick/quick_field_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_field_entrypoints.cc
@@ -48,7 +48,7 @@
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 3ca3353..613b034 100644
--- a/runtime/gc/reference_queue_test.cc
+++ b/runtime/gc/reference_queue_test.cc
@@ -38,11 +38,11 @@
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 @@
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 7bc4dc4..ca5f306 100644
--- a/runtime/gc/space/space_create_test.cc
+++ b/runtime/gc/space/space_create_test.cc
@@ -108,7 +108,7 @@
&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 @@
&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 @@
&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 @@
&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 @@
&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 @@
&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 @@
&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 @@
&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 cbb3d73..1fe3fb2 100644
--- a/runtime/gc/space/space_test.h
+++ b/runtime/gc/space/space_test.h
@@ -200,7 +200,7 @@
}
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 @@
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 e4b6d29..ccff575 100644
--- a/runtime/handle.h
+++ b/runtime/handle.h
@@ -81,6 +81,14 @@
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 8cbe291..17149df 100644
--- a/runtime/imtable_test.cc
+++ b/runtime/imtable_test.cc
@@ -53,7 +53,7 @@
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 @@
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 bf4cab2..6aefe23 100644
--- a/runtime/indirect_reference_table_test.cc
+++ b/runtime/indirect_reference_table_test.cc
@@ -64,13 +64,13 @@
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 @@
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 @@
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 3991d65..f0d0260 100644
--- a/runtime/intern_table_test.cc
+++ b/runtime/intern_table_test.cc
@@ -36,10 +36,10 @@
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 @@
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 28bcb97..d7bfda8 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -542,7 +542,7 @@
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 @@
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 545cc1a..c7e8442 100644
--- a/runtime/interpreter/unstarted_runtime.cc
+++ b/runtime/interpreter/unstarted_runtime.cc
@@ -124,7 +124,7 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 31be587..16b7b55 100644
--- a/runtime/interpreter/unstarted_runtime_test.cc
+++ b/runtime/interpreter/unstarted_runtime_test.cc
@@ -960,7 +960,7 @@
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 @@
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 4615574..bd7251b 100644
--- a/runtime/jdwp/object_registry.cc
+++ b/runtime/jdwp/object_registry.cc
@@ -57,7 +57,7 @@
// 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 @@
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 3c641b0..547b5b8 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -196,7 +196,7 @@
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 443f095..4c45e38 100644
--- a/runtime/jobject_comparator.cc
+++ b/runtime/jobject_comparator.cc
@@ -34,9 +34,9 @@
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 99886e5..834abbb 100644
--- a/runtime/method_handles.cc
+++ b/runtime/method_handles.cc
@@ -220,7 +220,7 @@
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 @@
// 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 cc548b9..f283ec3 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -52,7 +52,7 @@
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 @@
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 1b8f3f8..9a9a5d8 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -81,7 +81,7 @@
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 @@
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 @@
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 @@
} 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::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 @@
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 efd949e..7270079 100644
--- a/runtime/mirror/class_ext.cc
+++ b/runtime/mirror/class_ext.cc
@@ -58,8 +58,8 @@
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 8f978e1..5a2ab71 100644
--- a/runtime/mirror/dex_cache_test.cc
+++ b/runtime/mirror/dex_cache_test.cc
@@ -47,7 +47,7 @@
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 @@
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 978cc32..be0eac0 100644
--- a/runtime/mirror/emulated_stack_frame.cc
+++ b/runtime/mirror/emulated_stack_frame.cc
@@ -173,13 +173,13 @@
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 c03f20a..2496989 100644
--- a/runtime/mirror/field-inl.h
+++ b/runtime/mirror/field-inl.h
@@ -33,7 +33,7 @@
// 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 @@
}
}
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 637bafd..41231ef 100644
--- a/runtime/mirror/method_type_test.cc
+++ b/runtime/mirror/method_type_test.cc
@@ -51,7 +51,7 @@
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 6a4ec9d..e761e4d 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -530,8 +530,8 @@
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 @@
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 @@
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 4fbfe47..27ce149 100644
--- a/runtime/monitor_test.cc
+++ b/runtime/monitor_test.cc
@@ -77,7 +77,7 @@
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 @@
// 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 24308d9..6bfccdc 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -350,7 +350,7 @@
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 @@
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 5438a6d..256787b 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -81,7 +81,7 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
}
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 @@
// 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 @@
}
}
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 72a37f8..9113841 100644
--- a/runtime/native/java_lang_invoke_MethodHandleImpl.cc
+++ b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
@@ -57,7 +57,7 @@
}
}
- 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 ee59c4a..2a39428 100644
--- a/runtime/native/java_lang_reflect_Executable.cc
+++ b/runtime/native/java_lang_reflect_Executable.cc
@@ -103,7 +103,7 @@
}
// 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 @@
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 @@
// 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 2590452..e51b6d2 100644
--- a/runtime/native/libcore_util_CharsetUtils.cc
+++ b/runtime/native/libcore_util_CharsetUtils.cc
@@ -155,7 +155,7 @@
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 @@
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 6cfe3d1..9b35489 100644
--- a/runtime/oat_file_assistant_test.cc
+++ b/runtime/oat_file_assistant_test.cc
@@ -1059,7 +1059,7 @@
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 a46b470..7079614 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -342,7 +342,7 @@
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 @@
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 @@
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 39ab52f..f6db544 100644
--- a/runtime/object_lock.cc
+++ b/runtime/object_lock.cc
@@ -24,7 +24,7 @@
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 @@
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 afec0bf..d05f579 100644
--- a/runtime/openjdkjvmti/ti_class_loader.cc
+++ b/runtime/openjdkjvmti/ti_class_loader.cc
@@ -119,11 +119,11 @@
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 @@
// 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 843fd8c..310fc8e 100644
--- a/runtime/openjdkjvmti/ti_redefine.cc
+++ b/runtime/openjdkjvmti/ti_redefine.cc
@@ -939,7 +939,7 @@
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 @@
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 e63ce65..1423874 100644
--- a/runtime/openjdkjvmti/ti_threadgroup.cc
+++ b/runtime/openjdkjvmti/ti_threadgroup.cc
@@ -155,7 +155,7 @@
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 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 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 1292a81..5748475 100644
--- a/runtime/proxy_test.cc
+++ b/runtime/proxy_test.cc
@@ -114,8 +114,8 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 9523e92..4ccfb6d 100644
--- a/runtime/reference_table_test.cc
+++ b/runtime/reference_table_test.cc
@@ -48,12 +48,12 @@
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 a2b4cb3..3c64d40 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -231,8 +231,8 @@
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 @@
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 @@
}
#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 f1e78b4..abe99e0 100644
--- a/runtime/runtime_callbacks_test.cc
+++ b/runtime/runtime_callbacks_test.cc
@@ -294,7 +294,7 @@
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 7b65404..f33da18 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -874,7 +874,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 a43c967..97c1228 100644
--- a/runtime/transaction_test.cc
+++ b/runtime/transaction_test.cc
@@ -35,7 +35,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
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 @@
// 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 @@
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 @@
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 @@
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 1131607..000cf7c 100644
--- a/runtime/verifier/verifier_deps.cc
+++ b/runtime/verifier/verifier_deps.cc
@@ -890,12 +890,12 @@
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 @@
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 @@
<< 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 c0aedc1..b35dff4 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 @@
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())