An incompatible field type assignment is always an error.
Either make it conditional type check for unresolved types, or a fatal
error.
Test: test.py
Bug: 28313047
Change-Id: Iec06306d6d2c89bc6c871b03e1469de0cf2b8ebb
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index e577226..95dd8e1 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -4758,11 +4758,12 @@
VerifyPrimitivePut(*field_type, insn_type, vregA);
} else {
if (!insn_type.IsAssignableFrom(*field_type, this)) {
- // If the field type is not a reference, this is a global failure rather than
- // a class change failure as the instructions and the descriptors for the type
- // should have been consistent within the same file at compile time.
- VerifyError error = field_type->IsReferenceTypes() ? VERIFY_ERROR_BAD_CLASS_SOFT
- : VERIFY_ERROR_BAD_CLASS_HARD;
+ VerifyError error;
+ if (insn_type.IsUnresolvedTypes() || field_type->IsUnresolvedTypes()) {
+ error = VERIFY_ERROR_UNRESOLVED_TYPE_CHECK;
+ } else {
+ error = VERIFY_ERROR_BAD_CLASS_HARD;
+ }
Fail(error) << "expected field " << ArtField::PrettyField(field)
<< " to be compatible with type '" << insn_type
<< "' but found type '" << *field_type
@@ -4790,11 +4791,12 @@
}
} else {
if (!insn_type.IsAssignableFrom(*field_type, this)) {
- // If the field type is not a reference, this is a global failure rather than
- // a class change failure as the instructions and the descriptors for the type
- // should have been consistent within the same file at compile time.
- VerifyError error = field_type->IsReferenceTypes() ? VERIFY_ERROR_BAD_CLASS_SOFT
- : VERIFY_ERROR_BAD_CLASS_HARD;
+ VerifyError error;
+ if (insn_type.IsUnresolvedTypes() || field_type->IsUnresolvedTypes()) {
+ error = VERIFY_ERROR_UNRESOLVED_TYPE_CHECK;
+ } else {
+ error = VERIFY_ERROR_BAD_CLASS_HARD;
+ }
Fail(error) << "expected field " << ArtField::PrettyField(field)
<< " to be compatible with type '" << insn_type
<< "' but found type '" << *field_type