< prev index next >

src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java

Print this page

        

*** 34,44 **** super(field, isReadOnly); } public Object get(Object obj) throws IllegalArgumentException { ensureObj(obj); ! return unsafe.getReferenceVolatile(obj, fieldOffset); } public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } --- 34,45 ---- super(field, isReadOnly); } public Object get(Object obj) throws IllegalArgumentException { ensureObj(obj); ! return isFlattened() ? unsafe.getValue(obj, fieldOffset, field.getType()) ! : unsafe.getReferenceVolatile(obj, fieldOffset); } public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); }
*** 76,91 **** { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } ! if (value != null) { ! if (!field.getType().isAssignableFrom(value.getClass())) { ! throwSetIllegalArgumentException(value); ! } ! } unsafe.putReferenceVolatile(obj, fieldOffset, value); } public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { --- 77,92 ---- { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } ! checkValue(value); ! if (isFlattened()) { ! unsafe.putValue(obj, fieldOffset, field.getType(), value); ! } else { unsafe.putReferenceVolatile(obj, fieldOffset, value); + } } public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException {
< prev index next >