Bugfix: Java char is 16 bits, can not be treated as boolean.
Using SetFieldBooleanVolatile() and SetFieldBoolean() happens to work
for char values that only use the lower 8 bits, but is a mistake that
was introduced by the "Add AccessibleObject and Field to mirror" commit:
https://android.googlesource.com/platform/art/+/daaf326
Change-Id: Iec02ba3084c992ea239ecef688d7d29c7e21ae16
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index 01faf3c..5bbb0dc 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -253,9 +253,9 @@
break;
case Primitive::kPrimChar:
if (is_volatile) {
- o->SetFieldBooleanVolatile<false>(offset, new_value.GetC());
+ o->SetFieldCharVolatile<false>(offset, new_value.GetC());
} else {
- o->SetFieldBoolean<false>(offset, new_value.GetC());
+ o->SetFieldChar<false>(offset, new_value.GetC());
}
break;
case Primitive::kPrimInt: