7077389: Reflection classes do not build with javac -Xlint:all -Werror
authorjjg
Mon, 15 Aug 2011 17:17:21 -0700
changeset 10342 ca0984bc9d32
parent 10341 3c12667717a7
child 10344 9a26a761ef07
7077389: Reflection classes do not build with javac -Xlint:all -Werror Reviewed-by: darcy Contributed-by: alexandre.boulgakov@oracle.com
jdk/make/java/java/Makefile
jdk/src/share/classes/java/lang/reflect/Array.java
jdk/src/share/classes/java/lang/reflect/Constructor.java
jdk/src/share/classes/java/lang/reflect/Executable.java
jdk/src/share/classes/java/lang/reflect/Field.java
jdk/src/share/classes/java/lang/reflect/Method.java
jdk/src/share/classes/java/lang/reflect/Proxy.java
jdk/src/share/classes/sun/reflect/AccessorGenerator.java
jdk/src/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java
jdk/src/share/classes/sun/reflect/ClassDefiner.java
jdk/src/share/classes/sun/reflect/ConstantPool.java
jdk/src/share/classes/sun/reflect/Label.java
jdk/src/share/classes/sun/reflect/MethodAccessorGenerator.java
jdk/src/share/classes/sun/reflect/NativeConstructorAccessorImpl.java
jdk/src/share/classes/sun/reflect/Reflection.java
jdk/src/share/classes/sun/reflect/ReflectionFactory.java
jdk/src/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java
jdk/src/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java
jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java
jdk/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java
jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java
jdk/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
jdk/src/share/classes/sun/reflect/generics/scope/AbstractScope.java
jdk/src/share/classes/sun/reflect/generics/scope/ConstructorScope.java
jdk/src/share/classes/sun/reflect/generics/tree/ClassSignature.java
jdk/src/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java
--- a/jdk/make/java/java/Makefile	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/make/java/java/Makefile	Mon Aug 15 17:17:21 2011 -0700
@@ -34,6 +34,7 @@
 PRODUCT = java
 SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
 SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
+JAVAC_MAX_WARNINGS=true
 include $(BUILDDIR)/common/Defs.gmk
 
 # windows compiler flags
--- a/jdk/src/share/classes/java/lang/reflect/Array.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Array.java	Mon Aug 15 17:17:21 2011 -0700
@@ -474,10 +474,10 @@
      * Private
      */
 
-    private static native Object newArray(Class componentType, int length)
+    private static native Object newArray(Class<?> componentType, int length)
         throws NegativeArraySizeException;
 
