Tidy up the Class class

Remove unused imports and javadoc warnings.

Remove unused methods and an AnnotationType field which
is not used on Android.

Test: make test-art-host / boot a device
Change-Id: I82806bdf85cb198b3cbf004bd79a70dc20353eea
diff --git a/ojluni/src/main/java/java/lang/Class.java b/ojluni/src/main/java/java/lang/Class.java
index 66a1917..44eadce 100644
--- a/ojluni/src/main/java/java/lang/Class.java
+++ b/ojluni/src/main/java/java/lang/Class.java
@@ -28,42 +28,24 @@
 
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Array;
-import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Member;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Constructor;
-import java.lang.reflect.GenericDeclaration;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.ref.SoftReference;
 import java.io.InputStream;
-import java.io.ObjectStreamField;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
-import java.util.LinkedList;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.Map;
 import java.util.HashMap;
-import sun.misc.Unsafe;
 import sun.reflect.CallerSensitive;
 import java.lang.annotation.Inherited;
 import java.lang.annotation.Annotation;
-import java.lang.reflect.Proxy;
-import sun.reflect.annotation.*;
-import sun.reflect.misc.ReflectUtil;
 
 import java.io.Serializable;
-import java.lang.reflect.AccessibleObject;
 import com.android.dex.Dex;
 import dalvik.system.VMStack;
 import libcore.reflect.InternalNames;
@@ -72,7 +54,6 @@
 import libcore.util.BasicLruCache;
 import libcore.util.CollectionUtils;
 import libcore.util.EmptyArray;
-import libcore.util.SneakyThrow;
 import java.util.Collections;
 
 /**
@@ -258,8 +239,6 @@
     /** Offset of the first virtual method defined in this class in the methods array. */
     private transient short virtualMethodsOffset;
 
-    private AnnotationType annotationType;
-
     private static final int ANNOTATION  = 0x00002000;
     private static final int ENUM        = 0x00004000;
     private static final int SYNTHETIC   = 0x00001000;
@@ -1760,7 +1739,6 @@
      * resolution checks first. If no fields exist, the list is not modified.
      *
      * @param publicOnly Whether to return only public fields.
-     * @param fields A list to populate with declared fields.
      * @hide
      */
     public native Field[] getDeclaredFieldsUnchecked(boolean publicOnly);
@@ -1819,7 +1797,6 @@
      * resolution checks first. If no methods exist, the list is not modified.
      *
      * @param publicOnly Whether to return only public methods.
-     * @param methods A list to populate with declared methods.
      * @hide
      */
     public native Method[] getDeclaredMethodsUnchecked(boolean publicOnly);
@@ -1867,8 +1844,6 @@
     /**
      * Returns the constructor with the given parameters if it is defined by this class;
      * {@code null} otherwise. This may return a non-public member.
-     *
-     * @param args the types of the parameters to the constructor.
      */
     private native Constructor<?>[] getDeclaredConstructorsInternal(boolean publicOnly);
 
@@ -2477,18 +2452,6 @@
      */
     private native boolean isDeclaredAnnotationPresent(Class<? extends Annotation> annotationClass);
 
