< prev index next >
src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
Print this page
rev 17358 : 8182487: Add Unsafe.objectFieldOffset(Class, String)
Reviewed-by: dsimms
@@ -616,19 +616,15 @@
private static class UnsafeAccessor {
private static final jdk.internal.misc.Unsafe unsafe;
private static final long typeOffset;
private static final long memberValuesOffset;
static {
- try {
unsafe = jdk.internal.misc.Unsafe.getUnsafe();
typeOffset = unsafe.objectFieldOffset
- (AnnotationInvocationHandler.class.getDeclaredField("type"));
+ (AnnotationInvocationHandler.class, "type");
memberValuesOffset = unsafe.objectFieldOffset
- (AnnotationInvocationHandler.class.getDeclaredField("memberValues"));
- } catch (Exception ex) {
- throw new ExceptionInInitializerError(ex);
- }
+ (AnnotationInvocationHandler.class, "memberValues");
}
static void setType(AnnotationInvocationHandler o,
Class<? extends Annotation> type) {
unsafe.putObject(o, typeOffset, type);
}
< prev index next >