-    private static native Object multiNewArray(Class componentType,
+    private static native Object multiNewArray(Class<?> componentType,
         int[] dimensions)
         throws IllegalArgumentException, NegativeArraySizeException;
 
--- a/jdk/src/share/classes/java/lang/reflect/Constructor.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java	Mon Aug 15 17:17:21 2011 -0700
@@ -27,14 +27,12 @@
 
 import sun.reflect.ConstructorAccessor;
 import sun.reflect.Reflection;
-import sun.reflect.annotation.AnnotationParser;
 import sun.reflect.generics.repository.ConstructorRepository;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
 import sun.reflect.generics.scope.ConstructorScope;
 import java.lang.annotation.Annotation;
 import java.lang.annotation.AnnotationFormatError;
-import java.lang.reflect.Modifier;
 
 /**
  * {@code Constructor} provides information about, and access to, a single
@@ -184,6 +182,7 @@
      * @since 1.5
      */
     @Override
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     public TypeVariable<Constructor<T>>[] getTypeParameters() {
       if (getSignature() != null) {
         return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
@@ -197,7 +196,7 @@
      */
     @Override
     public Class<?>[] getParameterTypes() {
-        return (Class<?>[]) parameterTypes.clone();
+        return parameterTypes.clone();
     }
 
     /**
@@ -217,7 +216,7 @@
      */
     @Override
     public Class<?>[] getExceptionTypes() {
-        return (Class<?>[])exceptionTypes.clone();
+        return exceptionTypes.clone();
     }
 
 
@@ -392,7 +391,9 @@
         if (ca == null) {
             ca = acquireConstructorAccessor();
         }
-        return (T) ca.newInstance(initargs);
+        @SuppressWarnings("unchecked")
+        T inst = (T) ca.newInstance(initargs);
+        return inst;
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/reflect/Executable.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Executable.java	Mon Aug 15 17:17:21 2011 -0700
@@ -29,9 +29,6 @@
 import java.util.Map;
 import sun.reflect.annotation.AnnotationParser;
 import sun.reflect.generics.repository.ConstructorRepository;
-import sun.reflect.generics.factory.CoreReflectionFactory;
-import sun.reflect.generics.factory.GenericsFactory;
-import sun.reflect.generics.scope.ConstructorScope;
 
 /**
  * A shared superclass for the common functionality of {@link Method}
@@ -366,8 +363,8 @@
      * {@inheritDoc}
      * @throws NullPointerException  {@inheritDoc}
      */
-     @SuppressWarnings("unchecked")
-     public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+    @SuppressWarnings("unchecked")
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
         if (annotationClass == null)
             throw new NullPointerException();
 
--- a/jdk/src/share/classes/java/lang/reflect/Field.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java	Mon Aug 15 17:17:21 2011 -0700
@@ -1012,6 +1012,7 @@
      * @throws NullPointerException {@inheritDoc}
      * @since 1.5
      */
+    @SuppressWarnings("unchecked")
     public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
         if (annotationClass == null)
             throw new NullPointerException();
--- a/jdk/src/share/classes/java/lang/reflect/Method.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java	Mon Aug 15 17:17:21 2011 -0700
@@ -194,6 +194,7 @@
      * @since 1.5
      */
     @Override
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     public TypeVariable<Method>[] getTypeParameters() {
         if (getGenericSignature() != null)
             return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
@@ -246,7 +247,7 @@
      */
     @Override
     public Class<?>[] getParameterTypes() {
-        return (Class<?>[]) parameterTypes.clone();
+        return parameterTypes.clone();
     }
 
     /**
@@ -266,7 +267,7 @@
      */
     @Override
     public Class<?>[] getExceptionTypes() {
-        return (Class<?>[]) exceptionTypes.clone();
+        return exceptionTypes.clone();
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/reflect/Proxy.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Proxy.java	Mon Aug 15 17:17:21 2011 -0700
@@ -604,15 +604,12 @@
          * Invoke its constructor with the designated invocation handler.
          */
         try {
-            Constructor cons = cl.getConstructor(constructorParams);
+            Constructor<?> cons = cl.getConstructor(constructorParams);
             return cons.newInstance(new Object[] { h });
-        } catch (NoSuchMethodException e) {
-            throw new InternalError(e.toString());
-        } catch (IllegalAccessException e) {
-            throw new InternalError(e.toString());
-        } catch (InstantiationException e) {
-            throw new InternalError(e.toString());
-        } catch (InvocationTargetException e) {
+        } catch (NoSuchMethodException |
+                 IllegalAccessException |
+                 InstantiationException |
+                 InvocationTargetException e) {
             throw new InternalError(e.toString());
         }
     }
@@ -661,6 +658,6 @@
         return p.h;
     }
 
-    private static native Class defineClass0(ClassLoader loader, String name,
-                                             byte[] b, int off, int len);
+    private static native Class<?> defineClass0(ClassLoader loader, String name,
+                                                byte[] b, int off, int len);
 }
--- a/jdk/src/share/classes/sun/reflect/AccessorGenerator.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/AccessorGenerator.java	Mon Aug 15 17:17:21 2011 -0700
@@ -382,7 +382,7 @@
     /** Returns class name in "internal" form (i.e., '/' separators
         instead of '.') */
     protected static String getClassName
-        (Class c, boolean addPrefixAndSuffixForNonPrimitiveTypes)
+        (Class<?> c, boolean addPrefixAndSuffixForNonPrimitiveTypes)
     {
         if (c.isPrimitive()) {
             if (c == Boolean.TYPE) {
@@ -490,7 +490,7 @@
         }
     }
 
-    protected short indexForPrimitiveType(Class type) {
+    protected short indexForPrimitiveType(Class<?> type) {
         if (type == Boolean.TYPE) {
             return booleanIdx;
         } else if (type == Byte.TYPE) {
@@ -511,7 +511,7 @@
         throw new InternalError("Should have found primitive type");
     }
 
-    protected short ctorIndexForPrimitiveType(Class type) {
+    protected short ctorIndexForPrimitiveType(Class<?> type) {
         if (type == Boolean.TYPE) {
             return booleanCtorIdx;
         } else if (type == Byte.TYPE) {
@@ -534,7 +534,7 @@
 
     /** Returns true for widening or identity conversions for primitive
         types only */
-    protected static boolean canWidenTo(Class type, Class otherType) {
+    protected static boolean canWidenTo(Class<?> type, Class<?> otherType) {
         if (!type.isPrimitive()) {
             return false;
         }
@@ -609,8 +609,8 @@
         called and returned true. */
     protected static void emitWideningBytecodeForPrimitiveConversion
         (ClassFileAssembler cb,
-         Class fromType,
-         Class toType)
+         Class<?> fromType,
+         Class<?> toType)
     {
         // Note that widening conversions for integral types (i.e., "b2s",
         // "s2i") are no-ops since values on the Java stack are
@@ -650,7 +650,7 @@
         // Otherwise, was identity or no-op conversion. Fall through.
     }
 
-    protected short unboxingMethodForPrimitiveType(Class primType) {
+    protected short unboxingMethodForPrimitiveType(Class<?> primType) {
         if (primType == Boolean.TYPE) {
             return booleanUnboxIdx;
         } else if (primType == Byte.TYPE) {
@@ -671,7 +671,7 @@
         throw new InternalError("Illegal primitive type " + primType.getName());
     }
 
-    protected static final Class[] primitiveTypes = new Class[] {
+    protected static final Class<?>[] primitiveTypes = new Class<?>[] {
         Boolean.TYPE,
         Byte.TYPE,
         Character.TYPE,
@@ -683,11 +683,11 @@
     };
 
     /** We don't consider "Void" to be a primitive type */
-    protected static boolean isPrimitive(Class c) {
+    protected static boolean isPrimitive(Class<?> c) {
         return (c.isPrimitive() && c != Void.TYPE);
     }
 
-    protected int typeSizeInStackSlots(Class c) {
+    protected int typeSizeInStackSlots(Class<?> c) {
         if (c == Void.TYPE) {
             return 0;
         }
--- a/jdk/src/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java	Mon Aug 15 17:17:21 2011 -0700
@@ -32,9 +32,9 @@
     bootstrapping. */
 
 class BootstrapConstructorAccessorImpl extends ConstructorAccessorImpl {
-    private Constructor constructor;
+    private Constructor<?> constructor;
 
-    BootstrapConstructorAccessorImpl(Constructor c) {
+    BootstrapConstructorAccessorImpl(Constructor<?> c) {
         this.constructor = c;
     }
 
--- a/jdk/src/share/classes/sun/reflect/ClassDefiner.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/ClassDefiner.java	Mon Aug 15 17:17:21 2011 -0700
@@ -51,8 +51,8 @@
       than would otherwise be possible, decreasing run-time
       footprint. </P>
     */
-    static Class defineClass(String name, byte[] bytes, int off, int len,
-                             final ClassLoader parentClassLoader)
+    static Class<?> defineClass(String name, byte[] bytes, int off, int len,
+                                final ClassLoader parentClassLoader)
     {
         ClassLoader newLoader = AccessController.doPrivileged(
             new PrivilegedAction<ClassLoader>() {
--- a/jdk/src/share/classes/sun/reflect/ConstantPool.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/ConstantPool.java	Mon Aug 15 17:17:21 2011 -0700
@@ -34,8 +34,8 @@
 public class ConstantPool {
   // Number of entries in this constant pool (= maximum valid constant pool index)
   public int      getSize()                      { return getSize0            (constantPoolOop);        }
-  public Class    getClassAt         (int index) { return getClassAt0         (constantPoolOop, index); }
-  public Class    getClassAtIfLoaded (int index) { return getClassAtIfLoaded0 (constantPoolOop, index); }
+  public Class<?> getClassAt         (int index) { return getClassAt0         (constantPoolOop, index); }
+  public Class<?> getClassAtIfLoaded (int index) { return getClassAtIfLoaded0 (constantPoolOop, index); }
   // Returns either a Method or Constructor.
   // Static initializers are returned as Method objects.
   public Member   getMethodAt        (int index) { return getMethodAt0        (constantPoolOop, index); }
@@ -64,8 +64,8 @@
   private Object constantPoolOop;
 
   private native int      getSize0            (Object constantPoolOop);
-  private native Class    getClassAt0         (Object constantPoolOop, int index);
-  private native Class    getClassAtIfLoaded0 (Object constantPoolOop, int index);
+  private native Class<?> getClassAt0         (Object constantPoolOop, int index);
+  private native Class<?> getClassAtIfLoaded0 (Object constantPoolOop, int index);
   private native Member   getMethodAt0        (Object constantPoolOop, int index);
   private native Member   getMethodAtIfLoaded0(Object constantPoolOop, int index);
   private native Field    getFieldAt0         (Object constantPoolOop, int index);
--- a/jdk/src/share/classes/sun/reflect/Label.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/Label.java	Mon Aug 15 17:17:21 2011 -0700
@@ -25,7 +25,6 @@
 
 package sun.reflect;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -53,7 +52,7 @@
         short patchBCI;
         int   stackDepth;
     }
-    private List/*<PatchInfo>*/ patches = new ArrayList();
+    private List<PatchInfo> patches = new ArrayList<>();
 
     public Label() {
     }
@@ -67,8 +66,7 @@
     }
 
     public void bind() {
-        for (Iterator iter = patches.iterator(); iter.hasNext(); ) {
-            PatchInfo patch = (PatchInfo) iter.next();
+        for (PatchInfo patch : patches){
             short curBCI = patch.asm.getLength();
             short offset = (short) (curBCI - patch.instrBCI);
             patch.asm.emitShort(patch.patchBCI, offset);
--- a/jdk/src/share/classes/sun/reflect/MethodAccessorGenerator.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/MethodAccessorGenerator.java	Mon Aug 15 17:17:21 2011 -0700
@@ -25,10 +25,8 @@
 
 package sun.reflect;
 
-import java.lang.reflect.*;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import sun.misc.Unsafe;
 
 /** Generator for sun.reflect.MethodAccessor and
     sun.reflect.ConstructorAccessor objects using bytecodes to
@@ -50,11 +48,11 @@
     private static volatile int constructorSymnum = 0;
     private static volatile int serializationConstructorSymnum = 0;
 
-    private Class   declaringClass;
-    private Class[] parameterTypes;
-    private Class   returnType;
-    private boolean isConstructor;
-    private boolean forSerialization;
+    private Class<?>   declaringClass;
+    private Class<?>[] parameterTypes;
+    private Class<?>   returnType;
+    private boolean    isConstructor;
+    private boolean    forSerialization;
 
     private short targetMethodRef;
     private short invokeIdx;
@@ -67,11 +65,11 @@
     }
 
     /** This routine is not thread-safe */
-    public MethodAccessor generateMethod(Class declaringClass,
-                                         String name,
-                                         Class[] parameterTypes,
-                                         Class   returnType,
-                                         Class[] checkedExceptions,
+    public MethodAccessor generateMethod(Class<?> declaringClass,
+                                         String   name,
+                                         Class<?>[] parameterTypes,
+                                         Class<?>   returnType,
+                                         Class<?>[] checkedExceptions,
                                          int modifiers)
     {
         return (MethodAccessor) generate(declaringClass,
@@ -86,9 +84,9 @@
     }
 
     /** This routine is not thread-safe */
-    public ConstructorAccessor generateConstructor(Class declaringClass,
-                                                   Class[] parameterTypes,
-                                                   Class[] checkedExceptions,
+    public ConstructorAccessor generateConstructor(Class<?> declaringClass,
+                                                   Class<?>[] parameterTypes,
+                                                   Class<?>[] checkedExceptions,
                                                    int modifiers)
     {
         return (ConstructorAccessor) generate(declaringClass,
@@ -104,11 +102,11 @@
 
     /** This routine is not thread-safe */
     public SerializationConstructorAccessorImpl
-    generateSerializationConstructor(Class declaringClass,
-                                     Class[] parameterTypes,
-                                     Class[] checkedExceptions,
+    generateSerializationConstructor(Class<?> declaringClass,
+                                     Class<?>[] parameterTypes,
+                                     Class<?>[] checkedExceptions,
                                      int modifiers,
-                                     Class targetConstructorClass)
+                                     Class<?> targetConstructorClass)
     {
         return (SerializationConstructorAccessorImpl)
             generate(declaringClass,
@@ -123,15 +121,15 @@
     }
 
     /** This routine is not thread-safe */
-    private MagicAccessorImpl generate(final Class declaringClass,
+    private MagicAccessorImpl generate(final Class<?> declaringClass,
                                        String name,
-                                       Class[] parameterTypes,
-                                       Class   returnType,
-                                       Class[] checkedExceptions,
+                                       Class<?>[] parameterTypes,
+                                       Class<?>   returnType,
+                                       Class<?>[] checkedExceptions,
                                        int modifiers,
                                        boolean isConstructor,
                                        boolean forSerialization,
-                                       Class serializationTargetClass)
+                                       Class<?> serializationTargetClass)
     {
         ByteVector vec = ByteVectorFactory.create();
         asm = new ClassFileAssembler(vec);
@@ -340,7 +338,7 @@
         // Output class information for non-primitive parameter types
         nonPrimitiveParametersBaseIdx = add(asm.cpi(), S2);
         for (int i = 0; i < parameterTypes.length; i++) {
-            Class c = parameterTypes[i];
+            Class<?> c = parameterTypes[i];
             if (!isPrimitive(c)) {
                 asm.emitConstantPoolUTF8(getClassName(c, false));
                 asm.emitConstantPoolClass(asm.cpi());
@@ -403,10 +401,8 @@
                                  0,
                                  bytes.length,
                                  declaringClass.getClassLoader()).newInstance();
-                        } catch (InstantiationException e) {
-                            throw (InternalError)
-                                new InternalError().initCause(e);
-                        } catch (IllegalAccessException e) {
+                        } catch (InstantiationException |
+                                 IllegalAccessException e) {
                             throw (InternalError)
                                 new InternalError().initCause(e);
                         }
@@ -530,7 +526,7 @@
         byte count = 1; // both invokeinterface opcode's "count" as well as
         // num args of other invoke bytecodes
         for (int i = 0; i < parameterTypes.length; i++) {
-            Class paramType = parameterTypes[i];
+            Class<?> paramType = parameterTypes[i];
             count += (byte) typeSizeInStackSlots(paramType);
             if (nextParamLabel != null) {
                 nextParamLabel.bind();
@@ -577,7 +573,7 @@
                 nextParamLabel = new Label();
 
                 for (int j = 0; j < primitiveTypes.length; j++) {
-                    Class c = primitiveTypes[j];
+                    Class<?> c = primitiveTypes[j];
                     if (canWidenTo(c, paramType)) {
                         if (l != null) {
                             l.bind();
--- a/jdk/src/share/classes/sun/reflect/NativeConstructorAccessorImpl.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/NativeConstructorAccessorImpl.java	Mon Aug 15 17:17:21 2011 -0700
@@ -31,11 +31,11 @@
     afterward, switches to bytecode-based implementation */
 
 class NativeConstructorAccessorImpl extends ConstructorAccessorImpl {
-    private Constructor c;
+    private Constructor<?> c;
     private DelegatingConstructorAccessorImpl parent;
     private int numInvocations;
 
-    NativeConstructorAccessorImpl(Constructor c) {
+    NativeConstructorAccessorImpl(Constructor<?> c) {
         this.c = c;
     }
 
@@ -61,7 +61,7 @@
         this.parent = parent;
     }
 
-    private static native Object newInstance0(Constructor c, Object[] args)
+    private static native Object newInstance0(Constructor<?> c, Object[] args)
         throws InstantiationException,
                IllegalArgumentException,
                InvocationTargetException;
--- a/jdk/src/share/classes/sun/reflect/Reflection.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/Reflection.java	Mon Aug 15 17:17:21 2011 -0700
@@ -26,7 +26,6 @@
 package sun.reflect;
 
 import java.lang.reflect.*;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -39,17 +38,17 @@
         view, where they are sensitive or they may contain VM-internal objects.
         These Maps are updated very rarely. Rather than synchronize on
         each access, we use copy-on-write */
-    private static volatile Map<Class,String[]> fieldFilterMap;
-    private static volatile Map<Class,String[]> methodFilterMap;
+    private static volatile Map<Class<?>,String[]> fieldFilterMap;
+    private static volatile Map<Class<?>,String[]> methodFilterMap;
 
     static {
-        Map<Class,String[]> map = new HashMap<Class,String[]>();
+        Map<Class<?>,String[]> map = new HashMap<Class<?>,String[]>();
         map.put(Reflection.class,
             new String[] {"fieldFilterMap", "methodFilterMap"});
         map.put(System.class, new String[] {"security"});
         fieldFilterMap = map;
 
-        methodFilterMap = new HashMap<Class,String[]>();
+        methodFilterMap = new HashMap<>();
     }
 
     /** Returns the class of the method <code>realFramesToSkip</code>
@@ -61,7 +60,7 @@
         java.lang.reflect.Method.invoke() and its implementation are
         completely ignored and do not count toward the number of "real"
         frames skipped. */
-    public static native Class getCallerClass(int realFramesToSkip);
+    public static native Class<?> getCallerClass(int realFramesToSkip);
 
     /** Retrieves the access flags written to the class file. For
         inner classes these flags may differ from those returned by
@@ -71,18 +70,18 @@
         to compatibility reasons; see 4471811. Only the values of the
         low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
         valid. */
-    private static native int getClassAccessFlags(Class c);
+    private static native int getClassAccessFlags(Class<?> c);
 
     /** A quick "fast-path" check to try to avoid getCallerClass()
         calls. */
-    public static boolean quickCheckMemberAccess(Class memberClass,
+    public static boolean quickCheckMemberAccess(Class<?> memberClass,
                                                  int modifiers)
     {
         return Modifier.isPublic(getClassAccessFlags(memberClass) & modifiers);
     }
 
-    public static void ensureMemberAccess(Class currentClass,
-                                          Class memberClass,
+    public static void ensureMemberAccess(Class<?> currentClass,
+                                          Class<?> memberClass,
                                           Object target,
                                           int modifiers)
         throws IllegalAccessException
@@ -101,13 +100,13 @@
         }
     }
 
-    public static boolean verifyMemberAccess(Class currentClass,
+    public static boolean verifyMemberAccess(Class<?> currentClass,
                                              // Declaring class of field
                                              // or method
-                                             Class  memberClass,
+                                             Class<?> memberClass,
                                              // May be NULL in case of statics
-                                             Object target,
-                                             int    modifiers)
+                                             Object   target,
+                                             int      modifiers)
     {
         // Verify that currentClass can access a field, method, or
         // constructor of memberClass, where that member's access bits are
@@ -162,7 +161,7 @@
 
         if (Modifier.isProtected(modifiers)) {
             // Additional test for protected members: JLS 6.6.2
-            Class targetClass = (target == null ? memberClass : target.getClass());
+            Class<?> targetClass = (target == null ? memberClass : target.getClass());
             if (targetClass != currentClass) {
                 if (!gotIsSameClassPackage) {
                     isSameClassPackage = isSameClassPackage(currentClass, memberClass);
@@ -179,7 +178,7 @@
         return true;
     }
 
-    private static boolean isSameClassPackage(Class c1, Class c2) {
+    private static boolean isSameClassPackage(Class<?> c1, Class<?> c2) {
         return isSameClassPackage(c1.getClassLoader(), c1.getName(),
                                   c2.getClassLoader(), c2.getName());
     }
@@ -234,8 +233,8 @@
         }
     }
 
-    static boolean isSubclassOf(Class queryClass,
-                                Class ofClass)
+    static boolean isSubclassOf(Class<?> queryClass,
+                                Class<?> ofClass)
     {
         while (queryClass != null) {
             if (queryClass == ofClass) {
@@ -247,31 +246,31 @@
     }
 
     // fieldNames must contain only interned Strings
-    public static synchronized void registerFieldsToFilter(Class containingClass,
+    public static synchronized void registerFieldsToFilter(Class<?> containingClass,
                                               String ... fieldNames) {
         fieldFilterMap =
             registerFilter(fieldFilterMap, containingClass, fieldNames);
     }
 
     // methodNames must contain only interned Strings
-    public static synchronized void registerMethodsToFilter(Class containingClass,
+    public static synchronized void registerMethodsToFilter(Class<?> containingClass,
                                               String ... methodNames) {
         methodFilterMap =
             registerFilter(methodFilterMap, containingClass, methodNames);
     }
 
-    private static Map<Class,String[]> registerFilter(Map<Class,String[]> map,
-            Class containingClass, String ... names) {
+    private static Map<Class<?>,String[]> registerFilter(Map<Class<?>,String[]> map,
+            Class<?> containingClass, String ... names) {
         if (map.get(containingClass) != null) {
             throw new IllegalArgumentException
                             ("Filter already registered: " + containingClass);
         }
-        map = new HashMap<Class,String[]>(map);
+        map = new HashMap<Class<?>,String[]>(map);
         map.put(containingClass, names);
         return map;
     }
 
-    public static Field[] filterFields(Class containingClass,
+    public static Field[] filterFields(Class<?> containingClass,
                                        Field[] fields) {
         if (fieldFilterMap == null) {
             // Bootstrapping
@@ -280,7 +279,7 @@
         return (Field[])filter(fields, fieldFilterMap.get(containingClass));
     }
 
-    public static Method[] filterMethods(Class containingClass, Method[] methods) {
+    public static Method[] filterMethods(Class<?> containingClass, Method[] methods) {
         if (methodFilterMap == null) {
             // Bootstrapping
             return methods;
--- a/jdk/src/share/classes/sun/reflect/ReflectionFactory.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/ReflectionFactory.java	Mon Aug 15 17:17:21 2011 -0700
@@ -161,7 +161,7 @@
         }
     }
 
-    public ConstructorAccessor newConstructorAccessor(Constructor c) {
+    public ConstructorAccessor newConstructorAccessor(Constructor<?> c) {
         checkInitted();
 
         Class<?> declaringClass = c.getDeclaringClass();
@@ -250,14 +250,14 @@
 
     /** Creates a new java.lang.reflect.Constructor. Access checks as
         per java.lang.reflect.AccessibleObject are not overridden. */
-    public Constructor newConstructor(Class<?> declaringClass,
-                                      Class<?>[] parameterTypes,
-                                      Class<?>[] checkedExceptions,
-                                      int modifiers,
-                                      int slot,
-                                      String signature,
-                                      byte[] annotations,
-                                      byte[] parameterAnnotations)
+    public Constructor<?> newConstructor(Class<?> declaringClass,
+                                         Class<?>[] parameterTypes,
+                                         Class<?>[] checkedExceptions,
+                                         int modifiers,
+                                         int slot,
+                                         String signature,
+                                         byte[] annotations,
+                                         byte[] parameterAnnotations)
     {
         return langReflectAccess().newConstructor(declaringClass,
                                                   parameterTypes,
@@ -281,13 +281,13 @@
 
     /** Gets the ConstructorAccessor object for a
         java.lang.reflect.Constructor */
-    public ConstructorAccessor getConstructorAccessor(Constructor c) {
+    public ConstructorAccessor getConstructorAccessor(Constructor<?> c) {
         return langReflectAccess().getConstructorAccessor(c);
     }
 
     /** Sets the ConstructorAccessor object for a
         java.lang.reflect.Constructor */
-    public void setConstructorAccessor(Constructor c,
+    public void setConstructorAccessor(Constructor<?> c,
                                        ConstructorAccessor accessor)
     {
         langReflectAccess().setConstructorAccessor(c, accessor);
@@ -320,8 +320,8 @@
     //
     //
 
-    public Constructor newConstructorForSerialization
-        (Class<?> classToInstantiate, Constructor constructorToCall)
+    public Constructor<?> newConstructorForSerialization
+        (Class<?> classToInstantiate, Constructor<?> constructorToCall)
     {
         // Fast path
         if (constructorToCall.getDeclaringClass() == classToInstantiate) {
@@ -334,18 +334,18 @@
                                              constructorToCall.getExceptionTypes(),
                                              constructorToCall.getModifiers(),
                                              constructorToCall.getDeclaringClass());
-        Constructor c = newConstructor(constructorToCall.getDeclaringClass(),
-                                       constructorToCall.getParameterTypes(),
-                                       constructorToCall.getExceptionTypes(),
-                                       constructorToCall.getModifiers(),
-                                       langReflectAccess().
-                                       getConstructorSlot(constructorToCall),
-                                       langReflectAccess().
-                                       getConstructorSignature(constructorToCall),
-                                       langReflectAccess().
-                                       getConstructorAnnotations(constructorToCall),
-                                       langReflectAccess().
-                                       getConstructorParameterAnnotations(constructorToCall));
+        Constructor<?> c = newConstructor(constructorToCall.getDeclaringClass(),
+                                          constructorToCall.getParameterTypes(),
+                                          constructorToCall.getExceptionTypes(),
+                                          constructorToCall.getModifiers(),
+                                          langReflectAccess().
+                                          getConstructorSlot(constructorToCall),
+                                          langReflectAccess().
+                                          getConstructorSignature(constructorToCall),
+                                          langReflectAccess().
+                                          getConstructorAnnotations(constructorToCall),
+                                          langReflectAccess().
+                                          getConstructorParameterAnnotations(constructorToCall));
         setConstructorAccessor(c, acc);
         return c;
     }
@@ -393,9 +393,7 @@
                         try {
                             inflationThreshold = Integer.parseInt(val);
                         } catch (NumberFormatException e) {
-                            throw (RuntimeException)
-                                new RuntimeException("Unable to parse property sun.reflect.inflationThreshold").
-                                    initCause(e);
+                            throw new RuntimeException("Unable to parse property sun.reflect.inflationThreshold", e);
                         }
                     }
 
--- a/jdk/src/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java	Mon Aug 15 17:17:21 2011 -0700
@@ -30,7 +30,7 @@
 
 class UnsafeFieldAccessorFactory {
     static FieldAccessor newFieldAccessor(Field field, boolean override) {
-        Class type = field.getType();
+        Class<?> type = field.getType();
         boolean isStatic = Modifier.isStatic(field.getModifiers());
         boolean isFinal = Modifier.isFinal(field.getModifiers());
         boolean isVolatile = Modifier.isVolatile(field.getModifiers());
--- a/jdk/src/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java	Mon Aug 15 17:17:21 2011 -0700
@@ -40,12 +40,15 @@
     static final Unsafe unsafe = Unsafe.getUnsafe();
 
     protected final Field   field;
-    protected final int     fieldOffset;
+    protected final long    fieldOffset;
     protected final boolean isFinal;
 
     UnsafeFieldAccessorImpl(Field field) {
         this.field = field;
-        fieldOffset = unsafe.fieldOffset(field);
+        if (Modifier.isStatic(field.getModifiers()))
+            fieldOffset = unsafe.staticFieldOffset(field);
+        else
+            fieldOffset = unsafe.objectFieldOffset(field);
         isFinal = Modifier.isFinal(field.getModifiers());
     }
 
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java	Mon Aug 15 17:17:21 2011 -0700
@@ -187,6 +187,7 @@
      * TypeNotPresentException if a referenced annotation type is not
      * available at runtime
      */
+    @SuppressWarnings("unchecked")
     private static Annotation parseAnnotation(ByteBuffer buf,
                                               ConstantPool constPool,
                                               Class<?> container,
@@ -200,7 +201,7 @@
                 annotationClass = (Class<? extends Annotation>)parseSig(sig, container);
             } catch (IllegalArgumentException ex) {
                 // support obsolete early jsr175 format class files
-                annotationClass = constPool.getClassAt(typeIndex);
+                annotationClass = (Class<? extends Annotation>)constPool.getClassAt(typeIndex);
             }
         } catch (NoClassDefFoundError e) {
             if (exceptionOnMissingAnnotationClass)
@@ -256,7 +257,7 @@
         Class<? extends Annotation> type, Map<String, Object> memberValues)
     {
         return (Annotation) Proxy.newProxyInstance(
-            type.getClassLoader(), new Class[] { type },
+            type.getClassLoader(), new Class<?>[] { type },
             new AnnotationInvocationHandler(type, memberValues));
     }
 
@@ -287,6 +288,7 @@
      * The member must be of the indicated type. If it is not, this
      * method returns an AnnotationTypeMismatchExceptionProxy.
      */
+    @SuppressWarnings("unchecked")
     public static Object parseMemberValue(Class<?> memberType,
                                           ByteBuffer buf,
                                           ConstantPool constPool,
@@ -411,6 +413,7 @@
      *           u2   const_name_index;
      *       } enum_const_value;
      */
+    @SuppressWarnings({"rawtypes", "unchecked"})
     private static Object parseEnumValue(Class<? extends Enum> enumType, ByteBuffer buf,
                                          ConstantPool constPool,
                                          Class<?> container) {
@@ -433,7 +436,7 @@
             return  Enum.valueOf(enumType, constName);
         } catch(IllegalArgumentException e) {
             return new EnumConstantNotPresentExceptionProxy(
-                (Class<? extends Enum>)enumType, constName);
+                (Class<? extends Enum<?>>)enumType, constName);
         }
     }
 
@@ -451,6 +454,7 @@
      * If the array values do not match arrayType, an
      * AnnotationTypeMismatchExceptionProxy will be returned.
      */
+    @SuppressWarnings("unchecked")
     private static Object parseArray(Class<?> arrayType,
                                      ByteBuffer buf,
                                      ConstantPool constPool,
@@ -479,7 +483,7 @@
         } else if (componentType == Class.class) {
             return parseClassArray(length, buf, constPool, container);
         } else if (componentType.isEnum()) {
-            return parseEnumArray(length, (Class<? extends Enum>)componentType, buf,
+            return parseEnumArray(length, (Class<? extends Enum<?>>)componentType, buf,
                                   constPool, container);
         } else {
             assert componentType.isAnnotation();
@@ -679,7 +683,7 @@
         return typeMismatch ? exceptionProxy(tag) : result;
     }
 
-    private static Object parseEnumArray(int length, Class<? extends Enum> enumType,
+    private static Object parseEnumArray(int length, Class<? extends Enum<?>> enumType,
                                          ByteBuffer buf,
                                          ConstantPool constPool,
                                          Class<?> container) {
--- a/jdk/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java	Mon Aug 15 17:17:21 2011 -0700
@@ -24,7 +24,6 @@
  */
 
 package sun.reflect.annotation;
-import java.lang.annotation.*;
 
 /**
  * ExceptionProxy for EnumConstantNotPresentException.
@@ -33,10 +32,10 @@
  * @since   1.5
  */
 public class EnumConstantNotPresentExceptionProxy extends ExceptionProxy {
-    Class<? extends Enum> enumType;
+    Class<? extends Enum<?>> enumType;
     String constName;
 
-    public EnumConstantNotPresentExceptionProxy(Class<? extends Enum> enumType,
+    public EnumConstantNotPresentExceptionProxy(Class<? extends Enum<?>> enumType,
                                                 String constName) {
         this.enumType = enumType;
         this.constName = constName;
--- a/jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java	Mon Aug 15 17:17:21 2011 -0700
@@ -157,7 +157,7 @@
     @Override
     public boolean equals(Object o) {
         if (o instanceof TypeVariable) {
-            TypeVariable that = (TypeVariable) o;
+            TypeVariable<?> that = (TypeVariable<?>) o;
 
             GenericDeclaration thatDecl = that.getGenericDeclaration();
             String thatName = that.getName();
--- a/jdk/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java	Mon Aug 15 17:17:21 2011 -0700
@@ -69,7 +69,7 @@
             // first, extract type parameter subtree(s) from AST
             FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
             // create array to store reified subtree(s)
-            TypeVariable[] tps = new TypeVariable[ftps.length];
+            TypeVariable<?>[] tps = new TypeVariable<?>[ftps.length];
             // reify all subtrees
             for (int i = 0; i < ftps.length; i++) {
                 Reifier r = getReifier(); // obtain visitor
--- a/jdk/src/share/classes/sun/reflect/generics/scope/AbstractScope.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/generics/scope/AbstractScope.java	Mon Aug 15 17:17:21 2011 -0700
@@ -83,8 +83,8 @@
      * @return the requested type variable, if found
      */
     public TypeVariable<?> lookup(String name) {
-        TypeVariable[] tas = getRecvr().getTypeParameters();
-        for (TypeVariable/*<?>*/ tv : tas) {
+        TypeVariable<?>[] tas = getRecvr().getTypeParameters();
+        for (TypeVariable<?> tv : tas) {
             if (tv.getName().equals(name)) {return tv;}
         }
         return getEnclosingScope().lookup(name);
--- a/jdk/src/share/classes/sun/reflect/generics/scope/ConstructorScope.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/generics/scope/ConstructorScope.java	Mon Aug 15 17:17:21 2011 -0700
@@ -32,10 +32,10 @@
  * This class represents the scope containing the type variables of
  * a constructor.
  */
-public class ConstructorScope extends AbstractScope<Constructor> {
+public class ConstructorScope extends AbstractScope<Constructor<?>> {
 
     // constructor is private to enforce use of factory method
-    private ConstructorScope(Constructor c){
+    private ConstructorScope(Constructor<?> c){
         super(c);
     }
 
@@ -61,7 +61,7 @@
      * @param m - A Constructor whose scope we want to obtain
      * @return The type-variable scope for the constructor m
      */
-    public static ConstructorScope make(Constructor c) {
+    public static ConstructorScope make(Constructor<?> c) {
         return new ConstructorScope(c);
     }
 }
--- a/jdk/src/share/classes/sun/reflect/generics/tree/ClassSignature.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/generics/tree/ClassSignature.java	Mon Aug 15 17:17:21 2011 -0700
@@ -52,5 +52,5 @@
     public ClassTypeSignature getSuperclass(){return superclass;}
     public ClassTypeSignature[] getSuperInterfaces(){return superInterfaces;}
 
-    public void accept(Visitor v){v.visitClassSignature(this);}
+    public void accept(Visitor<?> v){v.visitClassSignature(this);}
 }
--- a/jdk/src/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java	Wed Aug 17 12:10:53 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java	Mon Aug 15 17:17:21 2011 -0700
@@ -57,5 +57,5 @@
     public ReturnType getReturnType(){return returnType;}
     public FieldTypeSignature[] getExceptionTypes(){return exceptionTypes;}
 
-    public void accept(Visitor v){v.visitMethodTypeSignature(this);}
+    public void accept(Visitor<?> v){v.visitMethodTypeSignature(this);}
 }