ART: Fix re-throwing failures of non-convention errors
While it is convention that Throwable subclasses should have a
constructor with a String argument, that is not rigorously enforced.
So if a static initializer throws an error that omits that
constructor, we must not provide a message when trying to throw
again.
Bug: 20495321
Bug: 20497840
Change-Id: Ia4334fa24223750f90a8f2732f1eb1e738575e8d
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 8e27413..1bd9f0a 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -657,6 +657,12 @@
// Return the quick generic JNI stub for testing.
const void* GetRuntimeQuickGenericJniStub() const;
+ // Throw the class initialization failure recorded when first trying to initialize the given
+ // class.
+ // Note: Currently we only store the descriptor, so we cannot throw the exact throwable, only
+ // a recreation with a custom string.
+ void ThrowEarlierClassFailure(mirror::Class* c) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
std::vector<const DexFile*> boot_class_path_;
std::vector<std::unique_ptr<const DexFile>> opened_dex_files_;