mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8374113: Taughtological if check in Reflection::array_set
Reviewed-by: fparain, liach
This commit is contained in:
parent
e6c3ebe27b
commit
551e656218
@ -270,17 +270,16 @@ void Reflection::array_set(jvalue* value, arrayOop a, int index, BasicType value
|
||||
if (!a->is_within_bounds(index)) {
|
||||
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
|
||||
}
|
||||
if (a->is_objArray()) {
|
||||
if (value_type == T_OBJECT) {
|
||||
oop obj = cast_to_oop(value->l);
|
||||
if (obj != nullptr) {
|
||||
Klass* element_klass = ObjArrayKlass::cast(a->klass())->element_klass();
|
||||
if (!obj->is_a(element_klass)) {
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "array element type mismatch");
|
||||
}
|
||||
if (value_type == T_OBJECT) {
|
||||
assert(a->is_objArray(), "just checking");
|
||||
oop obj = cast_to_oop(value->l);
|
||||
if (obj != nullptr) {
|
||||
Klass* element_klass = ObjArrayKlass::cast(a->klass())->element_klass();
|
||||
if (!obj->is_a(element_klass)) {
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "array element type mismatch");
|
||||
}
|
||||
objArrayOop(a)->obj_at_put(index, obj);
|
||||
}
|
||||
objArrayOop(a)->obj_at_put(index, obj);
|
||||
} else {
|
||||
assert(a->is_typeArray(), "just checking");
|
||||
BasicType array_type = TypeArrayKlass::cast(a->klass())->element_type();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user