src/share/classes/java/io/ObjectStreamClass.java

Print this page

        

*** 142,152 **** private FieldReflector fieldRefl; /** data layout of serialized objects described by this class desc */ private volatile ClassDataSlot[] dataLayout; /** serialization-appropriate constructor, or null if none */ ! private Constructor cons; /** class-defined writeObject method, or null if none */ private Method writeObjectMethod; /** class-defined readObject method, or null if none */ private Method readObjectMethod; /** class-defined readObjectNoData method, or null if none */ --- 142,152 ---- private FieldReflector fieldRefl; /** data layout of serialized objects described by this class desc */ private volatile ClassDataSlot[] dataLayout; /** serialization-appropriate constructor, or null if none */ ! private Constructor<?> cons; /** class-defined writeObject method, or null if none */ private Method writeObjectMethod; /** class-defined readObject method, or null if none */ private Method readObjectMethod; /** class-defined readObjectNoData method, or null if none */
*** 1306,1318 **** /** * Returns public no-arg constructor of given class, or null if none found. * Access checks are disabled on the returned constructor (if any), since * the defining class may still be non-public. */ ! private static Constructor getExternalizableConstructor(Class<?> cl) { try { ! Constructor cons = cl.getDeclaredConstructor((Class<?>[]) null); cons.setAccessible(true); return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ? cons : null; } catch (NoSuchMethodException ex) { return null; --- 1306,1318 ---- /** * Returns public no-arg constructor of given class, or null if none found. * Access checks are disabled on the returned constructor (if any), since * the defining class may still be non-public. */ ! private static Constructor<?> getExternalizableConstructor(Class<?> cl) { try { ! Constructor<?> cons = cl.getDeclaredConstructor((Class<?>[]) null); cons.setAccessible(true); return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ? cons : null; } catch (NoSuchMethodException ex) { return null;
*** 1322,1340 **** /** * Returns subclass-accessible no-arg constructor of first non-serializable * superclass, or null if none found. Access checks are disabled on the * returned constructor (if any). */ ! private static Constructor getSerializableConstructor(Class<?> cl) { Class<?> initCl = cl; while (Serializable.class.isAssignableFrom(initCl)) { if ((initCl = initCl.getSuperclass()) == null) { return null; } } try { ! Constructor cons = initCl.getDeclaredConstructor((Class<?>[]) null); int mods = cons.getModifiers(); if ((mods & Modifier.PRIVATE) != 0 || ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && !packageEquals(cl, initCl))) { --- 1322,1340 ---- /** * Returns subclass-accessible no-arg constructor of first non-serializable * superclass, or null if none found. Access checks are disabled on the * returned constructor (if any). */ ! private static Constructor<?> getSerializableConstructor(Class<?> cl) { Class<?> initCl = cl; while (Serializable.class.isAssignableFrom(initCl)) { if ((initCl = initCl.getSuperclass()) == null) { return null; } } try { ! Constructor<?> cons = initCl.getDeclaredConstructor((Class<?>[]) null); int mods = cons.getModifiers(); if ((mods & Modifier.PRIVATE) != 0 || ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && !packageEquals(cl, initCl))) {
*** 1800,1810 **** member = field; name = field.getName(); signature = getClassSignature(field.getType()); } ! public MemberSignature(Constructor cons) { member = cons; name = cons.getName(); signature = getMethodSignature( cons.getParameterTypes(), Void.TYPE); } --- 1800,1810 ---- member = field; name = field.getName(); signature = getClassSignature(field.getType()); } ! public MemberSignature(Constructor<?> cons) { member = cons; name = cons.getName(); signature = getMethodSignature( cons.getParameterTypes(), Void.TYPE); }