Fix Class::IsInSamePackage
Change-Id: Ibb7a44ba58777829ec6cc4d9c3f364eb03b719be
diff --git a/src/mirror/class.cc b/src/mirror/class.cc
index 8fac609..ba3556e 100644
--- a/src/mirror/class.cc
+++ b/src/mirror/class.cc
@@ -272,21 +272,20 @@
// Compare the package part of the descriptor string.
if (LIKELY(!klass1->IsProxyClass() && !klass2->IsProxyClass())) {
ClassHelper kh(klass1);
- const DexFile* dex_file = &kh.GetDexFile();
- const DexFile::TypeId* type_id = &dex_file->GetTypeId(klass1->GetDexTypeIndex());
- const char* descriptor1 = dex_file->GetTypeDescriptor(*type_id);
+ const DexFile* dex_file1 = &kh.GetDexFile();
+ const DexFile::TypeId* type_id1 = &dex_file1->GetTypeId(klass1->GetDexTypeIndex());
+ const char* descriptor1 = dex_file1->GetTypeDescriptor(*type_id1);
kh.ChangeClass(klass2);
- dex_file = &kh.GetDexFile();
- type_id = &dex_file->GetTypeId(klass1->GetDexTypeIndex());
- const char* descriptor2 = dex_file->GetTypeDescriptor(*type_id);
- return IsInSamePackage(descriptor1, descriptor2);
- } else {
- ClassHelper kh(klass1);
- std::string descriptor1(kh.GetDescriptor());
- kh.ChangeClass(klass2);
- std::string descriptor2(kh.GetDescriptor());
+ const DexFile* dex_file2 = &kh.GetDexFile();
+ const DexFile::TypeId* type_id2 = &dex_file2->GetTypeId(klass2->GetDexTypeIndex());
+ const char* descriptor2 = dex_file2->GetTypeDescriptor(*type_id2);
return IsInSamePackage(descriptor1, descriptor2);
}
+ ClassHelper kh(klass1);
+ std::string descriptor1(kh.GetDescriptor());
+ kh.ChangeClass(klass2);
+ std::string descriptor2(kh.GetDescriptor());
+ return IsInSamePackage(descriptor1, descriptor2);
}
bool Class::IsClassClass() const {