Tue, 21 Jan 2014 08:42:27 -0800
Merge
1.1 --- a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java Fri Jan 17 22:32:15 2014 -0800 1.2 +++ b/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java Tue Jan 21 08:42:27 2014 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -52,6 +52,7 @@ 1.11 import java.io.DataOutputStream; 1.12 import java.io.ByteArrayOutputStream; 1.13 import java.io.InvalidClassException; 1.14 +import java.io.Externalizable; 1.15 import java.io.Serializable; 1.16 1.17 import java.util.Arrays; 1.18 @@ -80,15 +81,15 @@ 1.19 public static final long kDefaultUID = -1; 1.20 1.21 private static Object noArgsList[] = {}; 1.22 - private static Class noTypesList[] = {}; 1.23 + private static Class<?> noTypesList[] = {}; 1.24 1.25 /** true if represents enum type */ 1.26 private boolean isEnum; 1.27 1.28 private static final Bridge bridge = 1.29 - (Bridge)AccessController.doPrivileged( 1.30 - new PrivilegedAction() { 1.31 - public Object run() { 1.32 + AccessController.doPrivileged( 1.33 + new PrivilegedAction<Bridge>() { 1.34 + public Bridge run() { 1.35 return Bridge.get() ; 1.36 } 1.37 } 1.38 @@ -98,7 +99,7 @@ 1.39 * is returned if the specified class does not implement 1.40 * java.io.Serializable or java.io.Externalizable. 1.41 */ 1.42 - static final ObjectStreamClass lookup(Class cl) 1.43 + static final ObjectStreamClass lookup(Class<?> cl) 1.44 { 1.45 ObjectStreamClass desc = lookupInternal(cl); 1.46 if (desc.isSerializable() || desc.isExternalizable()) 1.47 @@ -110,7 +111,7 @@ 1.48 * Find the class descriptor for the specified class. 1.49 * Package access only so it can be called from ObjectIn/OutStream. 1.50 */ 1.51 - static ObjectStreamClass lookupInternal(Class cl) 1.52 + static ObjectStreamClass lookupInternal(Class<?> cl) 1.53 { 1.54 /* Synchronize on the hashtable so no two threads will do 1.55 * this at the same time. 1.56 @@ -121,14 +122,14 @@ 1.57 desc = findDescriptorFor(cl); 1.58 if (desc == null) { 1.59 /* Check if it's serializable */ 1.60 - boolean serializable = classSerializable.isAssignableFrom(cl); 1.61 + boolean serializable = Serializable.class.isAssignableFrom(cl); 1.62 1.63 /* If the class is only Serializable, 1.64 * lookup the descriptor for the superclass. 1.65 */ 1.66 ObjectStreamClass superdesc = null; 1.67 if (serializable) { 1.68 - Class superclass = cl.getSuperclass(); 1.69 + Class<?> superclass = cl.getSuperclass(); 1.70 if (superclass != null) 1.71 superdesc = lookup(superclass); 1.72 } 1.73 @@ -141,7 +142,7 @@ 1.74 if (serializable) { 1.75 externalizable = 1.76 ((superdesc != null) && superdesc.isExternalizable()) || 1.77 - classExternalizable.isAssignableFrom(cl); 1.78 + Externalizable.class.isAssignableFrom(cl); 1.79 if (externalizable) { 1.80 serializable = false; 1.81 } 1.82 @@ -185,7 +186,7 @@ 1.83 * that have evolved from a common root class and agree to be serialized 1.84 * and deserialized using a common format. 1.85 */ 1.86 - public static final long getSerialVersionUID( java.lang.Class clazz) { 1.87 + public static final long getSerialVersionUID( java.lang.Class<?> clazz) { 1.88 ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz ); 1.89 if( theosc != null ) 1.90 { 1.91 @@ -219,7 +220,7 @@ 1.92 /** 1.93 * Return the actual (computed) serialVersionUID for this class. 1.94 */ 1.95 - public static final long getActualSerialVersionUID( java.lang.Class clazz ) 1.96 + public static final long getActualSerialVersionUID( java.lang.Class<?> clazz ) 1.97 { 1.98 ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz ); 1.99 if( theosc != null ) 1.100 @@ -249,7 +250,7 @@ 1.101 * Return the class in the local VM that this version is mapped to. 1.102 * Null is returned if there is no corresponding local class. 1.103 */ 1.104 - public final Class forClass() { 1.105 + public final Class<?> forClass() { 1.106 return ofClass; 1.107 } 1.108 1.109 @@ -349,7 +350,7 @@ 1.110 * Create a new ObjectStreamClass from a loaded class. 1.111 * Don't call this directly, call lookup instead. 1.112 */ 1.113 - private ObjectStreamClass(java.lang.Class cl, ObjectStreamClass superdesc, 1.114 + private ObjectStreamClass(java.lang.Class<?> cl, ObjectStreamClass superdesc, 1.115 boolean serial, boolean extern) 1.116 { 1.117 ofClass = cl; /* created from this class */ 1.118 @@ -433,7 +434,7 @@ 1.119 if (initialized) 1.120 return; 1.121 1.122 - final Class cl = ofClass; 1.123 + final Class<?> cl = ofClass; 1.124 1.125 if (!serializable || 1.126 externalizable || 1.127 @@ -561,9 +562,9 @@ 1.128 * will call it as necessary. 1.129 */ 1.130 writeObjectMethod = getPrivateMethod( cl, "writeObject", 1.131 - new Class[] { java.io.ObjectOutputStream.class }, Void.TYPE ) ; 1.132 + new Class<?>[] { java.io.ObjectOutputStream.class }, Void.TYPE ) ; 1.133 readObjectMethod = getPrivateMethod( cl, "readObject", 1.134 - new Class[] { java.io.ObjectInputStream.class }, Void.TYPE ) ; 1.135 + new Class<?>[] { java.io.ObjectInputStream.class }, Void.TYPE ) ; 1.136 } 1.137 return null; 1.138 } 1.139 @@ -589,9 +590,9 @@ 1.140 * class, or null if none found. Access checks are disabled on the 1.141 * returned method (if any). 1.142 */ 1.143 - private static Method getPrivateMethod(Class cl, String name, 1.144 - Class[] argTypes, 1.145 - Class returnType) 1.146 + private static Method getPrivateMethod(Class<?> cl, String name, 1.147 + Class<?>[] argTypes, 1.148 + Class<?> returnType) 1.149 { 1.150 try { 1.151 Method meth = cl.getDeclaredMethod(name, argTypes); 1.152 @@ -653,7 +654,7 @@ 1.153 * Fill in the reflected Fields that will be used 1.154 * for reading. 1.155 */ 1.156 - final void setClass(Class cl) throws InvalidClassException { 1.157 + final void setClass(Class<?> cl) throws InvalidClassException { 1.158 1.159 if (cl == null) { 1.160 localClassDesc = null; 1.161 @@ -920,9 +921,9 @@ 1.162 * Access checks are disabled on the returned constructor (if any), since 1.163 * the defining class may still be non-public. 1.164 */ 1.165 - private static Constructor getExternalizableConstructor(Class cl) { 1.166 + private static Constructor getExternalizableConstructor(Class<?> cl) { 1.167 try { 1.168 - Constructor cons = cl.getDeclaredConstructor(new Class[0]); 1.169 + Constructor cons = cl.getDeclaredConstructor(new Class<?>[0]); 1.170 cons.setAccessible(true); 1.171 return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ? 1.172 cons : null; 1.173 @@ -936,15 +937,15 @@ 1.174 * superclass, or null if none found. Access checks are disabled on the 1.175 * returned constructor (if any). 1.176 */ 1.177 - private static Constructor getSerializableConstructor(Class cl) { 1.178 - Class initCl = cl; 1.179 + private static Constructor getSerializableConstructor(Class<?> cl) { 1.180 + Class<?> initCl = cl; 1.181 while (Serializable.class.isAssignableFrom(initCl)) { 1.182 if ((initCl = initCl.getSuperclass()) == null) { 1.183 return null; 1.184 } 1.185 } 1.186 try { 1.187 - Constructor cons = initCl.getDeclaredConstructor(new Class[0]); 1.188 + Constructor cons = initCl.getDeclaredConstructor(new Class<?>[0]); 1.189 int mods = cons.getModifiers(); 1.190 if ((mods & Modifier.PRIVATE) != 0 || 1.191 ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && 1.192 @@ -1049,7 +1050,7 @@ 1.193 * items to the hash accumulating in the digest stream. 1.194 * Fold the hash into a long. Use the SHA secure hash function. 1.195 */ 1.196 - private static long _computeSerialVersionUID(Class cl) { 1.197 + private static long _computeSerialVersionUID(Class<?> cl) { 1.198 if (DEBUG_SVUID) 1.199 msg( "Computing SerialVersionUID for " + cl ) ; 1.200 ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); 1.201 @@ -1103,7 +1104,7 @@ 1.202 * them from its computation. 1.203 */ 1.204 1.205 - Class interfaces[] = cl.getInterfaces(); 1.206 + Class<?> interfaces[] = cl.getInterfaces(); 1.207 Arrays.sort(interfaces, compareClassByName); 1.208 1.209 for (int i = 0; i < interfaces.length; i++) { 1.210 @@ -1233,7 +1234,7 @@ 1.211 return h; 1.212 } 1.213 1.214 - private static long computeStructuralUID(com.sun.corba.se.impl.io.ObjectStreamClass osc, Class cl) { 1.215 + private static long computeStructuralUID(com.sun.corba.se.impl.io.ObjectStreamClass osc, Class<?> cl) { 1.216 ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); 1.217 1.218 long h = 0; 1.219 @@ -1253,7 +1254,7 @@ 1.220 DataOutputStream data = new DataOutputStream(mdo); 1.221 1.222 // Get SUID of parent 1.223 - Class parent = cl.getSuperclass(); 1.224 + Class<?> parent = cl.getSuperclass(); 1.225 if ((parent != null)) 1.226 // SerialBug 1; acc. to spec the one for 1.227 // java.lang.object 1.228 @@ -1309,10 +1310,10 @@ 1.229 /** 1.230 * Compute the JVM signature for the class. 1.231 */ 1.232 - static String getSignature(Class clazz) { 1.233 + static String getSignature(Class<?> clazz) { 1.234 String type = null; 1.235 if (clazz.isArray()) { 1.236 - Class cl = clazz; 1.237 + Class<?> cl = clazz; 1.238 int dimensions = 0; 1.239 while (cl.isArray()) { 1.240 dimensions++; 1.241 @@ -1358,7 +1359,7 @@ 1.242 1.243 sb.append("("); 1.244 1.245 - Class[] params = meth.getParameterTypes(); // avoid clone 1.246 + Class<?>[] params = meth.getParameterTypes(); // avoid clone 1.247 for (int j = 0; j < params.length; j++) { 1.248 sb.append(getSignature(params[j])); 1.249 } 1.250 @@ -1375,7 +1376,7 @@ 1.251 1.252 sb.append("("); 1.253 1.254 - Class[] params = cons.getParameterTypes(); // avoid clone 1.255 + Class<?>[] params = cons.getParameterTypes(); // avoid clone 1.256 for (int j = 0; j < params.length; j++) { 1.257 sb.append(getSignature(params[j])); 1.258 } 1.259 @@ -1395,7 +1396,7 @@ 1.260 * The entries are extended from java.lang.ref.SoftReference so the 1.261 * gc will be able to free them if needed. 1.262 */ 1.263 - private static ObjectStreamClass findDescriptorFor(Class cl) { 1.264 + private static ObjectStreamClass findDescriptorFor(Class<?> cl) { 1.265 1.266 int hash = cl.hashCode(); 1.267 int index = (hash & 0x7FFFFFFF) % descriptorFor.length; 1.268 @@ -1442,7 +1443,7 @@ 1.269 descriptorFor[index] = e; 1.270 } 1.271 1.272 - private static Field[] getDeclaredFields(final Class clz) { 1.273 + private static Field[] getDeclaredFields(final Class<?> clz) { 1.274 return (Field[]) AccessController.doPrivileged(new PrivilegedAction() { 1.275 public Object run() { 1.276 return clz.getDeclaredFields(); 1.277 @@ -1476,7 +1477,7 @@ 1.278 /* 1.279 * Class that is a descriptor for in this virtual machine. 1.280 */ 1.281 - private Class ofClass; 1.282 + private Class<?> ofClass; 1.283 1.284 /* 1.285 * True if descriptor for a proxy class. 1.286 @@ -1548,30 +1549,17 @@ 1.287 * Returns true if the given class defines a static initializer method, 1.288 * false otherwise. 1.289 */ 1.290 - private static boolean hasStaticInitializer(Class cl) { 1.291 + private static boolean hasStaticInitializer(Class<?> cl) { 1.292 if (hasStaticInitializerMethod == null) { 1.293 - Class classWithThisMethod = null; 1.294 + Class<?> classWithThisMethod = null; 1.295 1.296 try { 1.297 - try { 1.298 - // When using rip-int with Merlin or when this is a Merlin 1.299 - // workspace, the method we want is in sun.misc.ClassReflector 1.300 - // and absent from java.io.ObjectStreamClass. 1.301 - // 1.302 - // When compiling rip-int with JDK 1.3.x, we have to get it 1.303 - // from java.io.ObjectStreamClass. 1.304 - classWithThisMethod = Class.forName("sun.misc.ClassReflector"); 1.305 - } catch (ClassNotFoundException cnfe) { 1.306 - // Do nothing. This is either not a Merlin workspace, 1.307 - // or rip-int is being compiled with something other than 1.308 - // Merlin, probably JDK 1.3. Fall back on java.io.ObjectStreaClass. 1.309 - } 1.310 if (classWithThisMethod == null) 1.311 classWithThisMethod = java.io.ObjectStreamClass.class; 1.312 1.313 hasStaticInitializerMethod = 1.314 classWithThisMethod.getDeclaredMethod("hasStaticInitializer", 1.315 - new Class[] { Class.class }); 1.316 + new Class<?>[] { Class.class }); 1.317 } catch (NoSuchMethodException ex) { 1.318 } 1.319 1.320 @@ -1596,22 +1584,6 @@ 1.321 } 1.322 1.323 1.324 - /* The Class Object for java.io.Serializable */ 1.325 - private static Class classSerializable = null; 1.326 - private static Class classExternalizable = null; 1.327 - 1.328 - /* 1.329 - * Resolve java.io.Serializable at load time. 1.330 - */ 1.331 - static { 1.332 - try { 1.333 - classSerializable = Class.forName("java.io.Serializable"); 1.334 - classExternalizable = Class.forName("java.io.Externalizable"); 1.335 - } catch (Throwable e) { 1.336 - System.err.println("Could not load java.io.Serializable or java.io.Externalizable."); 1.337 - } 1.338 - } 1.339 - 1.340 /** use serialVersionUID from JDK 1.1. for interoperability */ 1.341 private static final long serialVersionUID = -6120832682080437368L; 1.342 1.343 @@ -1649,8 +1621,8 @@ 1.344 1.345 private static class CompareClassByName implements Comparator { 1.346 public int compare(Object o1, Object o2) { 1.347 - Class c1 = (Class)o1; 1.348 - Class c2 = (Class)o2; 1.349 + Class<?> c1 = (Class)o1; 1.350 + Class<?> c2 = (Class)o2; 1.351 return (c1.getName()).compareTo(c2.getName()); 1.352 } 1.353 } 1.354 @@ -1764,12 +1736,12 @@ 1.355 * 1.356 * Copied from the Merlin java.io.ObjectStreamClass. 1.357 */ 1.358 - private static Method getInheritableMethod(Class cl, String name, 1.359 - Class[] argTypes, 1.360 - Class returnType) 1.361 + private static Method getInheritableMethod(Class<?> cl, String name, 1.362 + Class<?>[] argTypes, 1.363 + Class<?> returnType) 1.364 { 1.365 Method meth = null; 1.366 - Class defCl = cl; 1.367 + Class<?> defCl = cl; 1.368 while (defCl != null) { 1.369 try { 1.370 meth = defCl.getDeclaredMethod(name, argTypes); 1.371 @@ -1801,7 +1773,7 @@ 1.372 * 1.373 * Copied from the Merlin java.io.ObjectStreamClass. 1.374 */ 1.375 - private static boolean packageEquals(Class cl1, Class cl2) { 1.376 + private static boolean packageEquals(Class<?> cl1, Class<?> cl2) { 1.377 Package pkg1 = cl1.getPackage(), pkg2 = cl2.getPackage(); 1.378 return ((pkg1 == pkg2) || ((pkg1 != null) && (pkg1.equals(pkg2)))); 1.379 }
2.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java Fri Jan 17 22:32:15 2014 -0800 2.2 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java Tue Jan 21 08:42:27 2014 -0800 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -94,7 +94,7 @@ 2.11 }); 2.12 } 2.13 2.14 - public static long computeStructuralUID(boolean hasWriteObject, Class cl) { 2.15 + public static long computeStructuralUID(boolean hasWriteObject, Class<?> cl) { 2.16 ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); 2.17 2.18 long h = 0; 2.19 @@ -119,7 +119,7 @@ 2.20 // Object method in there 2.21 2.22 // Get SUID of parent 2.23 - Class parent = cl.getSuperclass(); 2.24 + Class<?> parent = cl.getSuperclass(); 2.25 if ((parent != null) && (parent != java.lang.Object.class)) { 2.26 boolean hasWriteObjectFlag = false; 2.27 Class [] args = {java.io.ObjectOutputStream.class}; 2.28 @@ -503,19 +503,6 @@ 2.29 Class classWithThisMethod = null; 2.30 2.31 try { 2.32 - try { 2.33 - // When using rip-int with Merlin or when this is a Merlin 2.34 - // workspace, the method we want is in sun.misc.ClassReflector 2.35 - // and absent from java.io.ObjectStreamClass. 2.36 - // 2.37 - // When compiling rip-int with JDK 1.3.x, we have to get it 2.38 - // from java.io.ObjectStreamClass. 2.39 - classWithThisMethod = Class.forName("sun.misc.ClassReflector"); 2.40 - } catch (ClassNotFoundException cnfe) { 2.41 - // Do nothing. This is either not a Merlin workspace, 2.42 - // or rip-int is being compiled with something other than 2.43 - // Merlin, probably JDK 1.3. Fall back on java.io.ObjectStreaClass. 2.44 - } 2.45 if (classWithThisMethod == null) 2.46 classWithThisMethod = java.io.ObjectStreamClass.class; 2.47
3.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java Fri Jan 17 22:32:15 2014 -0800 3.2 +++ b/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java Tue Jan 21 08:42:27 2014 -0800 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -53,6 +53,7 @@ 3.11 import java.io.ByteArrayOutputStream; 3.12 import java.io.InvalidClassException; 3.13 import java.io.Serializable; 3.14 +import java.io.Externalizable; 3.15 3.16 import java.util.Arrays; 3.17 import java.util.Comparator; 3.18 @@ -88,7 +89,7 @@ 3.19 public static final long kDefaultUID = -1; 3.20 3.21 private static Object noArgsList[] = {}; 3.22 - private static Class noTypesList[] = {}; 3.23 + private static Class<?> noTypesList[] = {}; 3.24 3.25 private static Hashtable translatedFields; 3.26 3.27 @@ -96,7 +97,7 @@ 3.28 * is returned if the specified class does not implement 3.29 * java.io.Serializable or java.io.Externalizable. 3.30 */ 3.31 - static final ObjectStreamClass_1_3_1 lookup(Class cl) 3.32 + static final ObjectStreamClass_1_3_1 lookup(Class<?> cl) 3.33 { 3.34 ObjectStreamClass_1_3_1 desc = lookupInternal(cl); 3.35 if (desc.isSerializable() || desc.isExternalizable()) 3.36 @@ -108,7 +109,7 @@ 3.37 * Find the class descriptor for the specified class. 3.38 * Package access only so it can be called from ObjectIn/OutStream. 3.39 */ 3.40 - static ObjectStreamClass_1_3_1 lookupInternal(Class cl) 3.41 + static ObjectStreamClass_1_3_1 lookupInternal(Class<?> cl) 3.42 { 3.43 /* Synchronize on the hashtable so no two threads will do 3.44 * this at the same time. 3.45 @@ -122,13 +123,13 @@ 3.46 } 3.47 3.48 /* Check if it's serializable */ 3.49 - boolean serializable = classSerializable.isAssignableFrom(cl); 3.50 + boolean serializable = Serializable.class.isAssignableFrom(cl); 3.51 /* If the class is only Serializable, 3.52 * lookup the descriptor for the superclass. 3.53 */ 3.54 ObjectStreamClass_1_3_1 superdesc = null; 3.55 if (serializable) { 3.56 - Class superclass = cl.getSuperclass(); 3.57 + Class<?> superclass = cl.getSuperclass(); 3.58 if (superclass != null) 3.59 superdesc = lookup(superclass); 3.60 } 3.61 @@ -141,7 +142,7 @@ 3.62 if (serializable) { 3.63 externalizable = 3.64 ((superdesc != null) && superdesc.isExternalizable()) || 3.65 - classExternalizable.isAssignableFrom(cl); 3.66 + Externalizable.class.isAssignableFrom(cl); 3.67 if (externalizable) { 3.68 serializable = false; 3.69 } 3.70 @@ -170,7 +171,7 @@ 3.71 * that have evolved from a common root class and agree to be serialized 3.72 * and deserialized using a common format. 3.73 */ 3.74 - public static final long getSerialVersionUID( java.lang.Class clazz) { 3.75 + public static final long getSerialVersionUID( java.lang.Class<?> clazz) { 3.76 ObjectStreamClass_1_3_1 theosc = ObjectStreamClass_1_3_1.lookup( clazz ); 3.77 if( theosc != null ) 3.78 { 3.79 @@ -204,7 +205,7 @@ 3.80 /** 3.81 * Return the actual (computed) serialVersionUID for this class. 3.82 */ 3.83 - public static final long getActualSerialVersionUID( java.lang.Class clazz ) 3.84 + public static final long getActualSerialVersionUID( java.lang.Class<?> clazz ) 3.85 { 3.86 ObjectStreamClass_1_3_1 theosc = ObjectStreamClass_1_3_1.lookup( clazz ); 3.87 if( theosc != null ) 3.88 @@ -234,7 +235,7 @@ 3.89 * Return the class in the local VM that this version is mapped to. 3.90 * Null is returned if there is no corresponding local class. 3.91 */ 3.92 - public final Class forClass() { 3.93 + public final Class<?> forClass() { 3.94 return ofClass; 3.95 } 3.96 3.97 @@ -333,7 +334,7 @@ 3.98 * Create a new ObjectStreamClass_1_3_1 from a loaded class. 3.99 * Don't call this directly, call lookup instead. 3.100 */ 3.101 - private ObjectStreamClass_1_3_1(java.lang.Class cl, ObjectStreamClass_1_3_1 superdesc, 3.102 + private ObjectStreamClass_1_3_1(java.lang.Class<?> cl, ObjectStreamClass_1_3_1 superdesc, 3.103 boolean serial, boolean extern) 3.104 { 3.105 ofClass = cl; /* created from this class */ 3.106 @@ -376,7 +377,7 @@ 3.107 private void init() { 3.108 synchronized (lock) { 3.109 3.110 - final Class cl = ofClass; 3.111 + final Class<?> cl = ofClass; 3.112 3.113 if (fields != null) // already initialized 3.114 return; 3.115 @@ -558,7 +559,7 @@ 3.116 * will call it as necessary. 3.117 */ 3.118 try { 3.119 - Class[] args = {java.io.ObjectOutputStream.class}; 3.120 + Class<?>[] args = {java.io.ObjectOutputStream.class}; 3.121 writeObjectMethod = cl.getDeclaredMethod("writeObject", args); 3.122 hasWriteObjectMethod = true; 3.123 int mods = writeObjectMethod.getModifiers(); 3.124 @@ -578,7 +579,7 @@ 3.125 * ObjectInputStream so it can all the method directly. 3.126 */ 3.127 try { 3.128 - Class[] args = {java.io.ObjectInputStream.class}; 3.129 + Class<?>[] args = {java.io.ObjectInputStream.class}; 3.130 readObjectMethod = cl.getDeclaredMethod("readObject", args); 3.131 int mods = readObjectMethod.getModifiers(); 3.132 3.133 @@ -629,11 +630,11 @@ 3.134 if (translation != null) 3.135 return translation; 3.136 else { 3.137 - Class osfClass = com.sun.corba.se.impl.orbutil.ObjectStreamField.class; 3.138 + Class<?> osfClass = com.sun.corba.se.impl.orbutil.ObjectStreamField.class; 3.139 3.140 translation = (Object[])java.lang.reflect.Array.newInstance(osfClass, objs.length); 3.141 Object arg[] = new Object[2]; 3.142 - Class types[] = {String.class, Class.class}; 3.143 + Class<?> types[] = {String.class, Class.class}; 3.144 Constructor constructor = osfClass.getDeclaredConstructor(types); 3.145 for (int i = fields.length -1; i >= 0; i--){ 3.146 arg[0] = fields[i].getName(); 3.147 @@ -804,7 +805,7 @@ 3.148 } 3.149 } 3.150 3.151 - private static long computeStructuralUID(ObjectStreamClass_1_3_1 osc, Class cl) { 3.152 + private static long computeStructuralUID(ObjectStreamClass_1_3_1 osc, Class<?> cl) { 3.153 ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); 3.154 3.155 long h = 0; 3.156 @@ -824,7 +825,7 @@ 3.157 DataOutputStream data = new DataOutputStream(mdo); 3.158 3.159 // Get SUID of parent 3.160 - Class parent = cl.getSuperclass(); 3.161 + Class<?> parent = cl.getSuperclass(); 3.162 if ((parent != null)) 3.163 // SerialBug 1; acc. to spec the one for 3.164 // java.lang.object 3.165 @@ -910,10 +911,10 @@ 3.166 /** 3.167 * Compute the JVM signature for the class. 3.168 */ 3.169 - static String getSignature(Class clazz) { 3.170 + static String getSignature(Class<?> clazz) { 3.171 String type = null; 3.172 if (clazz.isArray()) { 3.173 - Class cl = clazz; 3.174 + Class<?> cl = clazz; 3.175 int dimensions = 0; 3.176 while (cl.isArray()) { 3.177 dimensions++; 3.178 @@ -959,7 +960,7 @@ 3.179 3.180 sb.append("("); 3.181 3.182 - Class[] params = meth.getParameterTypes(); // avoid clone 3.183 + Class<?>[] params = meth.getParameterTypes(); // avoid clone 3.184 for (int j = 0; j < params.length; j++) { 3.185 sb.append(getSignature(params[j])); 3.186 } 3.187 @@ -976,7 +977,7 @@ 3.188 3.189 sb.append("("); 3.190 3.191 - Class[] params = cons.getParameterTypes(); // avoid clone 3.192 + Class<?>[] params = cons.getParameterTypes(); // avoid clone 3.193 for (int j = 0; j < params.length; j++) { 3.194 sb.append(getSignature(params[j])); 3.195 } 3.196 @@ -996,7 +997,7 @@ 3.197 * The entries are extended from java.lang.ref.SoftReference so the 3.198 * gc will be able to free them if needed. 3.199 */ 3.200 - private static ObjectStreamClass_1_3_1 findDescriptorFor(Class cl) { 3.201 + private static ObjectStreamClass_1_3_1 findDescriptorFor(Class<?> cl) { 3.202 3.203 int hash = cl.hashCode(); 3.204 int index = (hash & 0x7FFFFFFF) % descriptorFor.length; 3.205 @@ -1077,7 +1078,7 @@ 3.206 /* 3.207 * Class that is a descriptor for in this virtual machine. 3.208 */ 3.209 - private Class ofClass; 3.210 + private Class<?> ofClass; 3.211 3.212 /* 3.213 * True if descriptor for a proxy class. 3.214 @@ -1130,22 +1131,6 @@ 3.215 /* Get the private static final field for serial version UID */ 3.216 // private static native long getSerialVersionUIDField(Class cl); 3.217 3.218 - /* The Class Object for java.io.Serializable */ 3.219 - private static Class classSerializable = null; 3.220 - private static Class classExternalizable = null; 3.221 - 3.222 - /* 3.223 - * Resolve java.io.Serializable at load time. 3.224 - */ 3.225 - static { 3.226 - try { 3.227 - classSerializable = Class.forName("java.io.Serializable"); 3.228 - classExternalizable = Class.forName("java.io.Externalizable"); 3.229 - } catch (Throwable e) { 3.230 - System.err.println("Could not load java.io.Serializable or java.io.Externalizable."); 3.231 - } 3.232 - } 3.233 - 3.234 /** use serialVersionUID from JDK 1.1. for interoperability */ 3.235 private static final long serialVersionUID = -6120832682080437368L; 3.236 3.237 @@ -1183,8 +1168,8 @@ 3.238 3.239 private static class CompareClassByName implements Comparator { 3.240 public int compare(Object o1, Object o2) { 3.241 - Class c1 = (Class)o1; 3.242 - Class c2 = (Class)o2; 3.243 + Class<?> c1 = (Class)o1; 3.244 + Class<?> c2 = (Class)o2; 3.245 return (c1.getName()).compareTo(c2.getName()); 3.246 } 3.247 }
4.1 --- a/src/share/classes/org/omg/CORBA/ORB.java Fri Jan 17 22:32:15 2014 -0800 4.2 +++ b/src/share/classes/org/omg/CORBA/ORB.java Tue Jan 21 08:42:27 2014 -0800 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -36,6 +36,8 @@ 4.11 import java.security.AccessController; 4.12 import java.security.PrivilegedAction; 4.13 4.14 +import sun.reflect.misc.ReflectUtil; 4.15 + 4.16 /** 4.17 * A class providing APIs for the CORBA Object Request Broker 4.18 * features. The <code>ORB</code> class also provides 4.19 @@ -289,20 +291,38 @@ 4.20 (className.equals("com.sun.corba.se.impl.orb.ORBSingleton"))) { 4.21 singleton = new com.sun.corba.se.impl.orb.ORBSingleton(); 4.22 } else { 4.23 - singleton = create_impl(className); 4.24 + singleton = create_impl_with_systemclassloader(className); 4.25 } 4.26 } 4.27 return singleton; 4.28 } 4.29 4.30 + private static ORB create_impl_with_systemclassloader(String className) { 4.31 + 4.32 + try { 4.33 + ReflectUtil.checkPackageAccess(className); 4.34 + ClassLoader cl = ClassLoader.getSystemClassLoader(); 4.35 + Class<org.omg.CORBA.ORB> orbBaseClass = org.omg.CORBA.ORB.class; 4.36 + Class<?> singletonOrbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass); 4.37 + return (ORB)singletonOrbClass.newInstance(); 4.38 + } catch (Throwable ex) { 4.39 + SystemException systemException = new INITIALIZE( 4.40 + "can't instantiate default ORB implementation " + className); 4.41 + systemException.initCause(ex); 4.42 + throw systemException; 4.43 + } 4.44 + } 4.45 + 4.46 private static ORB create_impl(String className) { 4.47 - 4.48 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 4.49 if (cl == null) 4.50 cl = ClassLoader.getSystemClassLoader(); 4.51 4.52 try { 4.53 - return (ORB) Class.forName(className, true, cl).newInstance(); 4.54 + ReflectUtil.checkPackageAccess(className); 4.55 + Class<org.omg.CORBA.ORB> orbBaseClass = org.omg.CORBA.ORB.class; 4.56 + Class<?> orbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass); 4.57 + return (ORB)orbClass.newInstance(); 4.58 } catch (Throwable ex) { 4.59 SystemException systemException = new INITIALIZE( 4.60 "can't instantiate default ORB implementation " + className); 4.61 @@ -346,7 +366,6 @@ 4.62 } else { 4.63 orb = create_impl(className); 4.64 } 4.65 - 4.66 orb.set_parameters(args, props); 4.67 return orb; 4.68 } 4.69 @@ -377,7 +396,6 @@ 4.70 } else { 4.71 orb = create_impl(className); 4.72 } 4.73 - 4.74 orb.set_parameters(app, props); 4.75 return orb; 4.76 } 4.77 @@ -573,7 +591,7 @@ 4.78 try { 4.79 // First try to load the OperationDef class 4.80 String opDefClassName = "org.omg.CORBA.OperationDef"; 4.81 - Class opDefClass = null; 4.82 + Class<?> opDefClass = null; 4.83 4.84 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 4.85 if ( cl == null ) 4.86 @@ -583,7 +601,7 @@ 4.87 4.88 // OK, we loaded OperationDef. Now try to get the 4.89 // create_operation_list(OperationDef oper) method. 4.90 - Class[] argc = { opDefClass }; 4.91 + Class<?>[] argc = { opDefClass }; 4.92 java.lang.reflect.Method meth = 4.93 this.getClass().getMethod("create_operation_list", argc); 4.94