-    // Annotation types cache their internal (AnnotationType) form
-
-    /** @hide */
-    public void setAnnotationType(AnnotationType type) {
-        annotationType = type;
-    }
-
-    /** @hide */
-    public AnnotationType getAnnotationType() {
-        return annotationType;
-    }
-
     private String getSignatureAttribute() {
         String[] annotation = getSignatureAnnotation();
         if (annotation == null) {
diff --git a/ojluni/src/main/java/sun/reflect/annotation/AnnotationType.java b/ojluni/src/main/java/sun/reflect/annotation/AnnotationType.java
deleted file mode 100644
index b833dc0..0000000
--- a/ojluni/src/main/java/sun/reflect/annotation/AnnotationType.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.reflect.annotation;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * Represents an annotation type at run time.  Used to type-check annotations
- * and apply member defaults.
- *
- * @author  Josh Bloch
- * @since   1.5
- */
-public class AnnotationType {
-    /**
-     * Member name -> type mapping. Note that primitive types
-     * are represented by the class objects for the corresponding wrapper
-     * 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<?>>();
-
-    /**
-     * Member name -> default value mapping.
-     */
-    private final Map<String, Object> memberDefaults =
-        new HashMap<String, Object>();
-
-    /**
-     * Member name -> Method object mapping. This (and its assoicated
-     * accessor) are used only to generate AnnotationTypeMismatchExceptions.
-     */
-    private final Map<String, Method> members = new HashMap<String, Method>();
-
-    /**
-     * The retention policy for this annotation type.
-     */
-    private RetentionPolicy retention = RetentionPolicy.RUNTIME;;
-
-    /**
-     * Whether this annotation type is inherited.
-     */
-    private boolean inherited = false;
-
-    /**
-     * Returns an AnnotationType instance for the specified annotation type.
-     *
-     * @throw IllegalArgumentException if the specified class object for
-     *     does not represent a valid annotation type
-     */
-    public static synchronized AnnotationType getInstance(
-        Class<? extends Annotation> annotationClass)
-    {
-        AnnotationType result = annotationClass.getAnnotationType();
-        if (result == null)
-            result = new AnnotationType((Class<? extends Annotation>) annotationClass);
-
-        return result;
-    }
-
-    /**
-     * Sole constructor.
-     *
-     * @param annotationClass the class object for the annotation type
-     * @throw IllegalArgumentException if the specified class object for
-     *     does not represent a valid annotation type
-     */
-    private AnnotationType(final Class<? extends Annotation> annotationClass) {
-        if (!annotationClass.isAnnotation())
-            throw new IllegalArgumentException("Not an annotation type");
-
-        Method[] methods =
-            AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
-                public Method[] run() {
-                    // Initialize memberTypes and defaultValues
-                    return annotationClass.getDeclaredMethods();
-                }
-            });
-
-
-        for (Method method :  methods) {
-            if (method.getParameterTypes().length != 0)
-                throw new IllegalArgumentException(method + " has params");
-            String name = method.getName();
-            Class<?> type = method.getReturnType();
-            memberTypes.put(name, invocationHandlerReturnType(type));
-            members.put(name, method);
-
-            Object defaultValue = method.getDefaultValue();
-            if (defaultValue != null)
-                memberDefaults.put(name, defaultValue);
-
-            members.put(name, method);
-        }
-
-        annotationClass.setAnnotationType(this);
-
-        // Initialize retention, & inherited fields.  Special treatment
-        // of the corresponding annotation types breaks infinite recursion.
-        if (annotationClass != Retention.class &&
-            annotationClass != Inherited.class) {
-            Retention ret = annotationClass.getAnnotation(Retention.class);
-            retention = (ret == null ? RetentionPolicy.CLASS : ret.value());
-            inherited = annotationClass.isAnnotationPresent(Inherited.class);
-        }
-    }
-
-    /**
-     * Returns the type that must be returned by the invocation handler
-     * of a dynamic proxy in order to have the dynamic proxy return
-     * the specified type (which is assumed to be a legal member type
-     * for an annotation).
-     */
-    public static Class<?> invocationHandlerReturnType(Class<?> type) {
-        // Translate primitives to wrappers
-        if (type == byte.class)
-            return Byte.class;
-        if (type == char.class)
-            return Character.class;
-        if (type == double.class)
-            return Double.class;
-        if (type == float.class)
-            return Float.class;
-        if (type == int.class)
-            return Integer.class;
-        if (type == long.class)
-            return Long.class;
-        if (type == short.class)
-            return Short.class;
-        if (type == boolean.class)
-            return Boolean.class;
-
-        // Otherwise, just return declared type
-        return type;
-    }
-
-    /**
-     * Returns member types for this annotation type
-     * (member name -> type mapping).
-     */
-    public Map<String, Class<?>> memberTypes() {
-        return memberTypes;
-    }
-
-    /**
-     * Returns members of this annotation type
-     * (member name -> associated Method object mapping).
-     */
-    public Map<String, Method> members() {
-        return members;
-    }
-
-    /**
-     * Returns the default values for this annotation type
-     * (Member name -> default value mapping).
-     */
-    public Map<String, Object> memberDefaults() {
-        return memberDefaults;
-    }
-
-    /**
-     * Returns the retention policy for this annotation type.
-     */
-    public RetentionPolicy retention() {
-        return retention;
-    }
-
-    /**
-     * Returns true if this this annotation type is inherited.
-     */
-    public boolean isInherited() {
-        return inherited;
-    }
-
-    /**
-     * For debugging.
-     */
-    public String toString() {
-        StringBuffer s = new StringBuffer("Annotation Type:" + "\n");
-        s.append("   Member types: " + memberTypes + "\n");
-        s.append("   Member defaults: " + memberDefaults + "\n");
-        s.append("   Retention policy: " + retention + "\n");
-        s.append("   Inherited: " + inherited);
-        return s.toString();
-    }
-}
diff --git a/openjdk_java_files.mk b/openjdk_java_files.mk
index 12be9d2..b38f86e 100644
--- a/openjdk_java_files.mk
+++ b/openjdk_java_files.mk
@@ -1416,7 +1416,6 @@
     ojluni/src/main/java/sun/nio/fs/UnixUriUtils.java \
     ojluni/src/main/java/sun/nio/fs/UnixUserPrincipals.java \
     ojluni/src/main/java/sun/nio/fs/Util.java \
-    ojluni/src/main/java/sun/reflect/annotation/AnnotationType.java \
     ojluni/src/main/java/sun/reflect/ConstructorAccessor.java \
     ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java \
     ojluni/src/main/java/sun/reflect/Reflection.java \