src/share/classes/sun/rmi/server/Util.java
Print this page
@@ -117,16 +117,16 @@
* @throws IllegalArgumentException if implClass implements illegal
* remote interfaces
* @throws StubNotFoundException if problem locating/creating stub or
* creating the dynamic proxy instance
**/
- public static Remote createProxy(Class implClass,
+ public static Remote createProxy(Class<?> implClass,
RemoteRef clientRef,
boolean forceStubUse)
throws StubNotFoundException
{
- Class remoteClass;
+ Class<?> remoteClass;
try {
remoteClass = getRemoteClass(implClass);
} catch (ClassNotFoundException ex ) {
throw new StubNotFoundException(
@@ -160,11 +160,11 @@
* Returns true if a stub class for the given impl class can be loaded,
* otherwise returns false.
*
* @param remoteClass the class to obtain remote interfaces from
*/
- private static boolean stubClassExists(Class remoteClass) {
+ private static boolean stubClassExists(Class<?> remoteClass) {
if (!withoutStubs.containsKey(remoteClass)) {
try {
Class.forName(remoteClass.getName() + "_Stub",
false,
remoteClass.getClassLoader());
@@ -180,15 +180,15 @@
/*
* Returns the class/superclass that implements the remote interface.
* @throws ClassNotFoundException if no class is found to have a
* remote interface
*/
- private static Class getRemoteClass(Class cl)
+ private static Class<?> getRemoteClass(Class<?> cl)
throws ClassNotFoundException
{
while (cl != null) {
- Class[] interfaces = cl.getInterfaces();
+ Class<?>[] interfaces = cl.getInterfaces();
for (int i = interfaces.length -1; i >= 0; i--) {
if (Remote.class.isAssignableFrom(interfaces[i]))
return cl; // this class implements remote object
}
cl = cl.getSuperclass();
@@ -204,12 +204,12 @@
* @param remoteClass the class to obtain remote interfaces from
* @throws IllegalArgumentException if remoteClass implements
* any illegal remote interfaces
* @throws NullPointerException if remoteClass is null
*/
- private static Class[] getRemoteInterfaces(Class remoteClass) {
- ArrayList<Class<?>> list = new ArrayList<Class<?>>();
+ private static Class<?>[] getRemoteInterfaces(Class<?> remoteClass) {
+ ArrayList<Class<?>> list = new ArrayList<>();
getRemoteInterfaces(list, remoteClass);
return list.toArray(new Class<?>[list.size()]);
}
/**
@@ -218,19 +218,19 @@
*
* @throws IllegalArgumentException if the specified class implements
* any illegal remote interfaces
* @throws NullPointerException if the specified class or list is null
*/
- private static void getRemoteInterfaces(ArrayList<Class<?>> list, Class cl) {
- Class superclass = cl.getSuperclass();
+ private static void getRemoteInterfaces(ArrayList<Class<?>> list, Class<?> cl) {
+ Class<?> superclass = cl.getSuperclass();
if (superclass != null) {
getRemoteInterfaces(list, superclass);
}
- Class[] interfaces = cl.getInterfaces();
+ Class<?>[] interfaces = cl.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
- Class intf = interfaces[i];
+ Class<?> intf = interfaces[i];
/*
* If it is a remote interface (if it extends from
* java.rmi.Remote) and is not already in the list,
* then add the interface to the list.
*/
@@ -270,11 +270,11 @@
* implements a remote interface. The stub class name is the name of
* the specified remoteClass with the suffix "_Stub". The loading of
* the stub class is initiated from class loader of the specified class
* (which may be the bootstrap class loader).
**/
- private static RemoteStub createStub(Class remoteClass, RemoteRef ref)
+ private static RemoteStub createStub(Class<?> remoteClass, RemoteRef ref)
throws StubNotFoundException
{
String stubname = remoteClass.getName() + "_Stub";
/* Make sure to use the local stub loader for the stub classes.
@@ -283,11 +283,11 @@
* pickle methods
*/
try {
Class<?> stubcl =
Class.forName(stubname, false, remoteClass.getClassLoader());
- Constructor cons = stubcl.getConstructor(stubConsParamTypes);
+ Constructor<?> cons = stubcl.getConstructor(stubConsParamTypes);
return (RemoteStub) cons.newInstance(new Object[] { ref });
} catch (ClassNotFoundException e) {
throw new StubNotFoundException(
"Stub class not found: " + stubname, e);
@@ -313,11 +313,11 @@
* Locate and return the Skeleton for the specified remote object
*/
static Skeleton createSkeleton(Remote object)
throws SkeletonNotFoundException
{
- Class cl;
+ Class<?> cl;
try {
cl = getRemoteClass(object.getClass());
} catch (ClassNotFoundException ex ) {
throw new SkeletonNotFoundException(
"object does not implement a remote interface: " +
@@ -325,11 +325,11 @@
}
// now try to load the skeleton based ont he name of the class
String skelname = cl.getName() + "_Skel";
try {
- Class skelcl = Class.forName(skelname, false, cl.getClassLoader());
+ Class<?> skelcl = Class.forName(skelname, false, cl.getClassLoader());
return (Skeleton)skelcl.newInstance();
} catch (ClassNotFoundException ex) {
throw new SkeletonNotFoundException("Skeleton class not found: " +
skelname, ex);
@@ -389,16 +389,16 @@
* the definition of a "method descriptor".
*/
private static String getMethodNameAndDescriptor(Method m) {
StringBuffer desc = new StringBuffer(m.getName());
desc.append('(');
- Class[] paramTypes = m.getParameterTypes();
+ Class<?>[] paramTypes = m.getParameterTypes();
for (int i = 0; i < paramTypes.length; i++) {
desc.append(getTypeDescriptor(paramTypes[i]));
}
desc.append(')');
- Class returnType = m.getReturnType();
+ Class<?> returnType = m.getReturnType();
if (returnType == void.class) { // optimization: handle void here
desc.append('V');
} else {
desc.append(getTypeDescriptor(returnType));
}
@@ -407,11 +407,11 @@
/**
* Get the descriptor of a particular type, as appropriate for either
* a parameter or return type in a method descriptor.
*/
- private static String getTypeDescriptor(Class type) {
+ private static String getTypeDescriptor(Class<?> type) {
if (type.isPrimitive()) {
if (type == int.class) {
return "I";
} else if (type == boolean.class) {
return "Z";
@@ -452,10 +452,10 @@
* top-level types, so for a nested type, the returned name will
* still be qualified with the simple name of its enclosing
* top-level type (and perhaps other enclosing types), the
* separator will be '$', etc.
**/
- public static String getUnqualifiedName(Class c) {
+ public static String getUnqualifiedName(Class<?> c) {
String binaryName = c.getName();
return binaryName.substring(binaryName.lastIndexOf('.') + 1);
}
}