< prev index next >
src/java.base/share/classes/java/lang/reflect/Field.java
Print this page
rev 55117 : 8223350: [lworld] Use inline classes instead of value classes
*** 166,181 ****
@Override
@CallerSensitive
public void setAccessible(boolean flag) {
AccessibleObject.checkPermission();
- if (flag) {
if (clazz.isValue()) {
! throw new InaccessibleObjectException(
! "Unable to make a value class field \"" + this + "\" accessible");
}
!
checkCanSetAccessible(Reflection.getCallerClass());
}
setAccessible0(flag);
}
--- 166,180 ----
@Override
@CallerSensitive
public void setAccessible(boolean flag) {
AccessibleObject.checkPermission();
if (clazz.isValue()) {
! throw new InaccessibleObjectException("cannot make a field accessible of inline class "
! + clazz.getName());
}
! if (flag) {
checkCanSetAccessible(Reflection.getCallerClass());
}
setAccessible0(flag);
}
*** 1103,1117 ****
Modifier.isStatic(modifiers) ? null : obj.getClass(),
modifiers);
}
/*
! * Ensure the declaring class is not a value class.
*/
private void ensureNotValueClass() throws IllegalAccessException {
if (clazz.isValue()) {
! throw new IllegalAccessException("cannot set this field of a value class "
+ clazz.getName());
}
}
// security check is done before calling this method
--- 1102,1116 ----
Modifier.isStatic(modifiers) ? null : obj.getClass(),
modifiers);
}
/*
! * Ensure the declaring class is not an inline class.
*/
private void ensureNotValueClass() throws IllegalAccessException {
if (clazz.isValue()) {
! throw new IllegalAccessException("cannot set field \"" + this + "\" of inline class "
+ clazz.getName());
}
}
// security check is done before calling this method
< prev index next >