--- a/jdk/src/share/classes/java/lang/Class.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/java/lang/Class.java Wed Oct 07 08:38:43 2009 -0700
@@ -265,7 +265,7 @@
}
/** Called after security checks have been made. */
- private static native Class forName0(String name, boolean initialize,
+ private static native Class<?> forName0(String name, boolean initialize,
ClassLoader loader)
throws ClassNotFoundException;
@@ -339,7 +339,7 @@
);
}
try {
- Class[] empty = {};
+ Class<?>[] empty = {};
final Constructor<T> c = getConstructor0(empty, Member.DECLARED);
// Disable accessibility checks on the constructor
// since we have to do the security check here anyway
@@ -361,7 +361,7 @@
// Security check (same as in java.lang.reflect.Constructor)
int modifiers = tmpConstructor.getModifiers();
if (!Reflection.quickCheckMemberAccess(this, modifiers)) {
- Class caller = Reflection.getCallerClass(3);
+ Class<?> caller = Reflection.getCallerClass(3);
if (newInstanceCallerCache != caller) {
Reflection.ensureMemberAccess(caller, this, null, modifiers);
newInstanceCallerCache = caller;
@@ -377,7 +377,7 @@
}
}
private volatile transient Constructor<T> cachedConstructor;
- private volatile transient Class newInstanceCallerCache;
+ private volatile transient Class<?> newInstanceCallerCache;
/**
@@ -638,7 +638,7 @@
if (getGenericSignature() != null)
return (TypeVariable<Class<T>>[])getGenericInfo().getTypeParameters();
else
- return (TypeVariable<Class<T>>[])new TypeVariable[0];
+ return (TypeVariable<Class<T>>[])new TypeVariable<?>[0];
}
@@ -901,7 +901,7 @@
MethodRepository typeInfo = MethodRepository.make(enclosingInfo.getDescriptor(),
getFactory());
- Class returnType = toClass(typeInfo.getReturnType());
+ Class<?> returnType = toClass(typeInfo.getReturnType());
Type [] parameterTypes = typeInfo.getParameterTypes();
Class<?>[] parameterClasses = new Class<?>[parameterTypes.length];
@@ -996,12 +996,12 @@
}
- private static Class toClass(Type o) {
+ private static Class<?> toClass(Type o) {
if (o instanceof GenericArrayType)
return Array.newInstance(toClass(((GenericArrayType)o).getGenericComponentType()),
0)
.getClass();
- return (Class)o;
+ return (Class<?>)o;
}
/**
@@ -1042,7 +1042,7 @@
* Loop over all declared constructors; match number
* of and type of parameters.
*/
- for(Constructor c: enclosingInfo.getEnclosingClass().getDeclaredConstructors()) {
+ for(Constructor<?> c: enclosingInfo.getEnclosingClass().getDeclaredConstructors()) {
Class<?>[] candidateParamClasses = c.getParameterTypes();
if (candidateParamClasses.length == parameterClasses.length) {
boolean matches = true;
@@ -1304,12 +1304,12 @@
// has already been ok'd by the SecurityManager.
return java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<Class[]>() {
+ new java.security.PrivilegedAction<Class<?>[]>() {
public Class[] run() {
- List<Class> list = new ArrayList<Class>();
- Class currentClass = Class.this;
+ List<Class<?>> list = new ArrayList<Class<?>>();
+ Class<?> currentClass = Class.this;
while (currentClass != null) {
- Class[] members = currentClass.getDeclaredClasses();
+ Class<?>[] members = currentClass.getDeclaredClasses();
for (int i = 0; i < members.length; i++) {
if (Modifier.isPublic(members[i].getModifiers())) {
list.add(members[i]);
@@ -2191,7 +2191,7 @@
return name;
}
if (!name.startsWith("/")) {
- Class c = this;
+ Class<?> c = this;
while (c.isArray()) {
c = c.getComponentType();
}
@@ -2565,12 +2565,12 @@
// out concrete implementations inherited from superclasses at
// the end.
MethodArray inheritedMethods = new MethodArray();
- Class[] interfaces = getInterfaces();
+ Class<?>[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
inheritedMethods.addAll(interfaces[i].privateGetPublicMethods());
}
if (!isInterface()) {
- Class c = getSuperclass();
+ Class<?> c = getSuperclass();
if (c != null) {
MethodArray supers = new MethodArray();
supers.addAll(c.privateGetPublicMethods());
@@ -2632,16 +2632,16 @@
return res;
}
// Direct superinterfaces, recursively
- Class[] interfaces = getInterfaces();
+ Class<?>[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
- Class c = interfaces[i];
+ Class<?> c = interfaces[i];
if ((res = c.getField0(name)) != null) {
return res;
}
}
// Direct superclass, recursively
if (!isInterface()) {
- Class c = getSuperclass();
+ Class<?> c = getSuperclass();
if (c != null) {
if ((res = c.getField0(name)) != null) {
return res;
@@ -2653,7 +2653,7 @@
private static Method searchMethods(Method[] methods,
String name,
- Class[] parameterTypes)
+ Class<?>[] parameterTypes)
{
Method res = null;
String internedName = name.intern();
@@ -2670,7 +2670,7 @@
}
- private Method getMethod0(String name, Class[] parameterTypes) {
+ private Method getMethod0(String name, Class<?>[] parameterTypes) {
// Note: the intent is that the search algorithm this routine
// uses be equivalent to the ordering imposed by
// privateGetPublicMethods(). It fetches only the declared
@@ -2687,7 +2687,7 @@
}
// Search superclass's methods
if (!isInterface()) {
- Class c = getSuperclass();
+ Class<? super T> c = getSuperclass();
if (c != null) {
if ((res = c.getMethod0(name, parameterTypes)) != null) {
return res;
@@ -2695,9 +2695,9 @@
}
}
// Search superinterfaces' methods
- Class[] interfaces = getInterfaces();
+ Class<?>[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
- Class c = interfaces[i];
+ Class<?> c = interfaces[i];
if ((res = c.getMethod0(name, parameterTypes)) != null) {
return res;
}
@@ -2706,7 +2706,7 @@
return null;
}
- private Constructor<T> getConstructor0(Class[] parameterTypes,
+ private Constructor<T> getConstructor0(Class<?>[] parameterTypes,
int which) throws NoSuchMethodException
{
Constructor<T>[] constructors = privateGetDeclaredConstructors((which == Member.PUBLIC));
@@ -2775,9 +2775,9 @@
private native Field[] getDeclaredFields0(boolean publicOnly);
private native Method[] getDeclaredMethods0(boolean publicOnly);
private native Constructor<T>[] getDeclaredConstructors0(boolean publicOnly);
- private native Class[] getDeclaredClasses0();
+ private native Class<?>[] getDeclaredClasses0();
- private static String argumentTypesToString(Class[] argTypes) {
+ private static String argumentTypesToString(Class<?>[] argTypes) {
StringBuilder buf = new StringBuilder();
buf.append("(");
if (argTypes != null) {
@@ -2785,7 +2785,7 @@
if (i > 0) {
buf.append(", ");
}
- Class c = argTypes[i];
+ Class<?> c = argTypes[i];
buf.append((c == null) ? "null" : c.getName());
}
}
@@ -2858,7 +2858,7 @@
}
// Retrieves the desired assertion status of this class from the VM
- private static native boolean desiredAssertionStatus0(Class clazz);
+ private static native boolean desiredAssertionStatus0(Class<?> clazz);
/**
* Returns true if and only if this class was declared as an enum in the
@@ -2979,7 +2979,7 @@
getName() + " is not an enum type");
Map<String, T> m = new HashMap<String, T>(2 * universe.length);
for (T constant : universe)
- m.put(((Enum)constant).name(), constant);
+ m.put(((Enum<?>)constant).name(), constant);
enumConstantDirectory = m;
}
return enumConstantDirectory;
@@ -3077,8 +3077,8 @@
}
// Annotations cache
- private transient Map<Class, Annotation> annotations;
- private transient Map<Class, Annotation> declaredAnnotations;
+ private transient Map<Class<? extends Annotation>, Annotation> annotations;
+ private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
private synchronized void initAnnotationsIfNecessary() {
clearCachesOnClassRedefinition();
@@ -3090,10 +3090,10 @@
if (superClass == null) {
annotations = declaredAnnotations;
} else {
- annotations = new HashMap<Class, Annotation>();
+ annotations = new HashMap<Class<? extends Annotation>, Annotation>();
superClass.initAnnotationsIfNecessary();
- for (Map.Entry<Class, Annotation> e : superClass.annotations.entrySet()) {
- Class annotationClass = e.getKey();
+ for (Map.Entry<Class<? extends Annotation>, Annotation> e : superClass.annotations.entrySet()) {
+ Class<? extends Annotation> annotationClass = e.getKey();
if (AnnotationType.getInstance(annotationClass).isInherited())
annotations.put(annotationClass, e.getValue());
}
--- a/jdk/src/share/classes/java/lang/Package.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/java/lang/Package.java Wed Oct 07 08:38:43 2009 -0700
@@ -320,7 +320,7 @@
* @param class the class to get the package of.
* @return the package of the class. It may be null if no package
* information is available from the archive or codebase. */
- static Package getPackage(Class c) {
+ static Package getPackage(Class<?> c) {
String name = c.getName();
int i = name.lastIndexOf('.');
if (i != -1) {
--- a/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java Wed Oct 07 08:38:43 2009 -0700
@@ -131,7 +131,7 @@
throws SecurityException
{
if (obj instanceof Constructor && flag == true) {
- Constructor c = (Constructor)obj;
+ Constructor<?> c = (Constructor<?>)obj;
if (c.getDeclaringClass() == Class.class) {
throw new SecurityException("Can not make a java.lang.Class" +
" constructor accessible");
--- a/jdk/src/share/classes/java/lang/reflect/Constructor.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java Wed Oct 07 08:38:43 2009 -0700
@@ -64,8 +64,8 @@
private Class<T> clazz;
private int slot;
- private Class[] parameterTypes;
- private Class[] exceptionTypes;
+ private Class<?>[] parameterTypes;
+ private Class<?>[] exceptionTypes;
private int modifiers;
// Generics and annotations support
private transient String signature;
@@ -80,7 +80,7 @@
// always succeed (it is not affected by the granting or revoking
// of permissions); we speed up the check in the common case by
// remembering the last Class for which the check succeeded.
- private volatile Class securityCheckCache;
+ private volatile Class<?> securityCheckCache;
// Generics infrastructure
// Accessor for factory
@@ -113,8 +113,8 @@
* package via sun.reflect.LangReflectAccess.
*/
Constructor(Class<T> declaringClass,
- Class[] parameterTypes,
- Class[] checkedExceptions,
+ Class<?>[] parameterTypes,
+ Class<?>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -307,11 +307,11 @@
*/
public boolean equals(Object obj) {
if (obj != null && obj instanceof Constructor) {
- Constructor other = (Constructor)obj;
+ Constructor<?> other = (Constructor<?>)obj;
if (getDeclaringClass() == other.getDeclaringClass()) {
/* Avoid unnecessary cloning */
- Class[] params1 = parameterTypes;
- Class[] params2 = other.parameterTypes;
+ Class<?>[] params1 = parameterTypes;
+ Class<?>[] params2 = other.parameterTypes;
if (params1.length == params2.length) {
for (int i = 0; i < params1.length; i++) {
if (params1[i] != params2[i])
@@ -357,14 +357,14 @@
}
sb.append(Field.getTypeName(getDeclaringClass()));
sb.append("(");
- Class[] params = parameterTypes; // avoid clone
+ Class<?>[] params = parameterTypes; // avoid clone
for (int j = 0; j < params.length; j++) {
sb.append(Field.getTypeName(params[j]));
if (j < (params.length - 1))
sb.append(",");
}
sb.append(")");
- Class[] exceptions = exceptionTypes; // avoid clone
+ Class<?>[] exceptions = exceptionTypes; // avoid clone
if (exceptions.length > 0) {
sb.append(" throws ");
for (int k = 0; k < exceptions.length; k++) {
@@ -452,7 +452,7 @@
sb.append(" throws ");
for (int k = 0; k < exceptions.length; k++) {
sb.append((exceptions[k] instanceof Class)?
- ((Class)exceptions[k]).getName():
+ ((Class<?>)exceptions[k]).getName():
exceptions[k].toString());
if (k < (exceptions.length - 1))
sb.append(",");
@@ -518,7 +518,7 @@
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
- Class caller = Reflection.getCallerClass(2);
+ Class<?> caller = Reflection.getCallerClass(2);
if (securityCheckCache != caller) {
Reflection.ensureMemberAccess(caller, clazz, null, modifiers);
securityCheckCache = caller;
@@ -625,9 +625,9 @@
return AnnotationParser.toArray(declaredAnnotations());
}
- private transient Map<Class, Annotation> declaredAnnotations;
+ private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
- private synchronized Map<Class, Annotation> declaredAnnotations() {
+ private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
if (declaredAnnotations == null) {
declaredAnnotations = AnnotationParser.parseAnnotations(
annotations, sun.misc.SharedSecrets.getJavaLangAccess().
--- a/jdk/src/share/classes/java/lang/reflect/Field.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java Wed Oct 07 08:38:43 2009 -0700
@@ -58,12 +58,12 @@
public final
class Field extends AccessibleObject implements Member {
- private Class clazz;
+ private Class<?> clazz;
private int slot;
// This is guaranteed to be interned by the VM in the 1.4
// reflection implementation
private String name;
- private Class type;
+ private Class<?> type;
private int modifiers;
// Generics and annotations support
private transient String signature;
@@ -81,8 +81,8 @@
// More complicated security check cache needed here than for
// Class.newInstance() and Constructor.newInstance()
- private Class securityCheckCache;
- private Class securityCheckTargetClassCache;
+ private Class<?> securityCheckCache;
+ private Class<?> securityCheckTargetClassCache;
// Generics infrastructure
@@ -112,9 +112,9 @@
* instantiation of these objects in Java code from the java.lang
* package via sun.reflect.LangReflectAccess.
*/
- Field(Class declaringClass,
+ Field(Class<?> declaringClass,
String name,
- Class type,
+ Class<?> type,
int modifiers,
int slot,
String signature,
@@ -964,10 +964,10 @@
private void doSecurityCheck(Object obj) throws IllegalAccessException {
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
- Class caller = Reflection.getCallerClass(4);
- Class targetClass = ((obj == null || !Modifier.isProtected(modifiers))
- ? clazz
- : obj.getClass());
+ Class<?> caller = Reflection.getCallerClass(4);
+ Class<?> targetClass = ((obj == null || !Modifier.isProtected(modifiers))
+ ? clazz
+ : obj.getClass());
synchronized (this) {
if ((securityCheckCache == caller)
@@ -987,10 +987,10 @@
/*
* Utility routine to paper over array type names
*/
- static String getTypeName(Class type) {
+ static String getTypeName(Class<?> type) {
if (type.isArray()) {
try {
- Class cl = type;
+ Class<?> cl = type;
int dimensions = 0;
while (cl.isArray()) {
dimensions++;
@@ -1025,9 +1025,9 @@
return AnnotationParser.toArray(declaredAnnotations());
}
- private transient Map<Class, Annotation> declaredAnnotations;
+ private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
- private synchronized Map<Class, Annotation> declaredAnnotations() {
+ private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
if (declaredAnnotations == null) {
declaredAnnotations = AnnotationParser.parseAnnotations(
annotations, sun.misc.SharedSecrets.getJavaLangAccess().
--- a/jdk/src/share/classes/java/lang/reflect/Method.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java Wed Oct 07 08:38:43 2009 -0700
@@ -61,14 +61,14 @@
public final
class Method extends AccessibleObject implements GenericDeclaration,
Member {
- private Class clazz;
+ private Class<?> clazz;
private int slot;
// This is guaranteed to be interned by the VM in the 1.4
// reflection implementation
private String name;
- private Class returnType;
- private Class[] parameterTypes;
- private Class[] exceptionTypes;
+ private Class<?> returnType;
+ private Class<?>[] parameterTypes;
+ private Class<?>[] exceptionTypes;
private int modifiers;
// Generics and annotations support
private transient String signature;
@@ -85,8 +85,8 @@
// More complicated security check cache needed here than for
// Class.newInstance() and Constructor.newInstance()
- private Class securityCheckCache;
- private Class securityCheckTargetClassCache;
+ private Class<?> securityCheckCache;
+ private Class<?> securityCheckTargetClassCache;
// Generics infrastructure
@@ -114,11 +114,11 @@
* instantiation of these objects in Java code from the java.lang
* package via sun.reflect.LangReflectAccess.
*/
- Method(Class declaringClass,
+ Method(Class<?> declaringClass,
String name,
- Class[] parameterTypes,
- Class returnType,
- Class[] checkedExceptions,
+ Class<?>[] parameterTypes,
+ Class<?> returnType,
+ Class<?>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -355,8 +355,8 @@
if (!returnType.equals(other.getReturnType()))
return false;
/* Avoid unnecessary cloning */
- Class[] params1 = parameterTypes;
- Class[] params2 = other.parameterTypes;
+ Class<?>[] params1 = parameterTypes;
+ Class<?>[] params2 = other.parameterTypes;
if (params1.length == params2.length) {
for (int i = 0; i < params1.length; i++) {
if (params1[i] != params2[i])
@@ -410,14 +410,14 @@
sb.append(Field.getTypeName(getReturnType()) + " ");
sb.append(Field.getTypeName(getDeclaringClass()) + ".");
sb.append(getName() + "(");
- Class[] params = parameterTypes; // avoid clone
+ Class<?>[] params = parameterTypes; // avoid clone
for (int j = 0; j < params.length; j++) {
sb.append(Field.getTypeName(params[j]));
if (j < (params.length - 1))
sb.append(",");
}
sb.append(")");
- Class[] exceptions = exceptionTypes; // avoid clone
+ Class<?>[] exceptions = exceptionTypes; // avoid clone
if (exceptions.length > 0) {
sb.append(" throws ");
for (int k = 0; k < exceptions.length; k++) {
@@ -590,10 +590,10 @@
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
- Class caller = Reflection.getCallerClass(1);
- Class targetClass = ((obj == null || !Modifier.isProtected(modifiers))
- ? clazz
- : obj.getClass());
+ Class<?> caller = Reflection.getCallerClass(1);
+ Class<?> targetClass = ((obj == null || !Modifier.isProtected(modifiers))
+ ? clazz
+ : obj.getClass());
boolean cached;
synchronized (this) {
@@ -702,9 +702,9 @@
return AnnotationParser.toArray(declaredAnnotations());
}
- private transient Map<Class, Annotation> declaredAnnotations;
+ private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
- private synchronized Map<Class, Annotation> declaredAnnotations() {
+ private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
if (declaredAnnotations == null) {
declaredAnnotations = AnnotationParser.parseAnnotations(
annotations, sun.misc.SharedSecrets.getJavaLangAccess().
@@ -731,7 +731,7 @@
public Object getDefaultValue() {
if (annotationDefault == null)
return null;
- Class memberType = AnnotationType.invocationHandlerReturnType(
+ Class<?> memberType = AnnotationType.invocationHandlerReturnType(
getReturnType());
Object result = AnnotationParser.parseMemberValue(
memberType, ByteBuffer.wrap(annotationDefault),
--- a/jdk/src/share/classes/java/lang/reflect/Proxy.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Proxy.java Wed Oct 07 08:38:43 2009 -0700
@@ -350,7 +350,7 @@
throw new IllegalArgumentException("interface limit exceeded");
}
- Class proxyClass = null;
+ Class<?> proxyClass = null;
/* collect interface names to use as key for proxy class cache */
String[] interfaceNames = new String[interfaces.length];
@@ -364,7 +364,7 @@
* interface to the same Class object.
*/
String interfaceName = interfaces[i].getName();
- Class interfaceClass = null;
+ Class<?> interfaceClass = null;
try {
interfaceClass = Class.forName(interfaceName, false, loader);
} catch (ClassNotFoundException e) {
--- a/jdk/src/share/classes/java/lang/reflect/ReflectAccess.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/ReflectAccess.java Wed Oct 07 08:38:43 2009 -0700
@@ -33,9 +33,9 @@
package to instantiate objects in this package. */
class ReflectAccess implements sun.reflect.LangReflectAccess {
- public Field newField(Class declaringClass,
+ public Field newField(Class<?> declaringClass,
String name,
- Class type,
+ Class<?> type,
int modifiers,
int slot,
String signature,
@@ -50,11 +50,11 @@
annotations);
}
- public Method newMethod(Class declaringClass,
+ public Method newMethod(Class<?> declaringClass,
String name,
- Class[] parameterTypes,
- Class returnType,
- Class[] checkedExceptions,
+ Class<?>[] parameterTypes,
+ Class<?> returnType,
+ Class<?>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -76,8 +76,8 @@
}
public <T> Constructor<T> newConstructor(Class<T> declaringClass,
- Class[] parameterTypes,
- Class[] checkedExceptions,
+ Class<?>[] parameterTypes,
+ Class<?>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -102,29 +102,29 @@
m.setMethodAccessor(accessor);
}
- public ConstructorAccessor getConstructorAccessor(Constructor c) {
+ public ConstructorAccessor getConstructorAccessor(Constructor<?> c) {
return c.getConstructorAccessor();
}
- public void setConstructorAccessor(Constructor c,
+ public void setConstructorAccessor(Constructor<?> c,
ConstructorAccessor accessor)
{
c.setConstructorAccessor(accessor);
}
- public int getConstructorSlot(Constructor c) {
+ public int getConstructorSlot(Constructor<?> c) {
return c.getSlot();
}
- public String getConstructorSignature(Constructor c) {
+ public String getConstructorSignature(Constructor<?> c) {
return c.getSignature();
}
- public byte[] getConstructorAnnotations(Constructor c) {
+ public byte[] getConstructorAnnotations(Constructor<?> c) {
return c.getRawAnnotations();
}
- public byte[] getConstructorParameterAnnotations(Constructor c) {
+ public byte[] getConstructorParameterAnnotations(Constructor<?> c) {
return c.getRawParameterAnnotations();
}
--- a/jdk/src/share/classes/sun/misc/BootClassLoaderHook.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/sun/misc/BootClassLoaderHook.java Wed Oct 07 08:38:43 2009 -0700
@@ -102,7 +102,7 @@
public static File[] getBootstrapPaths() {
BootClassLoaderHook hook = getHook();
if (hook != null) {
- return hook.getBootstrapPaths();
+ return hook.getAdditionalBootstrapPaths();
} else {
return EMPTY_FILE_ARRAY;
}
--- a/jdk/src/share/classes/sun/reflect/LangReflectAccess.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/sun/reflect/LangReflectAccess.java Wed Oct 07 08:38:43 2009 -0700
@@ -33,9 +33,9 @@
public interface LangReflectAccess {
/** Creates a new java.lang.reflect.Field. Access checks as per
java.lang.reflect.AccessibleObject are not overridden. */
- public Field newField(Class declaringClass,
+ public Field newField(Class<?> declaringClass,
String name,
- Class type,
+ Class<?> type,
int modifiers,
int slot,
String signature,
@@ -43,11 +43,11 @@
/** Creates a new java.lang.reflect.Method. Access checks as per
java.lang.reflect.AccessibleObject are not overridden. */
- public Method newMethod(Class declaringClass,
+ public Method newMethod(Class<?> declaringClass,
String name,
- Class[] parameterTypes,
- Class returnType,
- Class[] checkedExceptions,
+ Class<?>[] parameterTypes,
+ Class<?> returnType,
+ Class<?>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -58,8 +58,8 @@
/** Creates a new java.lang.reflect.Constructor. Access checks as
per java.lang.reflect.AccessibleObject are not overridden. */
public <T> Constructor<T> newConstructor(Class<T> declaringClass,
- Class[] parameterTypes,
- Class[] checkedExceptions,
+ Class<?>[] parameterTypes,
+ Class<?>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -74,24 +74,24 @@
/** Gets the ConstructorAccessor object for a
java.lang.reflect.Constructor */
- public ConstructorAccessor getConstructorAccessor(Constructor c);
+ public ConstructorAccessor getConstructorAccessor(Constructor<?> c);
/** Sets the ConstructorAccessor object for a
java.lang.reflect.Constructor */
- public void setConstructorAccessor(Constructor c,
+ public void setConstructorAccessor(Constructor<?> c,
ConstructorAccessor accessor);
/** Gets the "slot" field from a Constructor (used for serialization) */
- public int getConstructorSlot(Constructor c);
+ public int getConstructorSlot(Constructor<?> c);
/** Gets the "signature" field from a Constructor (used for serialization) */
- public String getConstructorSignature(Constructor c);
+ public String getConstructorSignature(Constructor<?> c);
/** Gets the "annotations" field from a Constructor (used for serialization) */
- public byte[] getConstructorAnnotations(Constructor c);
+ public byte[] getConstructorAnnotations(Constructor<?> c);
/** Gets the "parameterAnnotations" field from a Constructor (used for serialization) */
- public byte[] getConstructorParameterAnnotations(Constructor c);
+ public byte[] getConstructorParameterAnnotations(Constructor<?> c);
//
// Copying routines, needed to quickly fabricate new Field,
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Wed Oct 07 08:38:43 2009 -0700
@@ -40,17 +40,17 @@
* @since 1.5
*/
class AnnotationInvocationHandler implements InvocationHandler, Serializable {
- private final Class type;
+ private final Class<? extends Annotation> type;
private final Map<String, Object> memberValues;
- AnnotationInvocationHandler(Class type, Map<String, Object> memberValues) {
+ AnnotationInvocationHandler(Class<? extends Annotation> type, Map<String, Object> memberValues) {
this.type = type;
this.memberValues = memberValues;
}
public Object invoke(Object proxy, Method method, Object[] args) {
String member = method.getName();
- Class[] paramTypes = method.getParameterTypes();
+ Class<?>[] paramTypes = method.getParameterTypes();
// Handle Object and Annotation methods
if (member.equals("equals") && paramTypes.length == 1 &&
@@ -84,7 +84,7 @@
* if Cloneable had a public clone method.
*/
private Object cloneArray(Object array) {
- Class type = array.getClass();
+ Class<?> type = array.getClass();
if (type == byte[].class) {
byte[] byteArray = (byte[])array;
@@ -151,7 +151,7 @@
* Translates a member value (in "dynamic proxy return form") into a string
*/
private static String memberValueToString(Object value) {
- Class type = value.getClass();
+ Class<?> type = value.getClass();
if (!type.isArray()) // primitive, string, class, enum const,
// or annotation
return value.toString();
@@ -229,7 +229,7 @@
* two members are identical object references.
*/
private static boolean memberValueEquals(Object v1, Object v2) {
- Class type = v1.getClass();
+ Class<?> type = v1.getClass();
// Check for primitive, string, class, enum const, annotation,
// or ExceptionProxy
@@ -301,7 +301,7 @@
* Computes hashCode of a member value (in "dynamic proxy return form")
*/
private static int memberValueHashCode(Object value) {
- Class type = value.getClass();
+ Class<?> type = value.getClass();
if (!type.isArray()) // primitive, string, class, enum const,
// or annotation
return value.hashCode();
@@ -340,11 +340,11 @@
return;
}
- Map<String, Class> memberTypes = annotationType.memberTypes();
+ Map<String, Class<?>> memberTypes = annotationType.memberTypes();
for (Map.Entry<String, Object> memberValue : memberValues.entrySet()) {
String name = memberValue.getKey();
- Class memberType = memberTypes.get(name);
+ Class<?> memberType = memberTypes.get(name);
if (memberType != null) { // i.e. member still exists
Object value = memberValue.getValue();
if (!(memberType.isInstance(value) ||
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java Wed Oct 07 08:38:43 2009 -0700
@@ -59,10 +59,10 @@
* @throws AnnotationFormatError if an annotation is found to be
* malformed.
*/
- public static Map<Class, Annotation> parseAnnotations(
+ public static Map<Class<? extends Annotation>, Annotation> parseAnnotations(
byte[] rawAnnotations,
ConstantPool constPool,
- Class container) {
+ Class<?> container) {
if (rawAnnotations == null)
return Collections.emptyMap();
@@ -76,17 +76,18 @@
}
}
- private static Map<Class, Annotation> parseAnnotations2(
+ private static Map<Class<? extends Annotation>, Annotation> parseAnnotations2(
byte[] rawAnnotations,
ConstantPool constPool,
- Class container) {
- Map<Class, Annotation> result = new LinkedHashMap<Class, Annotation>();
+ Class<?> container) {
+ Map<Class<? extends Annotation>, Annotation> result =
+ new LinkedHashMap<Class<? extends Annotation>, Annotation>();
ByteBuffer buf = ByteBuffer.wrap(rawAnnotations);
int numAnnotations = buf.getShort() & 0xFFFF;
for (int i = 0; i < numAnnotations; i++) {
Annotation a = parseAnnotation(buf, constPool, container, false);
if (a != null) {
- Class klass = a.annotationType();
+ Class<? extends Annotation> klass = a.annotationType();
AnnotationType type = AnnotationType.getInstance(klass);
if (type.retention() == RetentionPolicy.RUNTIME)
if (result.put(klass, a) != null)
@@ -123,7 +124,7 @@
public static Annotation[][] parseParameterAnnotations(
byte[] rawAnnotations,
ConstantPool constPool,
- Class container) {
+ Class<?> container) {
try {
return parseParameterAnnotations2(rawAnnotations, constPool, container);
} catch(BufferUnderflowException e) {
@@ -138,7 +139,7 @@
private static Annotation[][] parseParameterAnnotations2(
byte[] rawAnnotations,
ConstantPool constPool,
- Class container) {
+ Class<?> container) {
ByteBuffer buf = ByteBuffer.wrap(rawAnnotations);
int numParameters = buf.get() & 0xFF;
Annotation[][] result = new Annotation[numParameters][];
@@ -188,15 +189,15 @@
*/
private static Annotation parseAnnotation(ByteBuffer buf,
ConstantPool constPool,
- Class container,
+ Class<?> container,
boolean exceptionOnMissingAnnotationClass) {
int typeIndex = buf.getShort() & 0xFFFF;
- Class annotationClass = null;
+ Class<? extends Annotation> annotationClass = null;
String sig = "[unknown]";
try {
try {
sig = constPool.getUTF8At(typeIndex);
- annotationClass = parseSig(sig, container);
+ annotationClass = (Class<? extends Annotation>)parseSig(sig, container);
} catch (IllegalArgumentException ex) {
// support obsolete early jsr175 format class files
annotationClass = constPool.getClassAt(typeIndex);
@@ -223,7 +224,7 @@
return null;
}
- Map<String, Class> memberTypes = type.memberTypes();
+ Map<String, Class<?>> memberTypes = type.memberTypes();
Map<String, Object> memberValues =
new LinkedHashMap<String, Object>(type.memberDefaults());
@@ -231,7 +232,7 @@
for (int i = 0; i < numMembers; i++) {
int memberNameIndex = buf.getShort() & 0xFFFF;
String memberName = constPool.getUTF8At(memberNameIndex);
- Class memberType = memberTypes.get(memberName);
+ Class<?> memberType = memberTypes.get(memberName);
if (memberType == null) {
// Member is no longer present in annotation type; ignore it
@@ -252,7 +253,7 @@
* member -> value map.
*/
public static Annotation annotationForMap(
- Class type, Map<String, Object> memberValues)
+ Class<? extends Annotation> type, Map<String, Object> memberValues)
{
return (Annotation) Proxy.newProxyInstance(
type.getClassLoader(), new Class[] { type },
@@ -286,14 +287,15 @@
* The member must be of the indicated type. If it is not, this
* method returns an AnnotationTypeMismatchExceptionProxy.
*/
- public static Object parseMemberValue(Class memberType, ByteBuffer buf,
+ public static Object parseMemberValue(Class<?> memberType,
+ ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class<?> container) {
Object result = null;
int tag = buf.get();
switch(tag) {
case 'e':
- return parseEnumValue(memberType, buf, constPool, container);
+ return parseEnumValue((Class<? extends Enum<?>>)memberType, buf, constPool, container);
case 'c':
result = parseClassValue(buf, constPool, container);
break;
@@ -361,7 +363,7 @@
*/
private static Object parseClassValue(ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class<?> container) {
int classIndex = buf.getShort() & 0xFFFF;
try {
try {
@@ -379,7 +381,7 @@
}
}
- private static Class<?> parseSig(String sig, Class container) {
+ private static Class<?> parseSig(String sig, Class<?> container) {
if (sig.equals("V")) return void.class;
SignatureParser parser = SignatureParser.make();
TypeSignature typeSig = parser.parseTypeSig(sig);
@@ -389,7 +391,7 @@
Type result = reify.getResult();
return toClass(result);
}
- static Class toClass(Type o) {
+ static Class<?> toClass(Type o) {
if (o instanceof GenericArrayType)
return Array.newInstance(toClass(((GenericArrayType)o).getGenericComponentType()),
0)
@@ -409,9 +411,9 @@
* u2 const_name_index;
* } enum_const_value;
*/
- private static Object parseEnumValue(Class enumType, ByteBuffer buf,
+ private static Object parseEnumValue(Class<? extends Enum> enumType, ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class<?> container) {
int typeNameIndex = buf.getShort() & 0xFFFF;
String typeName = constPool.getUTF8At(typeNameIndex);
int constNameIndex = buf.getShort() & 0xFFFF;
@@ -449,12 +451,12 @@
* If the array values do not match arrayType, an
* AnnotationTypeMismatchExceptionProxy will be returned.
*/
- private static Object parseArray(Class arrayType,
+ private static Object parseArray(Class<?> arrayType,
ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class<?> container) {
int length = buf.getShort() & 0xFFFF; // Number of array components
- Class componentType = arrayType.getComponentType();
+ Class<?> componentType = arrayType.getComponentType();
if (componentType == byte.class) {
return parseByteArray(length, buf, constPool);
@@ -477,11 +479,11 @@
} else if (componentType == Class.class) {
return parseClassArray(length, buf, constPool, container);
} else if (componentType.isEnum()) {
- return parseEnumArray(length, componentType, buf,
+ return parseEnumArray(length, (Class<? extends Enum>)componentType, buf,
constPool, container);
} else {
assert componentType.isAnnotation();
- return parseAnnotationArray(length, componentType, buf,
+ return parseAnnotationArray(length, (Class <? extends Annotation>)componentType, buf,
constPool, container);
}
}
@@ -660,8 +662,8 @@
private static Object parseClassArray(int length,
ByteBuffer buf,
ConstantPool constPool,
- Class container) {
- Object[] result = new Class[length];
+ Class<?> container) {
+ Object[] result = new Class<?>[length];
boolean typeMismatch = false;
int tag = 0;
@@ -677,10 +679,10 @@
return typeMismatch ? exceptionProxy(tag) : result;
}
- private static Object parseEnumArray(int length, Class enumType,
+ private static Object parseEnumArray(int length, Class<? extends Enum> enumType,
ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class<?> container) {
Object[] result = (Object[]) Array.newInstance(enumType, length);
boolean typeMismatch = false;
int tag = 0;
@@ -698,10 +700,10 @@
}
private static Object parseAnnotationArray(int length,
- Class annotationType,
+ Class<? extends Annotation> annotationType,
ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class<?> container) {
Object[] result = (Object[]) Array.newInstance(annotationType, length);
boolean typeMismatch = false;
int tag = 0;
@@ -797,7 +799,7 @@
* it is needed.
*/
private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
- public static Annotation[] toArray(Map<Class, Annotation> annotations) {
+ public static Annotation[] toArray(Map<Class<? extends Annotation>, Annotation> annotations) {
return annotations.values().toArray(EMPTY_ANNOTATION_ARRAY);
}
}
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java Wed Oct 07 08:38:43 2009 -0700
@@ -45,7 +45,7 @@
* types. This matches the return value that must be used for a
* dynamic proxy, allowing for a simple isInstance test.
*/
- private final Map<String, Class> memberTypes = new HashMap<String,Class>();
+ private final Map<String, Class<?>> memberTypes = new HashMap<String,Class<?>>();
/**
* Member name -> default value mapping.
@@ -76,12 +76,12 @@
* does not represent a valid annotation type
*/
public static synchronized AnnotationType getInstance(
- Class annotationClass)
+ Class<? extends Annotation> annotationClass)
{
AnnotationType result = sun.misc.SharedSecrets.getJavaLangAccess().
getAnnotationType(annotationClass);
if (result == null)
- result = new AnnotationType((Class<?>) annotationClass);
+ result = new AnnotationType((Class<? extends Annotation>) annotationClass);
return result;
}
@@ -93,7 +93,7 @@
* @throw IllegalArgumentException if the specified class object for
* does not represent a valid annotation type
*/
- private AnnotationType(final Class<?> annotationClass) {
+ private AnnotationType(final Class<? extends Annotation> annotationClass) {
if (!annotationClass.isAnnotation())
throw new IllegalArgumentException("Not an annotation type");
@@ -110,7 +110,7 @@
if (method.getParameterTypes().length != 0)
throw new IllegalArgumentException(method + " has params");
String name = method.getName();
- Class type = method.getReturnType();
+ Class<?> type = method.getReturnType();
memberTypes.put(name, invocationHandlerReturnType(type));
members.put(name, method);
@@ -140,7 +140,7 @@
* the specified type (which is assumed to be a legal member type
* for an annotation).
*/
- public static Class invocationHandlerReturnType(Class type) {
+ public static Class<?> invocationHandlerReturnType(Class<?> type) {
// Translate primitives to wrappers
if (type == byte.class)
return Byte.class;
@@ -167,7 +167,7 @@
* Returns member types for this annotation type
* (member name -> type mapping).
*/
- public Map<String, Class> memberTypes() {
+ public Map<String, Class<?>> memberTypes() {
return memberTypes;
}
--- a/jdk/src/share/native/common/check_code.c Tue Oct 06 21:40:55 2009 -0700
+++ b/jdk/src/share/native/common/check_code.c Wed Oct 07 08:38:43 2009 -0700
@@ -338,7 +338,8 @@
int** code_lengths, unsigned char*** code);
static void verify_method(context_type *context, jclass cb, int index,
int code_length, unsigned char* code);
-static void free_all_code(int num_methods, int* lengths, unsigned char** code);
+static void free_all_code(context_type* context, int num_methods,
+ unsigned char** code);
static void verify_field(context_type *context, jclass cb, int index);
static void verify_opcode_operands (context_type *, unsigned int inumber, int offset);
@@ -813,11 +814,11 @@
/* Look at each method */
for (i = JVM_GetClassFieldsCount(env, cb); --i >= 0;)
verify_field(context, cb, i);
- num_methods = JVM_GetClassMethodsCount(env, cb);
- read_all_code(context, cb, num_methods, &code_lengths, &code);
- for (i = num_methods - 1; i >= 0; --i)
+ num_methods = JVM_GetClassMethodsCount(env, cb);
+ read_all_code(context, cb, num_methods, &code_lengths, &code);
+ for (i = num_methods - 1; i >= 0; --i)
verify_method(context, cb, i, code_lengths[i], code[i]);
- free_all_code(num_methods, code_lengths, code);
+ free_all_code(context, num_methods, code);
result = CC_OK;
} else {
result = context->err_code;
@@ -836,9 +837,6 @@
if (context->exceptions)
free(context->exceptions);
- if (context->code)
- free(context->code);
-
if (context->constant_types)
free(context->constant_types);
@@ -895,41 +893,42 @@
read_all_code(context_type* context, jclass cb, int num_methods,
int** lengths_addr, unsigned char*** code_addr)
{
- int* lengths = malloc(sizeof(int) * num_methods);
- unsigned char** code = malloc(sizeof(unsigned char*) * num_methods);
-
- *(lengths_addr) = lengths;
- *(code_addr) = code;
-
- if (lengths == 0 || code == 0) {
- CCout_of_memory(context);
- } else {
+ int* lengths;
+ unsigned char** code;
int i;
+
+ lengths = malloc(sizeof(int) * num_methods);
+ check_and_push(context, lengths, VM_MALLOC_BLK);
+
+ code = malloc(sizeof(unsigned char*) * num_methods);
+ check_and_push(context, code, VM_MALLOC_BLK);
+
+ *(lengths_addr) = lengths;
+ *(code_addr) = code;
+
for (i = 0; i < num_methods; ++i) {
- lengths[i] = JVM_GetMethodIxByteCodeLength(context->env, cb, i);
- if (lengths[i] != 0) {
- code[i] = malloc(sizeof(unsigned char) * (lengths[i] + 1));
- if (code[i] == NULL) {
- CCout_of_memory(context);
+ lengths[i] = JVM_GetMethodIxByteCodeLength(context->env, cb, i);
+ if (lengths[i] > 0) {
+ code[i] = malloc(sizeof(unsigned char) * (lengths[i] + 1));
+ check_and_push(context, code[i], VM_MALLOC_BLK);
+ JVM_GetMethodIxByteCode(context->env, cb, i, code[i]);
} else {
- JVM_GetMethodIxByteCode(context->env, cb, i, code[i]);
+ code[i] = NULL;
}
- } else {
- code[i] = NULL;
- }
}
- }
}
static void
-free_all_code(int num_methods, int* lengths, unsigned char** code)
+free_all_code(context_type* context, int num_methods, unsigned char** code)
{
int i;
for (i = 0; i < num_methods; ++i) {
- free(code[i]);
+ if (code[i] != NULL) {
+ pop_and_free(context);
+ }
}
- free(lengths);
- free(code);
+ pop_and_free(context); /* code */
+ pop_and_free(context); /* lengths */
}
/* Verify the code of one method */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/misc/BootClassLoaderHook/TestHook.java Wed Oct 07 08:38:43 2009 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.io.File;
+import java.util.TreeSet;
+import java.util.Set;
+import sun.misc.BootClassLoaderHook;
+
+/* @test
+ * @bug 6888802
+ * @summary Sanity test of BootClassLoaderHook interface
+ *
+ * @build TestHook
+ * @run main TestHook
+ */
+
+public class TestHook extends BootClassLoaderHook {
+
+ private static final TestHook hook = new TestHook();
+ private static Set<String> names = new TreeSet<String>();
+ private static final String LOGRECORD_CLASS =
+ "java.util.logging.LogRecord";
+ private static final String NONEXIST_RESOURCE =
+ "non.exist.resource";
+ private static final String LIBHELLO = "hello";
+
+ public static void main(String[] args) throws Exception {
+ BootClassLoaderHook.setHook(hook);
+ if (BootClassLoaderHook.getHook() == null) {
+ throw new RuntimeException("Null boot classloader hook ");
+ }
+
+ testHook();
+
+ if (!names.contains(LOGRECORD_CLASS)) {
+ throw new RuntimeException("loadBootstrapClass for " + LOGRECORD_CLASS + " not called");
+ }
+
+ if (!names.contains(NONEXIST_RESOURCE)) {
+ throw new RuntimeException("getBootstrapResource for " + NONEXIST_RESOURCE + " not called");
+ }
+ if (!names.contains(LIBHELLO)) {
+ throw new RuntimeException("loadLibrary for " + LIBHELLO + " not called");
+ }
+
+ Set<String> copy = new TreeSet<String>();
+ copy.addAll(names);
+ for (String s : copy) {
+ System.out.println(" Loaded " + s);
+ }
+
+ if (BootClassLoaderHook.getBootstrapPaths().length > 0) {
+ throw new RuntimeException("Unexpected returned value from getBootstrapPaths()");
+ }
+ }
+
+ private static void testHook() throws Exception {
+ Class.forName(LOGRECORD_CLASS);
+ ClassLoader.getSystemResource(NONEXIST_RESOURCE);
+ try {
+ System.loadLibrary(LIBHELLO);
+ } catch (UnsatisfiedLinkError e) {
+ }
+ }
+
+ public String loadBootstrapClass(String className) {
+ names.add(className);
+ return null;
+ }
+
+ public String getBootstrapResource(String resourceName) {
+ names.add(resourceName);
+ return null;
+ }
+
+ public boolean loadLibrary(String libname) {
+ names.add(libname);
+ return false;
+ }
+
+ public File[] getAdditionalBootstrapPaths() {
+ return new File[0];
+ }
+
+ public boolean isCurrentThreadPrefetching() {
+ return false;
+ }
+
+ public boolean prefetchFile(String name) {
+ return false;
+ }
+}