Index: /luni/META-INF/MANIFEST.MF =================================================================== --- /luni/META-INF/MANIFEST.MF (revision 409859) +++ /luni/META-INF/MANIFEST.MF (working copy) @@ -6,7 +6,8 @@ Bundle-ClassPath: . Eclipse-JREBundle: true Eclipse-ExtensibleAPI: true -Import-Package: java.math, +Import-Package: java.lang.annotation, + java.math, java.nio, java.nio.channels, java.nio.channels.spi, @@ -19,9 +20,9 @@ java.util.zip, javax.net.ssl, org.apache.harmony.nio, - tests.support;resolution:=optional;hy_usage=test, - tests.support.resource;resolution:=optional;hy_usage=test, - tests.util;resolution:=optional;hy_usage=test + tests.support;hy_usage=test;resolution:=optional, + tests.support.resource;hy_usage=test;resolution:=optional, + tests.util;hy_usage=test;resolution:=optional Export-Package: java.io, java.lang, java.lang.ref, Index: /luni/src/main/java/java/lang/reflect/Proxy.java =================================================================== --- /luni/src/main/java/java/lang/reflect/Proxy.java (revision 409859) +++ /luni/src/main/java/java/lang/reflect/Proxy.java (working copy) @@ -15,7 +15,7 @@ package java.lang.reflect; - +import java.io.Serializable; import java.lang.ref.WeakReference; import java.util.HashMap; import java.util.Map; @@ -29,25 +29,28 @@ * This class provides methods to creating dynamic proxy classes and instances. * * @see java.lang.reflect.InvocationHandler + * @since 1.3 */ -public class Proxy implements java.io.Serializable { +public class Proxy implements Serializable { private static final long serialVersionUID = -2222568056686623797L; // maps class loaders to created classes by interface names - private static Map loaderCache = new WeakHashMap(); + private static final Map>>> loaderCache = new WeakHashMap>>>(); // to find previously created types - private static Map proxyCache = new WeakHashMap(); + private static final Map, String> proxyCache = new WeakHashMap, String>(); private static int NextClassNameIndex = 0; protected InvocationHandler h; private Proxy() { + super(); } protected Proxy(InvocationHandler h) { + super(); this.h = h; } @@ -71,7 +74,7 @@ * if either interfaces or any of its elements * are null. */ - public static Class getProxyClass(ClassLoader loader, Class[] interfaces) + public static Class getProxyClass(ClassLoader loader, Class[] interfaces) throws IllegalArgumentException { // check that interfaces are a valid array of visible interfaces if (interfaces == null) @@ -110,15 +113,15 @@ // search cache for matching proxy class using the class loader synchronized (loaderCache) { - Map interfaceCache = (Map) loaderCache.get(loader); + Map>> interfaceCache = loaderCache.get(loader); if (interfaceCache == null) - loaderCache.put(loader, (interfaceCache = new HashMap())); + loaderCache.put(loader, (interfaceCache = new HashMap>>())); String interfaceKey = ""; if (interfaces.length == 1) { interfaceKey = interfaces[0].getName(); } else { - StringBuffer names = new StringBuffer(); + StringBuilder names = new StringBuilder(); for (int i = 0, length = interfaces.length; i < length; i++) { names.append(interfaces[i].getName()); names.append(' '); @@ -126,9 +129,8 @@ interfaceKey = names.toString(); } - Class newClass; - WeakReference ref = (WeakReference) interfaceCache - .get(interfaceKey); + Class newClass; + WeakReference> ref = interfaceCache.get(interfaceKey); if (ref == null) { String nextClassName = "$Proxy" + NextClassNameIndex++; if (commonPackageName != null) @@ -141,12 +143,12 @@ '/'), classFileBytes); // Need a weak reference to the class so it can // be unloaded if the class loader is discarded - interfaceCache.put(interfaceKey, new WeakReference(newClass)); + interfaceCache.put(interfaceKey, new WeakReference>(newClass)); synchronized (proxyCache) { proxyCache.put(newClass, ""); // the value is unused } } else { - newClass = (Class) ref.get(); + newClass = ref.get(); } return newClass; } @@ -172,21 +174,22 @@ * if the interfaces or any of its elements are null. */ public static Object newProxyInstance(ClassLoader loader, - Class[] interfaces, InvocationHandler h) + Class[] interfaces, InvocationHandler h) throws IllegalArgumentException { if (h != null) { try { return getProxyClass(loader, interfaces).getConstructor( - new Class[] { InvocationHandler.class }).newInstance( + new Class[] { InvocationHandler.class }).newInstance( new Object[] { h }); } catch (NoSuchMethodException ex) { - throw new InternalError(ex.toString()); + throw (InternalError)(new InternalError(ex.toString()).initCause(ex)); } catch (IllegalAccessException ex) { - throw new InternalError(ex.toString()); + throw (InternalError)(new InternalError(ex.toString()).initCause(ex)); } catch (InstantiationException ex) { - throw new InternalError(ex.toString()); + throw (InternalError)(new InternalError(ex.toString()).initCause(ex)); } catch (InvocationTargetException ex) { - throw new InternalError(ex.getTargetException().toString()); + Throwable target = ex.getTargetException(); + throw (InternalError)(new InternalError(target.toString()).initCause(target)); } } throw new NullPointerException(); @@ -201,7 +204,7 @@ * @exception NullPointerException * if the class is null. */ - public static boolean isProxyClass(Class cl) { + public static boolean isProxyClass(Class cl) { if (cl != null) { synchronized (proxyCache) { return proxyCache.containsKey(cl); @@ -228,7 +231,7 @@ throw new IllegalArgumentException(Msg.getString("K00f1")); } - private static native Class defineClassImpl(ClassLoader classLoader, + private static native Class defineClassImpl(ClassLoader classLoader, String className, byte[] classFileBytes); } Index: /luni/src/main/java/java/lang/reflect/Type.java =================================================================== --- /luni/src/main/java/java/lang/reflect/Type.java (revision 409859) +++ /luni/src/main/java/java/lang/reflect/Type.java (working copy) @@ -17,6 +17,7 @@ /** * Common interface for all Java types. + * @since 1.5 */ public interface Type { // Empty Index: /luni/src/main/java/java/lang/reflect/GenericDeclaration.java =================================================================== --- /luni/src/main/java/java/lang/reflect/GenericDeclaration.java (revision 409859) +++ /luni/src/main/java/java/lang/reflect/GenericDeclaration.java (working copy) @@ -16,7 +16,8 @@ package java.lang.reflect; /** - * Common interface for entities that have type variables. + * Common interface for entities that have type variables. + * @since 1.5 */ public interface GenericDeclaration { Index: /luni/src/main/java/java/lang/reflect/TypeVariable.java =================================================================== --- /luni/src/main/java/java/lang/reflect/TypeVariable.java (revision 409859) +++ /luni/src/main/java/java/lang/reflect/TypeVariable.java (working copy) @@ -15,14 +15,22 @@ package java.lang.reflect; +/** + *

Represents a type variable.

+ * + * @param + * @since 1.5 + */ public interface TypeVariable extends Type { /** * Answers the upper bounds of the type variable. * * @return array of type variable's upper bounds. - * @throws MalformedParameterizedTypeException - * @throws TypeNotPresentException + * @throws TypeNotPresentException if the component type points to a missing + * type. + * @throws MalformedParameterizedTypeException if the component type points + * to a type that can't be instantiated for some reason. */ Type[] getBounds();