Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 46429 invoked from network); 6 Jan 2007 22:01:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jan 2007 22:01:01 -0000 Received: (qmail 65199 invoked by uid 500); 6 Jan 2007 22:01:08 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 65099 invoked by uid 500); 6 Jan 2007 22:01:08 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 65090 invoked by uid 99); 6 Jan 2007 22:01:08 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Jan 2007 14:01:08 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Jan 2007 14:00:59 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 25F1D1A981A; Sat, 6 Jan 2007 14:00:01 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r493587 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/java: java/lang/reflect/ org/apache/harmony/luni/internal/reflect/ Date: Sat, 06 Jan 2007 22:00:00 -0000 To: commits@harmony.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070106220001.25F1D1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tellison Date: Sat Jan 6 13:59:59 2007 New Revision: 493587 URL: http://svn.apache.org/viewvc?view=rev&rev=493587 Log: Code review of java.lang.reflect for clarity, formatting, comments, nls, etc. Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/AnnotatedElement.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericArrayType.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericDeclaration.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericSignatureFormatError.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/InvocationHandler.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/InvocationTargetException.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/MalformedParameterizedTypeException.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Member.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Modifier.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/ParameterizedType.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Proxy.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/ReflectPermission.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Type.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/TypeVariable.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/UndeclaredThrowableException.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/WildcardType.java harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyClassFile.java Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/AnnotatedElement.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/AnnotatedElement.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/AnnotatedElement.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/AnnotatedElement.java Sat Jan 6 13:59:59 2007 @@ -20,32 +20,27 @@ import java.lang.annotation.Annotation; /** - *

* An interface implemented an annotated element to enable reflective access to * annotation information. - *

