verifier: the throw bytecode must have a throwable class as input.
Otherwise it's a hard failure.
Remove soft failure test as soft failures are going away.
Test: test.py
Bug: 28313047
Change-Id: Ifb49b9d966dc2eff5b1f8eb7ade15d402f6ef5f1
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index cc29b0f..06b3626 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -1387,29 +1387,6 @@
EXPECT_EQ(0, res_no_fail);
}
-TEST_F(Dex2oatVerifierAbort, SoftFail) {
- // Use VerifierDepsMulti as it has soft-failing classes.
- std::unique_ptr<const DexFile> dex(OpenTestDexFile("VerifierDepsMulti"));
- std::string out_dir = GetScratchDir();
- const std::string base_oat_name = out_dir + "/base.oat";
- std::string error_msg;
- const int res_fail = GenerateOdexForTestWithStatus(
- {dex->GetLocation()},
- base_oat_name,
- CompilerFilter::Filter::kVerify,
- &error_msg,
- {"--abort-on-soft-verifier-error"});
- EXPECT_NE(0, res_fail);
-
- const int res_no_fail = GenerateOdexForTestWithStatus(
- {dex->GetLocation()},
- base_oat_name,
- CompilerFilter::Filter::kVerify,
- &error_msg,
- {"--no-abort-on-soft-verifier-error"});
- EXPECT_EQ(0, res_no_fail);
-}
-
class Dex2oatDedupeCode : public Dex2oatTest {};
TEST_F(Dex2oatDedupeCode, DedupeTest) {
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index b941611..72be777 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -2527,7 +2527,7 @@
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "thrown value of non-reference type " << res_type;
} else {
Fail(res_type.IsUnresolvedTypes()
- ? VERIFY_ERROR_UNRESOLVED_TYPE_CHECK : VERIFY_ERROR_BAD_CLASS_SOFT)
+ ? VERIFY_ERROR_UNRESOLVED_TYPE_CHECK : VERIFY_ERROR_BAD_CLASS_HARD)
<< "thrown class " << res_type << " not instanceof Throwable";
}
}