< prev index next > src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
Print this page
*
* @see #getInt(Object, long)
*/
@Deprecated(since="18", forRemoval=true)
@ForceInline
+ @SuppressWarnings("preview")
public long objectFieldOffset(Field f) {
if (f == null) {
throw new NullPointerException();
}
Class<?> declaringClass = f.getDeclaringClass();
throw new UnsupportedOperationException("can't get field offset on a hidden class: " + f);
}
if (declaringClass.isRecord()) {
throw new UnsupportedOperationException("can't get field offset on a record class: " + f);
}
+ if (declaringClass.isValue()) {
+ throw new UnsupportedOperationException("can't get field offset on a value class: " + f);
+ }
beforeMemoryAccess();
return theInternalUnsafe.objectFieldOffset(f);
}
/**
*
* @see #getInt(Object, long)
*/
@Deprecated(since="18", forRemoval=true)
@ForceInline
+ @SuppressWarnings("preview")
public long staticFieldOffset(Field f) {
if (f == null) {
throw new NullPointerException();
}
Class<?> declaringClass = f.getDeclaringClass();
throw new UnsupportedOperationException("can't get field offset on a hidden class: " + f);
}
if (declaringClass.isRecord()) {
throw new UnsupportedOperationException("can't get field offset on a record class: " + f);
}
+ if (declaringClass.isValue()) {
+ throw new UnsupportedOperationException("can't get field offset on a value class: " + f);
+ }
beforeMemoryAccess();
return theInternalUnsafe.staticFieldOffset(f);
}
/**
* offset and object reference to a heap memory accessor will be removed
* in a future release. Use {@link VarHandle} instead.
*/
@Deprecated(since="18", forRemoval=true)
@ForceInline
+ @SuppressWarnings("preview")
public Object staticFieldBase(Field f) {
if (f == null) {
throw new NullPointerException();
}
Class<?> declaringClass = f.getDeclaringClass();
throw new UnsupportedOperationException("can't get base address on a hidden class: " + f);
}
if (declaringClass.isRecord()) {
throw new UnsupportedOperationException("can't get base address on a record class: " + f);
}
+ if (declaringClass.isValue()) {
+ throw new UnsupportedOperationException("can't get field offset on a value class: " + f);
+ }
beforeMemoryAccess();
return theInternalUnsafe.staticFieldBase(f);
}
/**
< prev index next >