Verifier treats unresolved return types as a soft error.
It's ok for the type of a returned register to be an unresolved class,
even if the return type derived from the descriptor is resolved, when
the descriptor type is a super and the register type is a sub. It's
also ok for both types to be resolved, but it's not ok for the derived
return type to be unresolved while the register's type is resolved.
Change-Id: If0ac5ba33ccef61e754382b7d9918deac7f05448
diff --git a/src/verifier/method_verifier.cc b/src/verifier/method_verifier.cc
index 78bc2e9..3e3808f 100644
--- a/src/verifier/method_verifier.cc
+++ b/src/verifier/method_verifier.cc
@@ -1439,8 +1439,8 @@
if (reg_type.IsUninitializedTypes()) {
Fail(VERIFY_ERROR_BAD_CLASS_SOFT) << "returning uninitialized object '" << reg_type << "'";
} else if (!return_type.IsAssignableFrom(reg_type)) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "returning '" << reg_type
- << "', but expected from declaration '" << return_type << "'";
+ Fail(reg_type.IsUnresolvedTypes() ? VERIFY_ERROR_BAD_CLASS_SOFT : VERIFY_ERROR_BAD_CLASS_HARD)
+ << "returning '" << reg_type << "', but expected from declaration '" << return_type << "'";
}
}
}