< prev index next >

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

Print this page

        

*** 29,38 **** --- 29,39 ---- import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import java.lang.ref.WeakReference; import java.lang.reflect.Constructor; import java.lang.reflect.Field; + import java.lang.reflect.InaccessibleObjectException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.UndeclaredThrowableException; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier;
*** 471,480 **** --- 472,482 ---- private ObjectStreamClass(final Class<?> cl) { this.cl = cl; name = cl.getName(); isProxy = Proxy.isProxyClass(cl); isEnum = Enum.class.isAssignableFrom(cl); + boolean isInlineClass = cl.isInlineClass(); serializable = Serializable.class.isAssignableFrom(cl); externalizable = Externalizable.class.isAssignableFrom(cl); Class<?> superCl = cl.getSuperclass(); superDesc = (superCl != null) ? lookup(superCl, false) : null;
*** 538,547 **** --- 540,551 ---- } if (deserializeEx == null) { if (isEnum) { deserializeEx = new ExceptionInfo(name, "enum type"); + } else if (isInlineClass && writeReplaceMethod == null) { + deserializeEx = new ExceptionInfo(name, "inline class"); } else if (cons == null) { deserializeEx = new ExceptionInfo(name, "no valid constructor"); } } for (int i = 0; i < fields.length; i++) {
*** 1500,1510 **** try { Constructor<?> cons = cl.getDeclaredConstructor((Class<?>[]) null); cons.setAccessible(true); return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ? cons : null; ! } catch (NoSuchMethodException ex) { return null; } } /** --- 1504,1514 ---- try { Constructor<?> cons = cl.getDeclaredConstructor((Class<?>[]) null); cons.setAccessible(true); return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ? cons : null; ! } catch (NoSuchMethodException | InaccessibleObjectException ex) { return null; } } /**
< prev index next >