Merge "Add unimplemented artResolveMethodFromCode" into dalvik-dev
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 1c9f064..17f80d4 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -2326,6 +2326,14 @@
DCHECK(Thread::Current()->IsExceptionPending());
return false;
}
+ // Verify
+ if (!klass->CanAccess(super_class)) {
+ Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalAccessError;",
+ "Class %s extended by class %s is inaccessible",
+ PrettyDescriptor(super_class).c_str(),
+ PrettyDescriptor(klass.get()).c_str());
+ return false;
+ }
klass->SetSuperClass(super_class);
}
const DexFile::TypeList* interfaces = dex_file.GetInterfacesList(*class_def);
diff --git a/src/dex2oat.cc b/src/dex2oat.cc
index 41adc74..24058ec 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -527,7 +527,7 @@
oat_file.reset(OS::FileFromFd(oat_name.c_str(), oat_fd));
}
if (oat_file.get() == NULL) {
- PLOG(ERROR) << "Unable to create oat file " << oat_name;
+ PLOG(ERROR) << "Unable to create oat file: " << oat_name;
return EXIT_FAILURE;
}
@@ -578,7 +578,7 @@
}
const DexFile* dex_file = DexFile::Open(*zip_archive.get(), zip_name);
if (dex_file == NULL) {
- LOG(ERROR) << "Failed to open dex from file descriptor for zip file " << zip_name;
+ LOG(ERROR) << "Failed to open dex from file descriptor for zip file: " << zip_name;
return EXIT_FAILURE;
}
dex_files.push_back(dex_file);
@@ -592,12 +592,12 @@
oat_file.get(),
image,
image_classes.get())) {
- LOG(ERROR) << "Failed to create oat file" << oat_name;
+ LOG(ERROR) << "Failed to create oat file: " << oat_name;
return EXIT_FAILURE;
}
if (!image) {
- LOG(INFO) << "Oat file written successfully " << oat_filename;
+ LOG(INFO) << "Oat file written successfully: " << oat_name;
return EXIT_SUCCESS;
}
diff --git a/src/java_lang_VMClassLoader.cc b/src/java_lang_VMClassLoader.cc
index 28421b4..9d2e2a8 100644
--- a/src/java_lang_VMClassLoader.cc
+++ b/src/java_lang_VMClassLoader.cc
@@ -34,7 +34,13 @@
std::string descriptor(DotToDescriptor(name.c_str()));
Class* c = Runtime::Current()->GetClassLinker()->LookupClass(descriptor.c_str(), loader);
- return AddLocalReference<jclass>(env, c);
+ if (c != NULL && c->IsResolved()) {
+ return AddLocalReference<jclass>(env, c);
+ } else {
+ // Class wasn't resolved so it may be erroneous or not yet ready, force the caller to go into
+ // the regular loadClass code.
+ return NULL;
+ }
}
jint VMClassLoader_getBootClassPathSize(JNIEnv* env, jclass) {