Buggy code:
public final class ClassStreamHandler { private static Unsafe unsafe ; @ SuppressWarnings ( "unchecked" ) private static final ReflectionFactory reflFactory = ( ( ReflectionFactory ) ( AccessController . doPrivileged ( new ReflectionFactory . GetReflectionFactoryAction ( ) ) ) ) ; private static Map < Object , ClassStreamHandler > handlesClasses = Generics . newHashMap ( ) ; private static short classCounter = 0 ; public static final byte HANDLE = 1 ; public static final byte NULL = 0 ; public static final byte CLASS_DEF = 2 ; public static final byte ARRAY = 3 ; public static final byte PRIMITIVE_ARRAY = 4 ; public static final int CLASS = 5 ; static ClassStreamHandler lookup ( Class < ? > cls ) throws NotSerializableException { } static ClassStreamHandler lookup ( short s ) { } private final Class < ? > clz ; private final List < ClassStreamHandler . FieldAndIndex > fields ; private final short classId ; private final Constructor < ? > cons ; private final Method writeReplaceMethod ; private final Method readResolveMethod ; private final List < Method > writeObjectMethods ; private final List < Method > readObjectMethods ; private final ClassStreamHandler . PrimitiveArray primitiveArray ; private ClassStreamHandler ( Class < ? > cls ) throws WicketSerializeableException { } public Class < ? > getStreamClass ( ) { } public short getClassId ( ) { } public Object createObject ( ) throws IllegalAccessException , IllegalArgumentException , InstantiationException , InvocationTargetException { } private void fillFields ( Class < ? > cls ) { if ( cls == null ) { return ; } Field [ ] fields = cls . getDeclaredFields ( ) ; for ( int i = 0 ; i < ( fields . length ) ; i ++ ) { Field field = fields [ i ] ; field . setAccessible ( true ) ; if ( ( ! ( Modifier . isStatic ( field . getModifiers ( ) ) ) ) && ( ! ( Modifier . isTransient ( field . getModifiers ( ) ) ) ) ) { ClassStreamHandler . FieldAndIndex fai = null ; Class < ? > clz = field . getType ( ) ; <START_BUG> long offset = ClassStreamHandler . unsafe . objectFieldOffset ( field ) ; <END_BUG> if ( clz == ( boolean . class ) ) { fai = new ClassStreamHandler . BooleanFieldAndIndex ( field ) ; } else if ( clz == ( byte . class ) ) { fai = new ClassStreamHandler . ByteFieldAndIndex ( field ) ; } else if ( clz == ( short . class ) ) { fai = new ClassStreamHandler . ShortFieldAndIndex ( field ) ; } else if ( clz == ( char . class ) ) { fai = new ClassStreamHandler . CharFieldAndIndex ( field ) ; } else if ( clz == ( int . class ) ) { fai = new ClassStreamHandler . IntFieldAndIndex ( field ) ; } else if ( clz == ( long . class ) ) { fai = new ClassStreamHandler . LongFieldAndIndex ( field ) ; } else if ( clz == ( float . class ) ) { fai = new ClassStreamHandler . FloatFieldAndIndex ( field ) ; } else if ( clz == ( double . class ) ) { fai = new ClassStreamHandler . DoubleFieldAndIndex ( field ) ; } else { fai = new ClassStreamHandler . ObjectFieldAndIndex ( field ) ; } this . fields . add ( fai ) ; } } cls = cls . getSuperclass ( ) ; if ( cls != ( Object . class ) ) { fillFields ( cls ) ; } return ; } public void writeFields ( WicketObjectOutputStream woos , Object obj ) throws WicketSerializeableException { } public void readFields ( WicketObjectInputStream wois , Object object ) throws WicketSerializeableException { } public void writeArray ( Object obj , WicketObjectOutputStream wois ) throws IOException { } public Object readArray ( WicketObjectInputStream wois ) throws IOException { } public boolean invokeWriteMethod ( WicketObjectOutputStream woos , Object obj ) { } public boolean invokeReadMethod ( WicketObjectInputStream wois , Object obj ) { } @ SuppressWarnings ( { "unchecked" } ) private static < T > Constructor < ? super T > getSerializableConstructor ( Class < T > cl ) { } private static Method getPrivateMethod ( Class < ? > cl , String name , Class < ? > [ ] argTypes , Class < ? > returnType ) { } private static Method getInheritableMethod ( Class < ? > cl , String name , Class < ? > [ ] argTypes , Class < ? > returnType ) { } private static boolean packageEquals ( Class < ? > cl1 , Class < ? > cl2 ) { } private static String getPackageName ( Class < ? > cl ) { } private abstract class FieldAndIndex { final Field field ; final long index ; FieldAndIndex ( Field field ) { } public abstract void writeField ( Object object , WicketObjectOutputStream dos ) throws IOException { } public abstract void readField ( Object object , WicketObjectInputStream dos ) throws IOException , ClassNotFoundException { } } private final class BooleanFieldAndIndex extends ClassStreamHandler . FieldAndIndex { BooleanFieldAndIndex ( Field field ) { } @ Override public void writeField ( Object object , WicketObjectOutputStream dos ) throws IOException { } @ Override public void readField ( Object object , WicketObjectInputStream dos ) throws IOException { } } private final class ByteFieldAndIndex extends ClassStreamHandler . FieldAndIndex { ByteFieldAndIndex ( Field field ) { } @ Override public void writeField ( Object object , WicketObjectOutputStream dos ) throws IOException { } @ Override public void readField ( Object object , WicketObjectInputStream dos ) throws IOException { } } private final class ShortFieldAndIndex extends ClassStreamHandler . FieldAndIndex { ShortFieldAndIndex ( Field field ) { } @ Override public void writeField ( Object object , WicketObjectOutputStream dos ) throws IOException { }

Fix:
ClassStreamHandler . unsafe . objectFieldOffset ( field ) ;