* * @since 1.5 */ public interface AnnotatedElement { /** - *

* Gets the {@link Annotation} for this element for the annotation type * passed, if it exists. - *

* - * @param annotationType The Class instance of the annotation to search for. + * @param annotationType + * The Class instance of the annotation to search for. * @return The {@link Annotation} for this element or null. - * @throws NullPointerException if annotationType is - * null. + * @throws NullPointerException + * if annotationType is null. */ T getAnnotation(Class annotationType); /** - *

* Gets all {@link Annotation}s for this element. - *

* * @return An array of {@link Annotation}s, which may be empty, but never * null. @@ -53,10 +48,8 @@ Annotation[] getAnnotations(); /** - *

* Gets all {@link Annotation}s that are explicitly declared by this * element (not inherited). - *

* * @return An array of {@link Annotation}s, which may be empty, but never * null. @@ -64,16 +57,15 @@ Annotation[] getDeclaredAnnotations(); /** - *

* Determines if this element has an annotation for the annotation type * passed. - *

* - * @param annotationType The class instance of the annotation to search for. + * @param annotationType + * The class instance of the annotation to search for. * @return true if the annotation exists, otherwise * false. - * @throws NullPointerException if annotationType is - * null. + * @throws NullPointerException + * if annotationType is null. */ boolean isAnnotationPresent(Class annotationType); } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericArrayType.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericArrayType.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericArrayType.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericArrayType.java Sat Jan 6 13:59:59 2007 @@ -18,24 +18,21 @@ package java.lang.reflect; /** - *

* Represents an array type with a component type that is parameterized or a * type variable. - *

* * @since 1.5 */ public interface GenericArrayType extends Type { /** - *

* The {@link Type} that represents the component type of the array. - *

* * @return A {@link Type} instance. - * @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. + * @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 getGenericComponentType(); } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericDeclaration.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericDeclaration.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericDeclaration.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericDeclaration.java Sat Jan 6 13:59:59 2007 @@ -18,18 +18,18 @@ /** * Common interface for entities that have type variables. + * * @since 1.5 */ public interface GenericDeclaration { /** - * Answers the generic declared types in declaration order. - * If there are no generic types this method returns a zero - * length array. + * Answers the generic declared types in declaration order. If there are no + * generic types this method returns a zero length array. * * @return array of generic declared type variables. - * @throws GenericSignatureFormatError if the signature is malformed. + * @throws GenericSignatureFormatError + * if the signature is malformed. */ TypeVariable[] getTypeParameters(); - } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericSignatureFormatError.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericSignatureFormatError.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericSignatureFormatError.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/GenericSignatureFormatError.java Sat Jan 6 13:59:59 2007 @@ -18,14 +18,13 @@ package java.lang.reflect; /** - *

* Indicates that a malformed signature has been encountered via a reflective * method. - *

* * @since 1.5 */ public class GenericSignatureFormatError extends ClassFormatError { + private static final long serialVersionUID = 6709919147137911034L; public GenericSignatureFormatError() { Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/InvocationHandler.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/InvocationHandler.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/InvocationHandler.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/InvocationHandler.java Sat Jan 6 13:59:59 2007 @@ -17,7 +17,6 @@ package java.lang.reflect; - /** * Implementors of this interface decode and dispatch methods sent to proxy * instances. @@ -25,26 +24,27 @@ * @see Proxy */ public interface InvocationHandler { - /** - * Return the result of decoding and dispatching the method which was - * originally sent to the proxy instance. - * - * @param proxy - * the proxy instance which was the receiver of the method. - * @param method - * the Method invoked on the proxy instance. - * @param args - * an array of objects containing the parameters passed to the - * method, or null if no arguments are expected. primitive types - * are wrapped in the appropriate class. - * @return the result of executing the method - * - * @throws Throwable - * if an exception was thrown by the invoked method. The - * exception must match one of the declared exception types for - * the invoked method or any unchecked exception type. If not - * then an UndeclaredThrowableException is thrown. - */ - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable; + + /** + * Return the result of decoding and dispatching the method which was + * originally sent to the proxy instance. + * + * @param proxy + * the proxy instance which was the receiver of the method. + * @param method + * the Method invoked on the proxy instance. + * @param args + * an array of objects containing the parameters passed to the + * method, or null if no arguments are expected. primitive types + * are wrapped in the appropriate class. + * @return the result of executing the method + * + * @throws Throwable + * if an exception was thrown by the invoked method. The + * exception must match one of the declared exception types for + * the invoked method or any unchecked exception type. If not + * then an UndeclaredThrowableException is thrown. + */ + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable; } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/InvocationTargetException.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/InvocationTargetException.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/InvocationTargetException.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/InvocationTargetException.java Sat Jan 6 13:59:59 2007 @@ -17,69 +17,68 @@ package java.lang.reflect; - /** * This class provides a wrapper for an exception thrown by a Method or * Constructor invocation. * - * @see java.lang.reflect.Method#invoke - * @see java.lang.reflect.Constructor#newInstance + * @see Method#invoke + * @see Constructor#newInstance */ public class InvocationTargetException extends Exception { - private static final long serialVersionUID = 4085088731926701167L; + private static final long serialVersionUID = 4085088731926701167L; - private Throwable target; + private Throwable target; - /** - * Constructs a new instance of this class with its walkback filled in. - */ - protected InvocationTargetException() { - super((Throwable) null); - } - - /** - * Constructs a new instance of this class with its walkback and target - * exception filled in. - * - * @param exception - * Throwable The exception which occurred while running the - * Method or Constructor. - */ - public InvocationTargetException(Throwable exception) { - super(null, exception); - target = exception; - } - - /** - * Constructs a new instance of this class with its walkback, target - * exception and message filled in. - * - * @param detailMessage - * String The detail message for the exception. - * @param exception - * Throwable The exception which occurred while running the - * Method or Constructor. - */ - public InvocationTargetException(Throwable exception, String detailMessage) { - super(detailMessage, exception); - target = exception; - } - - /** - * Answers the exception which caused the receiver to be thrown. - */ - public Throwable getTargetException() { - return target; - } - - /** - * Answers the cause of this Throwable, or null if there is no cause. - * - * @return Throwable The receiver's cause. - */ - @Override + /** + * Constructs a new instance of this class with its walkback filled in. + */ + protected InvocationTargetException() { + super((Throwable) null); + } + + /** + * Constructs a new instance of this class with its walkback and target + * exception filled in. + * + * @param exception + * Throwable The exception which occurred while running the + * Method or Constructor. + */ + public InvocationTargetException(Throwable exception) { + super(null, exception); + target = exception; + } + + /** + * Constructs a new instance of this class with its walkback, target + * exception and message filled in. + * + * @param detailMessage + * String The detail message for the exception. + * @param exception + * Throwable The exception which occurred while running the + * Method or Constructor. + */ + public InvocationTargetException(Throwable exception, String detailMessage) { + super(detailMessage, exception); + target = exception; + } + + /** + * Answers the exception which caused the receiver to be thrown. + */ + public Throwable getTargetException() { + return target; + } + + /** + * Answers the cause of this Throwable, or null if there is no cause. + * + * @return Throwable The receiver's cause. + */ + @Override public Throwable getCause() { - return target; - } + return target; + } } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/MalformedParameterizedTypeException.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/MalformedParameterizedTypeException.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/MalformedParameterizedTypeException.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/MalformedParameterizedTypeException.java Sat Jan 6 13:59:59 2007 @@ -18,18 +18,17 @@ package java.lang.reflect; /** - *

* Indicates that a malformed parameterized type has been accessed by a * reflected method. - *

* * @since 1.5 */ public class MalformedParameterizedTypeException extends RuntimeException { + private static final long serialVersionUID = -5696557788586220964L; /** - *

Constructs an instance.

+ * Constructs an instance. */ public MalformedParameterizedTypeException() { super(); Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Member.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Member.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Member.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Member.java Sat Jan 6 13:59:59 2007 @@ -17,7 +17,6 @@ package java.lang.reflect; - /** * Implementors of this interface model a class member. * @@ -26,40 +25,42 @@ * @see Method */ public interface Member { - - public static final int PUBLIC = 0; - public static final int DECLARED = 1; + public static final int PUBLIC = 0; + + public static final int DECLARED = 1; - /** - * Return the {@link Class} associated with the class that defined this - * member. - * - * @return the declaring class - */ - @SuppressWarnings("unchecked") + /** + * Return the {@link Class} associated with the class that defined this + * member. + * + * @return the declaring class + */ + @SuppressWarnings("unchecked") Class getDeclaringClass(); - /** - * Return the modifiers for the member. The Modifier class should be used to - * decode the result. - * - * @return the modifiers - * @see java.lang.reflect.Modifier - */ - int getModifiers(); - - /** - * Return the name of the member. - * - * @return the name - */ - String getName(); - /** - *

Indicates whether or not this member is synthetic (artificially introduced by - * the compiler).

- * @return A value of true if synthetic, otherwise false. + * Return the modifiers for the member. The Modifier class should be used to + * decode the result. + * + * @return the modifiers + * @see java.lang.reflect.Modifier + */ + int getModifiers(); + + /** + * Return the name of the member. + * + * @return the name + */ + String getName(); + + /** + * Indicates whether or not this member is synthetic (artificially + * introduced by the compiler). + * + * @return A value of true if synthetic, otherwise + * false. */ boolean isSynthetic(); } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Modifier.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Modifier.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Modifier.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Modifier.java Sat Jan 6 13:59:59 2007 @@ -17,241 +17,254 @@ package java.lang.reflect; - /** * This class provides methods to decode class and member modifiers. * - * @see java.lang.Class#getModifiers() - * @see java.lang.reflect.Member#getModifiers() + * @see Class#getModifiers() + * @see Member#getModifiers() */ public class Modifier { - public static final int PUBLIC = 0x1; + public static final int PUBLIC = 0x1; - public static final int PRIVATE = 0x2; + public static final int PRIVATE = 0x2; - public static final int PROTECTED = 0x4; + public static final int PROTECTED = 0x4; - public static final int STATIC = 0x8; + public static final int STATIC = 0x8; - public static final int FINAL = 0x10; + public static final int FINAL = 0x10; - public static final int SYNCHRONIZED = 0x20; + public static final int SYNCHRONIZED = 0x20; - public static final int VOLATILE = 0x40; + public static final int VOLATILE = 0x40; - public static final int TRANSIENT = 0x80; + public static final int TRANSIENT = 0x80; - public static final int NATIVE = 0x100; + public static final int NATIVE = 0x100; - public static final int INTERFACE = 0x200; + public static final int INTERFACE = 0x200; - public static final int ABSTRACT = 0x400; + public static final int ABSTRACT = 0x400; - public static final int STRICT = 0x800; + public static final int STRICT = 0x800; // Non-public types required by Java 5 update to class file format static final int BRIDGE = 0x40; - + static final int VARARGS = 0x80; - + static final int SYNTHETIC = 0x1000; - + static final int ANNOTATION = 0x2000; - + static final int ENUM = 0x4000; - - public Modifier() { - } - - /** - * Return true if the specified modifiers contain the abstract - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the abstract modifier - */ - public static boolean isAbstract(int modifiers) { - return ((modifiers & ABSTRACT) != 0); - } - - /** - * Return true if the specified modifiers contain the final - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the final modifier - */ - public static boolean isFinal(int modifiers) { - return ((modifiers & FINAL) != 0); - } - - /** - * Return true if the specified modifiers contain the interface - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the interface modifier - */ - public static boolean isInterface(int modifiers) { - return ((modifiers & INTERFACE) != 0); - } - - /** - * Return true if the specified modifiers contain the native - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the native modifier - */ - public static boolean isNative(int modifiers) { - return ((modifiers & NATIVE) != 0); - } - - /** - * Return true if the specified modifiers contain the private - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the private modifier - */ - public static boolean isPrivate(int modifiers) { - return ((modifiers & PRIVATE) != 0); - } - - /** - * Return true if the specified modifiers contain the protected - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the protected modifier - */ - public static boolean isProtected(int modifiers) { - return ((modifiers & PROTECTED) != 0); - } - - /** - * Return true if the specified modifiers contain the public - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the abstract modifier - */ - public static boolean isPublic(int modifiers) { - return ((modifiers & PUBLIC) != 0); - } - - /** - * Return true if the specified modifiers contain the static - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the static modifier - */ - public static boolean isStatic(int modifiers) { - return ((modifiers & STATIC) != 0); - } - - /** - * Return true if the specified modifiers contain the strict - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the strict modifier - */ - public static boolean isStrict(int modifiers) { - return ((modifiers & STRICT) != 0); - } - - /** - * Return true if the specified modifiers contain the - * synchronized modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the synchronized modifier - */ - public static boolean isSynchronized(int modifiers) { - return ((modifiers & SYNCHRONIZED) != 0); - } - - /** - * Return true if the specified modifiers contain the transient - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the transient modifier - */ - public static boolean isTransient(int modifiers) { - return ((modifiers & TRANSIENT) != 0); - } - - /** - * Return true if the specified modifiers contain the volatile - * modifier, false otherwise. - * - * @param modifiers - * the modifiers to test - * @return if the modifiers contain the volatile modifier - */ - public static boolean isVolatile(int modifiers) { - return ((modifiers & VOLATILE) != 0); - } - - /** - * Answers a string containing the string representation of all modifiers - * present in the specified modifiers. - * - * Modifiers appear in the order specified by the Java Language - * Specification: - * public private protected abstract static final transient volatile native synchronized interface strict - * - * @param modifiers - * the modifiers to print - * @return a printable representation of the modifiers - */ - public static java.lang.String toString(int modifiers) { - StringBuffer buf; - - buf = new StringBuffer(); - - if (isPublic(modifiers)) - buf.append("public "); - if (isProtected(modifiers)) - buf.append("protected "); - if (isPrivate(modifiers)) - buf.append("private "); - if (isAbstract(modifiers)) - buf.append("abstract "); - if (isStatic(modifiers)) - buf.append("static "); - if (isFinal(modifiers)) - buf.append("final "); - if (isTransient(modifiers)) - buf.append("transient "); - if (isVolatile(modifiers)) - buf.append("volatile "); - if (isSynchronized(modifiers)) - buf.append("synchronized "); - if (isNative(modifiers)) - buf.append("native "); - if (isStrict(modifiers)) - buf.append("strictfp "); - if (isInterface(modifiers)) - buf.append("interface "); - if (buf.length() == 0) - return ""; - buf.setLength(buf.length() - 1); - return buf.toString(); - } + + public Modifier() { + } + + /** + * Return true if the specified modifiers contain the abstract + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the abstract modifier + */ + public static boolean isAbstract(int modifiers) { + return ((modifiers & ABSTRACT) != 0); + } + + /** + * Return true if the specified modifiers contain the final + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the final modifier + */ + public static boolean isFinal(int modifiers) { + return ((modifiers & FINAL) != 0); + } + + /** + * Return true if the specified modifiers contain the interface + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the interface modifier + */ + public static boolean isInterface(int modifiers) { + return ((modifiers & INTERFACE) != 0); + } + + /** + * Return true if the specified modifiers contain the native + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the native modifier + */ + public static boolean isNative(int modifiers) { + return ((modifiers & NATIVE) != 0); + } + + /** + * Return true if the specified modifiers contain the private + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the private modifier + */ + public static boolean isPrivate(int modifiers) { + return ((modifiers & PRIVATE) != 0); + } + + /** + * Return true if the specified modifiers contain the protected + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the protected modifier + */ + public static boolean isProtected(int modifiers) { + return ((modifiers & PROTECTED) != 0); + } + + /** + * Return true if the specified modifiers contain the public + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the abstract modifier + */ + public static boolean isPublic(int modifiers) { + return ((modifiers & PUBLIC) != 0); + } + + /** + * Return true if the specified modifiers contain the static + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the static modifier + */ + public static boolean isStatic(int modifiers) { + return ((modifiers & STATIC) != 0); + } + + /** + * Return true if the specified modifiers contain the strict + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the strict modifier + */ + public static boolean isStrict(int modifiers) { + return ((modifiers & STRICT) != 0); + } + + /** + * Return true if the specified modifiers contain the + * synchronized modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the synchronized modifier + */ + public static boolean isSynchronized(int modifiers) { + return ((modifiers & SYNCHRONIZED) != 0); + } + + /** + * Return true if the specified modifiers contain the transient + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the transient modifier + */ + public static boolean isTransient(int modifiers) { + return ((modifiers & TRANSIENT) != 0); + } + + /** + * Return true if the specified modifiers contain the volatile + * modifier, false otherwise. + * + * @param modifiers + * the modifiers to test + * @return if the modifiers contain the volatile modifier + */ + public static boolean isVolatile(int modifiers) { + return ((modifiers & VOLATILE) != 0); + } + + /** + * Answers a string containing the string representation of all modifiers + * present in the specified modifiers. + * + * Modifiers appear in the order specified by the Java Language + * Specification: + * public private protected abstract static final transient volatile native synchronized interface strict + * + * @param modifiers + * the modifiers to print + * @return a printable representation of the modifiers + */ + @SuppressWarnings("nls") + public static java.lang.String toString(int modifiers) { + StringBuffer buf; + + buf = new StringBuffer(); + + if (isPublic(modifiers)) { + buf.append("public "); + } + if (isProtected(modifiers)) { + buf.append("protected "); + } + if (isPrivate(modifiers)) { + buf.append("private "); + } + if (isAbstract(modifiers)) { + buf.append("abstract "); + } + if (isStatic(modifiers)) { + buf.append("static "); + } + if (isFinal(modifiers)) { + buf.append("final "); + } + if (isTransient(modifiers)) { + buf.append("transient "); + } + if (isVolatile(modifiers)) { + buf.append("volatile "); + } + if (isSynchronized(modifiers)) { + buf.append("synchronized "); + } + if (isNative(modifiers)) { + buf.append("native "); + } + if (isStrict(modifiers)) { + buf.append("strictfp "); + } + if (isInterface(modifiers)) { + buf.append("interface "); + } + if (buf.length() == 0) { + return ""; + } + buf.setLength(buf.length() - 1); + return buf.toString(); + } } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/ParameterizedType.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/ParameterizedType.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/ParameterizedType.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/ParameterizedType.java Sat Jan 6 13:59:59 2007 @@ -18,44 +18,39 @@ package java.lang.reflect; /** - *

* Represents a parameterized type. - *

* * @since 1.5 */ public interface ParameterizedType extends Type { + /** - *

* Gets the type arguments for this type. - *

* * @return An array of {@link Type}, which may be empty. - * @throws TypeNotPresentException if one of the type arguments can't be - * found. - * @throws MalformedParameterizedTypeException if one of the type arguments - * can't be instantiated for some reason. + * @throws TypeNotPresentException + * if one of the type arguments can't be found. + * @throws MalformedParameterizedTypeException + * if one of the type arguments can't be instantiated for some + * reason. */ Type[] getActualTypeArguments(); /** - *

* Gets the parent/owner type, if this type is an inner type, otherwise * null is returned if this is a top-level type. - *

* * @return An instance of {@link Type} or null. - * @throws TypeNotPresentException if one of the type arguments can't be - * found. - * @throws MalformedParameterizedTypeException if one of the type arguments - * can't be instantiated for some reason. + * @throws TypeNotPresentException + * if one of the type arguments can't be found. + * @throws MalformedParameterizedTypeException + * if one of the type arguments can't be instantiated for some + * reason. */ Type getOwnerType(); /** - *

* Gets the raw type of this type. - *

* * @return An instance of {@link Type}. */ Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Proxy.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Proxy.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Proxy.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Proxy.java Sat Jan 6 13:59:59 2007 @@ -30,219 +30,231 @@ /** * This class provides methods to creating dynamic proxy classes and instances. * - * @see java.lang.reflect.InvocationHandler + * @see InvocationHandler + * * @since 1.3 */ public class Proxy implements Serializable { - private static final long serialVersionUID = -2222568056686623797L; + private static final long serialVersionUID = -2222568056686623797L; - // maps class loaders to created classes by interface names - private static final Map>>> loaderCache = new WeakHashMap>>>(); + // maps class loaders to created classes by interface names + private static final Map>>> loaderCache = new WeakHashMap>>>(); - // to find previously created types - private static final Map, String> proxyCache = new WeakHashMap, String>(); + // to find previously created types + private static final Map, String> proxyCache = new WeakHashMap, String>(); - private static int NextClassNameIndex = 0; - - protected InvocationHandler h; - - private Proxy() { - } - - protected Proxy(InvocationHandler h) { - this.h = h; - } - - /** - * Return the dynamically build class for the given interfaces, build a new - * one when necessary. The order of the interfaces is important. - * - * The interfaces must be visible from the supplied class loader; no - * duplicates are permitted. All non-public interfaces must be defined in - * the same package. - * - * @param loader - * the class loader that will define the proxy class. - * @param interfaces - * an array of Class objects, each one identifying - * an interface that the new proxy must implement - * @return a proxy class that implements all of the interfaces referred to - * in the contents of interfaces. - * @exception IllegalArgumentException - * @exception NullPointerException - * if either interfaces or any of its elements - * are null. - */ - public static Class getProxyClass(ClassLoader loader, Class[] interfaces) - throws IllegalArgumentException { - // check that interfaces are a valid array of visible interfaces - if (interfaces == null) { + private static int NextClassNameIndex = 0; + + protected InvocationHandler h; + + private Proxy() { + } + + protected Proxy(InvocationHandler h) { + this.h = h; + } + + /** + * Return the dynamically build class for the given interfaces, build a new + * one when necessary. The order of the interfaces is important. + * + * The interfaces must be visible from the supplied class loader; no + * duplicates are permitted. All non-public interfaces must be defined in + * the same package. + * + * @param loader + * the class loader that will define the proxy class. + * @param interfaces + * an array of Class objects, each one identifying + * an interface that the new proxy must implement + * @return a proxy class that implements all of the interfaces referred to + * in the contents of interfaces. + * @exception IllegalArgumentException + * @exception NullPointerException + * if either interfaces or any of its elements + * are null. + */ + public static Class getProxyClass(ClassLoader loader, + Class[] interfaces) throws IllegalArgumentException { + // check that interfaces are a valid array of visible interfaces + if (interfaces == null) { throw new NullPointerException(); } - String commonPackageName = null; - for (int i = 0, length = interfaces.length; i < length; i++) { - Class next = interfaces[i]; - if (next == null) { + String commonPackageName = null; + for (int i = 0, length = interfaces.length; i < length; i++) { + Class next = interfaces[i]; + if (next == null) { throw new NullPointerException(); } - String name = next.getName(); - if (!next.isInterface()) { - throw new IllegalArgumentException(Msg.getString("K00ed", name)); - } - if (loader != next.getClassLoader()) { - try { - if (next != Class.forName(name, false, loader)) { + String name = next.getName(); + if (!next.isInterface()) { + throw new IllegalArgumentException(Msg.getString("K00ed", name)); //$NON-NLS-1$ + } + if (loader != next.getClassLoader()) { + try { + if (next != Class.forName(name, false, loader)) { throw new IllegalArgumentException(Msg.getString( - "K00ee", name)); + "K00ee", name)); //$NON-NLS-1$ } - } catch (ClassNotFoundException ex) { - throw new IllegalArgumentException(Msg.getString("K00ee", - name)); - } - } - for (int j = i + 1; j < length; j++) { + } catch (ClassNotFoundException ex) { + throw new IllegalArgumentException(Msg.getString("K00ee", //$NON-NLS-1$ + name)); + } + } + for (int j = i + 1; j < length; j++) { if (next == interfaces[j]) { - throw new IllegalArgumentException(Msg.getString("K00ef", - name)); + throw new IllegalArgumentException(Msg.getString("K00ef", //$NON-NLS-1$ + name)); } } - if (!Modifier.isPublic(next.getModifiers())) { - int last = name.lastIndexOf('.'); - String p = last == -1 ? "" : name.substring(0, last); - if (commonPackageName == null) { + if (!Modifier.isPublic(next.getModifiers())) { + int last = name.lastIndexOf('.'); + String p = last == -1 ? "" : name.substring(0, last); //$NON-NLS-1$ + if (commonPackageName == null) { commonPackageName = p; } else if (!commonPackageName.equals(p)) { - throw new IllegalArgumentException(Msg.getString("K00f0")); + throw new IllegalArgumentException(Msg.getString("K00f0")); //$NON-NLS-1$ + } + } + } + + // search cache for matching proxy class using the class loader + synchronized (loaderCache) { + Map>> interfaceCache = loaderCache + .get(loader); + if (interfaceCache == null) { + loaderCache + .put( + loader, + (interfaceCache = new HashMap>>())); + } + + String interfaceKey = ""; //$NON-NLS-1$ + if (interfaces.length == 1) { + interfaceKey = interfaces[0].getName(); + } else { + StringBuilder names = new StringBuilder(); + for (int i = 0, length = interfaces.length; i < length; i++) { + names.append(interfaces[i].getName()); + names.append(' '); } - } - } + interfaceKey = names.toString(); + } - // search cache for matching proxy class using the class loader - synchronized (loaderCache) { - Map>> interfaceCache = loaderCache.get(loader); - if (interfaceCache == null) { - loaderCache.put(loader, (interfaceCache = new HashMap>>())); - } - - String interfaceKey = ""; - if (interfaces.length == 1) { - interfaceKey = interfaces[0].getName(); - } else { - StringBuilder names = new StringBuilder(); - for (int i = 0, length = interfaces.length; i < length; i++) { - names.append(interfaces[i].getName()); - names.append(' '); - } - interfaceKey = names.toString(); - } - - Class newClass; - WeakReference> ref = interfaceCache.get(interfaceKey); - if (ref == null) { - String nextClassName = "$Proxy" + NextClassNameIndex++; - if (commonPackageName != null) { - nextClassName = commonPackageName + "." + nextClassName; - } - byte[] classFileBytes = ProxyClassFile.generateBytes( - nextClassName, interfaces); - if (loader == null) { + Class newClass; + WeakReference> ref = interfaceCache.get(interfaceKey); + if (ref == null) { + String nextClassName = "$Proxy" + NextClassNameIndex++; //$NON-NLS-1$ + if (commonPackageName != null) { + nextClassName = commonPackageName + "." + nextClassName; //$NON-NLS-1$ + } + byte[] classFileBytes = ProxyClassFile.generateBytes( + nextClassName, interfaces); + if (loader == null) { loader = ClassLoader.getSystemClassLoader(); } - newClass = defineClassImpl(loader, nextClassName.replace('.', - '/'), 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)); - synchronized (proxyCache) { - proxyCache.put(newClass, ""); // the value is unused - } - } else { - newClass = ref.get(); - } - return newClass; - } - } - - /** - * Return an instance of the dynamically build class for the given - * interfaces that forwards methods to the specified invocation handler. - * - * The interfaces must be visible from the supplied class loader; no - * duplicates are permitted. All non-public interfaces must be defined in - * the same package. - * - * @param loader - * the class loader that will define the proxy class. - * @param interfaces - * the list of interfaces to implement. - * @param h - * the invocation handler for the forwarded methods. - * @return a new proxy object that delegates to the handler h - * @exception IllegalArgumentException - * @exception NullPointerException - * if the interfaces or any of its elements are null. - */ - public static Object newProxyInstance(ClassLoader loader, - Class[] interfaces, InvocationHandler h) - throws IllegalArgumentException { - if (h != null) { - try { - return getProxyClass(loader, interfaces).getConstructor( - new Class[] { InvocationHandler.class }).newInstance( - new Object[] { h }); - } catch (NoSuchMethodException ex) { - throw (InternalError)(new InternalError(ex.toString()).initCause(ex)); - } catch (IllegalAccessException ex) { - throw (InternalError)(new InternalError(ex.toString()).initCause(ex)); - } catch (InstantiationException ex) { - throw (InternalError)(new InternalError(ex.toString()).initCause(ex)); - } catch (InvocationTargetException ex) { - Throwable target = ex.getTargetException(); - throw (InternalError)(new InternalError(target.toString()).initCause(target)); - } - } - throw new NullPointerException(); - } - - /** - * Return whether the supplied class is a dynamically generated proxy class. - * - * @param cl - * the class. - * @return true if the class is a proxy class and false otherwise. - * @exception NullPointerException - * if the class is null. - */ - public static boolean isProxyClass(Class cl) { - if (cl != null) { - synchronized (proxyCache) { - return proxyCache.containsKey(cl); - } - } - throw new NullPointerException(); - } - - /** - * Return the proxy instance's invocation handler. - * - * @param proxy - * the proxy instance. - * @return the proxy's invocation handler object - * @exception IllegalArgumentException - * if the supplied proxy is not a proxy - * object. - */ - public static InvocationHandler getInvocationHandler(Object proxy) - throws IllegalArgumentException { - if (isProxyClass(proxy.getClass())) { + newClass = defineClassImpl(loader, nextClassName.replace('.', + '/'), 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)); + synchronized (proxyCache) { + // the value is unused + proxyCache.put(newClass, ""); //$NON-NLS-1$ + } + } else { + newClass = ref.get(); + } + return newClass; + } + } + + /** + * Return an instance of the dynamically build class for the given + * interfaces that forwards methods to the specified invocation handler. + * + * The interfaces must be visible from the supplied class loader; no + * duplicates are permitted. All non-public interfaces must be defined in + * the same package. + * + * @param loader + * the class loader that will define the proxy class. + * @param interfaces + * the list of interfaces to implement. + * @param h + * the invocation handler for the forwarded methods. + * @return a new proxy object that delegates to the handler h + * @exception IllegalArgumentException + * @exception NullPointerException + * if the interfaces or any of its elements are null. + */ + public static Object newProxyInstance(ClassLoader loader, + Class[] interfaces, InvocationHandler h) + throws IllegalArgumentException { + if (h == null) { + throw new NullPointerException(); + } + try { + return getProxyClass(loader, interfaces).getConstructor( + new Class[] { InvocationHandler.class }).newInstance( + new Object[] { h }); + } catch (NoSuchMethodException ex) { + throw (InternalError) (new InternalError(ex.toString()) + .initCause(ex)); + } catch (IllegalAccessException ex) { + throw (InternalError) (new InternalError(ex.toString()) + .initCause(ex)); + } catch (InstantiationException ex) { + throw (InternalError) (new InternalError(ex.toString()) + .initCause(ex)); + } catch (InvocationTargetException ex) { + Throwable target = ex.getTargetException(); + throw (InternalError) (new InternalError(target.toString()) + .initCause(target)); + } + } + + /** + * Return whether the supplied class is a dynamically generated proxy class. + * + * @param cl + * the class. + * @return true if the class is a proxy class and false otherwise. + * @exception NullPointerException + * if the class is null. + */ + public static boolean isProxyClass(Class cl) { + if (cl == null) { + throw new NullPointerException(); + } + synchronized (proxyCache) { + return proxyCache.containsKey(cl); + } + } + + /** + * Return the proxy instance's invocation handler. + * + * @param proxy + * the proxy instance. + * @return the proxy's invocation handler object + * @exception IllegalArgumentException + * if the supplied proxy is not a proxy + * object. + */ + public static InvocationHandler getInvocationHandler(Object proxy) + throws IllegalArgumentException { + + if (isProxyClass(proxy.getClass())) { return ((Proxy) proxy).h; } - throw new IllegalArgumentException(Msg.getString("K00f1")); - } + throw new IllegalArgumentException(Msg.getString("K00f1")); //$NON-NLS-1$ + } - private static native Class defineClassImpl(ClassLoader classLoader, - String className, byte[] classFileBytes); + private static native Class defineClassImpl(ClassLoader classLoader, + String className, byte[] classFileBytes); } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/ReflectPermission.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/ReflectPermission.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/ReflectPermission.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/ReflectPermission.java Sat Jan 6 13:59:59 2007 @@ -17,7 +17,6 @@ package java.lang.reflect; - import java.security.BasicPermission; /** @@ -29,25 +28,25 @@ private static final long serialVersionUID = 7412737110241507485L; /** - * Creates an instance of this class with given name. - * - * @param permissionName - * String the name of the new permission. - */ - public ReflectPermission(String permissionName) { - super(permissionName); - } + * Creates an instance of this class with given name. + * + * @param permissionName + * String the name of the new permission. + */ + public ReflectPermission(String permissionName) { + super(permissionName); + } - /** - * Creates an instance of this class with the given name and action list. - * The action list is ignored. - * - * @param name - * String the name of the new permission. - * @param actions - * String ignored. - */ - public ReflectPermission(String name, String actions) { - super(name, actions); - } + /** + * Creates an instance of this class with the given name and action list. + * The action list is ignored. + * + * @param name + * String the name of the new permission. + * @param actions + * String ignored. + */ + public ReflectPermission(String name, String actions) { + super(name, actions); + } } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Type.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Type.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Type.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/Type.java Sat Jan 6 13:59:59 2007 @@ -18,6 +18,7 @@ /** * Common interface for all Java types. + * * @since 1.5 */ public interface Type { Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/TypeVariable.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/TypeVariable.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/TypeVariable.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/TypeVariable.java Sat Jan 6 13:59:59 2007 @@ -17,9 +17,8 @@ package java.lang.reflect; /** - *

Represents a type variable.

- * - * @param + * Represents a type variable. + * * @since 1.5 */ public interface TypeVariable extends Type { @@ -28,10 +27,11 @@ * Answers the upper bounds of the type variable. * * @return array of type variable's upper bounds. - * @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. + * @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(); Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/UndeclaredThrowableException.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/UndeclaredThrowableException.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/UndeclaredThrowableException.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/UndeclaredThrowableException.java Sat Jan 6 13:59:59 2007 @@ -17,64 +17,62 @@ package java.lang.reflect; - /** * This class provides a wrapper for an unexpected exception thrown by an * InvocationHandler * * @see java.lang.reflect.InvocationHandler#invoke */ - public class UndeclaredThrowableException extends RuntimeException { - private static final long serialVersionUID = 330127114055056639L; + private static final long serialVersionUID = 330127114055056639L; - private Throwable undeclaredThrowable; + private Throwable undeclaredThrowable; - /** - * Constructs a new instance of this class with its walkback and target - * exception filled in. - * - * @param exception - * The exception which occurred while loading the class. - */ - public UndeclaredThrowableException(Throwable exception) { - super(); - this.undeclaredThrowable = exception; - initCause(exception); - } - - /** - * Constructs a new instance of this class with its walkback, target - * exception and message filled in. - * - * @param detailMessage - * String The detail message for the exception. - * @param exception - * Throwable The exception which occurred while loading the - * class. - */ - public UndeclaredThrowableException(Throwable exception, - String detailMessage) { - super(detailMessage); - this.undeclaredThrowable = exception; - initCause(exception); - } - - /** - * Answers the exception which caused the receiver to be thrown. - */ - public Throwable getUndeclaredThrowable() { - return undeclaredThrowable; - } - - /** - * Answers the cause of this Throwable, or null if there is no cause. - * - * @return Throwable The receiver's cause. - */ - @Override + /** + * Constructs a new instance of this class with its walkback and target + * exception filled in. + * + * @param exception + * The exception which occurred while loading the class. + */ + public UndeclaredThrowableException(Throwable exception) { + super(); + this.undeclaredThrowable = exception; + initCause(exception); + } + + /** + * Constructs a new instance of this class with its walkback, target + * exception and message filled in. + * + * @param detailMessage + * String The detail message for the exception. + * @param exception + * Throwable The exception which occurred while loading the + * class. + */ + public UndeclaredThrowableException(Throwable exception, + String detailMessage) { + super(detailMessage); + this.undeclaredThrowable = exception; + initCause(exception); + } + + /** + * Answers the exception which caused the receiver to be thrown. + */ + public Throwable getUndeclaredThrowable() { + return undeclaredThrowable; + } + + /** + * Answers the cause of this Throwable, or null if there is no cause. + * + * @return Throwable The receiver's cause. + */ + @Override public Throwable getCause() { - return undeclaredThrowable; - } + return undeclaredThrowable; + } } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/WildcardType.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/WildcardType.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/WildcardType.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/reflect/WildcardType.java Sat Jan 6 13:59:59 2007 @@ -18,40 +18,36 @@ package java.lang.reflect; /** - *

* Represents a wildcard type, such as ? or * ? extends Comparable. - *

* * @since 1.5 */ public interface WildcardType extends Type { /** - *

* Gets the array of types that represent the upper bounds of this type. The * default upper bound is {@link Object}. - *

* * @return An array of {@link Type} instances. - * @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. + * @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[] getUpperBounds(); /** - *

* Gets the array of types that represent the lower bounds of this type. The * default lower bound is null, in which case a empty array * is returned. - *

* * @return An array of {@link Type} instances. - * @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. + * @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[] getLowerBounds(); } Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyClassFile.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyClassFile.java?view=diff&rev=493587&r1=493586&r2=493587 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyClassFile.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/reflect/ProxyClassFile.java Sat Jan 6 13:59:59 2007 @@ -34,7 +34,7 @@ private static final int INCREMENT_SIZE = 250; - private static Method ObjectEqualsMethod;; + private static Method ObjectEqualsMethod; private static Method ObjectHashCodeMethod; @@ -164,14 +164,16 @@ int classNameIndex = constantPool.typeIndex(typeName); contents[contentsOffset++] = (byte) (classNameIndex >> 8); contents[contentsOffset++] = (byte) classNameIndex; - int superclassNameIndex = constantPool.typeIndex("java/lang/reflect/Proxy"); + int superclassNameIndex = constantPool + .typeIndex("java/lang/reflect/Proxy"); contents[contentsOffset++] = (byte) (superclassNameIndex >> 8); contents[contentsOffset++] = (byte) superclassNameIndex; int interfacesCount = interfaces.length; contents[contentsOffset++] = (byte) (interfacesCount >> 8); contents[contentsOffset++] = (byte) interfacesCount; for (int i = 0; i < interfacesCount; i++) { - int interfaceIndex = constantPool.typeIndex(interfaces[i].getName()); + int interfaceIndex = constantPool + .typeIndex(interfaces[i].getName()); contents[contentsOffset++] = (byte) (interfaceIndex >> 8); contents[contentsOffset++] = (byte) interfaceIndex; } @@ -207,7 +209,8 @@ throw new InternalError(); } } - writeUnsignedShort(constantPool.literalIndex(getConstantPoolName(ProxyConstructor))); + writeUnsignedShort(constantPool + .literalIndex(getConstantPoolName(ProxyConstructor))); writeUnsignedShort(1); // store just the code attribute writeUnsignedShort(constantPool.literalIndex(CodeName)); // save attribute_length(4), max_stack(2), max_locals(2), code_length(4) @@ -230,8 +233,10 @@ ProxyMethod pMethod = proxyMethods[i]; Method method = pMethod.method; writeUnsignedShort(AccPublic | AccFinal); - writeUnsignedShort(constantPool.literalIndex(method.getName().toCharArray())); - writeUnsignedShort(constantPool.literalIndex(getConstantPoolName(method))); + writeUnsignedShort(constantPool.literalIndex(method.getName() + .toCharArray())); + writeUnsignedShort(constantPool + .literalIndex(getConstantPoolName(method))); Class[] thrownsExceptions = pMethod.commonExceptions; int eLength = thrownsExceptions.length; if (eLength > 0) { @@ -244,7 +249,8 @@ writeUnsignedWord(eLength * 2 + 2); writeUnsignedShort(eLength); for (int e = 0; e < eLength; e++) { - writeUnsignedShort(constantPool.typeIndex(thrownsExceptions[e].getName())); + writeUnsignedShort(constantPool + .typeIndex(thrownsExceptions[e].getName())); } } else { writeUnsignedShort(1); // store just the code attribute @@ -264,8 +270,10 @@ try { ObjectEqualsMethod = Object.class.getMethod("equals", new Class[] { Object.class }); - ObjectHashCodeMethod = Object.class.getMethod("hashCode", new Class[0]); - ObjectToStringMethod = Object.class.getMethod("toString", new Class[0]); + ObjectHashCodeMethod = Object.class.getMethod("hashCode", + new Class[0]); + ObjectToStringMethod = Object.class.getMethod("toString", + new Class[0]); } catch (NoSuchMethodException ex) { throw new InternalError(); } @@ -285,8 +293,8 @@ allMethods.toArray(proxyMethods); } - private void findMethods(Class nextInterface, ArrayList allMethods, - HashSet> interfacesSeen) { + private void findMethods(Class nextInterface, + ArrayList allMethods, HashSet> interfacesSeen) { /* * add the nextInterface's methods to allMethods if an equivalent method * already exists then return types must be identical... don't replace @@ -319,8 +327,8 @@ int codeAttributeOffset = contentsOffset; int contentsLength = contents.length; if (contentsOffset + 20 + 100 >= contentsLength) { - System.arraycopy(contents, 0, - (contents = new byte[contentsLength + INCREMENT_SIZE]), 0, contentsLength); + System.arraycopy(contents, 0, (contents = new byte[contentsLength + + INCREMENT_SIZE]), 0, contentsLength); } writeUnsignedShort(constantPool.literalIndex(CodeName)); // leave space for attribute_length(4), max_stack(2), max_locals(2), @@ -356,8 +364,9 @@ writeUnsignedByte(OPC_invokeinterface); if (HandlerInvokeMethod == null) { try { - HandlerInvokeMethod = InvocationHandler.class.getMethod("invoke", new Class[] { - Object.class, Method.class, Object[].class }); + HandlerInvokeMethod = InvocationHandler.class.getMethod( + "invoke", new Class[] { Object.class, Method.class, + Object[].class }); } catch (NoSuchMethodException e) { throw new InternalError(); } @@ -402,7 +411,8 @@ writeUnsignedShort(0); writeUnsignedShort(codeEndIndex); writeUnsignedShort(codeEndIndex); - writeUnsignedShort(constantPool.typeIndex(checkedExceptions[i].getName())); + writeUnsignedShort(constantPool.typeIndex(checkedExceptions[i] + .getName())); } writeUnsignedShort(0); writeUnsignedShort(codeEndIndex); @@ -455,7 +465,8 @@ * aastore then 78 invokevirtual 59 * java.lang.Class.getMethod(Ljava.lang.String;[Ljava.lang.Class;)Ljava.lang.reflect.Method; */ - private void genCallGetMethod(Class receiverType, String selector, Class[] argTypes) { + private void genCallGetMethod(Class receiverType, String selector, + Class[] argTypes) { genCallClassForName(receiverType.getName()); writeLdc(selector); int length = argTypes.length; @@ -477,8 +488,8 @@ writeUnsignedByte(OPC_invokevirtual); if (ClassGetMethod == null) { try { - ClassGetMethod = Class.class.getMethod("getMethod", new Class[] { String.class, - Class[].class }); + ClassGetMethod = Class.class.getMethod("getMethod", + new Class[] { String.class, Class[].class }); } catch (NoSuchMethodException e) { throw new InternalError(); } @@ -638,9 +649,11 @@ writeUnsignedByte(OPC_return); } else { writeUnsignedByte(OPC_checkcast); - writeUnsignedShort(constantPool.typeIndex(typeWrapperName(type))); + writeUnsignedShort(constantPool + .typeIndex(typeWrapperName(type))); writeUnsignedByte(OPC_invokevirtual); - writeUnsignedShort(constantPool.literalIndex(typeAccessMethod(type))); + writeUnsignedShort(constantPool + .literalIndex(typeAccessMethod(type))); if (type == long.class) { writeUnsignedByte(OPC_lreturn); } else if (type == float.class) { @@ -727,7 +740,8 @@ private byte[] getBytes() { byte[] fullContents = new byte[headerOffset + contentsOffset]; System.arraycopy(header, 0, fullContents, 0, headerOffset); - System.arraycopy(contents, 0, fullContents, headerOffset, contentsOffset); + System.arraycopy(contents, 0, fullContents, headerOffset, + contentsOffset); return fullContents; } @@ -807,10 +821,12 @@ return Byte.class.getConstructor(new Class[] { byte.class }); } if (baseType == boolean.class) { - return Boolean.class.getConstructor(new Class[] { boolean.class }); + return Boolean.class + .getConstructor(new Class[] { boolean.class }); } if (baseType == char.class) { - return Character.class.getConstructor(new Class[] { char.class }); + return Character.class + .getConstructor(new Class[] { char.class }); } if (baseType == long.class) { return Long.class.getConstructor(new Class[] { long.class }); @@ -819,7 +835,8 @@ return Float.class.getConstructor(new Class[] { float.class }); } if (baseType == double.class) { - return Double.class.getConstructor(new Class[] { double.class }); + return Double.class + .getConstructor(new Class[] { double.class }); } } catch (NoSuchMethodException e) { throw new InternalError(); @@ -900,8 +917,8 @@ contents[contentsOffset++] = (byte) b; } catch (IndexOutOfBoundsException e) { int actualLength = contents.length; - System.arraycopy(contents, 0, (contents = new byte[actualLength + INCREMENT_SIZE]), - 0, actualLength); + System.arraycopy(contents, 0, (contents = new byte[actualLength + + INCREMENT_SIZE]), 0, actualLength); contents[contentsOffset - 1] = (byte) b; } }