< prev index next >

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

Print this page

        

*** 31,41 **** UnsafeStaticObjectFieldAccessorImpl(Field field) { super(field); } public Object get(Object obj) throws IllegalArgumentException { ! return unsafe.getReference(base, fieldOffset); } public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } --- 31,42 ---- UnsafeStaticObjectFieldAccessorImpl(Field field) { super(field); } public Object get(Object obj) throws IllegalArgumentException { ! return isFlattened() ? unsafe.getValue(base, fieldOffset, field.getType()) ! : unsafe.getReference(base, fieldOffset); } public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); }
*** 72,87 **** throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } ! if (value != null) { ! if (!field.getType().isAssignableFrom(value.getClass())) { ! throwSetIllegalArgumentException(value); ! } ! } unsafe.putReference(base, fieldOffset, value); } public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { --- 73,88 ---- throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } ! checkValue(value); ! if (isFlattened()) { ! unsafe.putValue(obj, fieldOffset, field.getType(), value); ! } else { unsafe.putReference(base, fieldOffset, value); + } } public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException {
< prev index next >