You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2007/01/06 23:00:00 UTC
svn commit: r493587 - in
/harmony/enhanced/classlib/trunk/modules/luni/src/main/java:
java/lang/reflect/ org/apache/harmony/luni/internal/reflect/
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;
/**
- * <p>
* An interface implemented an annotated element to enable reflective access to
* annotation information.
- * </p>
*
* @since 1.5
*/
public interface AnnotatedElement {
/**
- * <p>
* Gets the {@link Annotation} for this element for the annotation type
* passed, if it exists.
- * </p>
*
- * @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 <code>null</code>.
- * @throws NullPointerException if <code>annotationType</code> is
- * <code>null</code>.
+ * @throws NullPointerException
+ * if <code>annotationType</code> is <code>null</code>.
*/
<T extends Annotation> T getAnnotation(Class<T> annotationType);
/**
- * <p>
* Gets all {@link Annotation}s for this element.
- * </p>
*
* @return An array of {@link Annotation}s, which may be empty, but never
* <code>null</code>.
@@ -53,10 +48,8 @@
Annotation[] getAnnotations();
/**
- * <p>
* Gets all {@link Annotation}s that are explicitly declared by this
* element (not inherited).
- * </p>
*
* @return An array of {@link Annotation}s, which may be empty, but never
* <code>null</code>.
@@ -64,16 +57,15 @@
Annotation[] getDeclaredAnnotations();
/**
- * <p>
* Determines if this element has an annotation for the annotation type
* passed.
- * </p>
*
- * @param annotationType The class instance of the annotation to search for.
+ * @param annotationType
+ * The class instance of the annotation to search for.
* @return <code>true</code> if the annotation exists, otherwise
* <code>false</code>.
- * @throws NullPointerException if <code>annotationType</code> is
- * <code>null</code>.
+ * @throws NullPointerException
+ * if <code>annotationType</code> is <code>null</code>.
*/
boolean isAnnotationPresent(Class<? extends Annotation> 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;
/**
- * <p>
* Represents an array type with a component type that is parameterized or a
* type variable.
- * </p>
*
* @since 1.5
*/
public interface GenericArrayType extends Type {
/**
- * <p>
* The {@link Type} that represents the component type of the array.
- * </p>
*
* @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;
/**
- * <p>
* Indicates that a malformed signature has been encountered via a reflective
* method.
- * </p>
*
* @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;
/**
- * <p>
* Indicates that a malformed parameterized type has been accessed by a
* reflected method.
- * </p>
*
* @since 1.5
*/
public class MalformedParameterizedTypeException extends RuntimeException {
+
private static final long serialVersionUID = -5696557788586220964L;
/**
- * <p>Constructs an instance.</p>
+ * 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();
-
/**
- * <p>Indicates whether or not this member is synthetic (artificially introduced by
- * the compiler).</p>
- * @return A value of <code>true</code> if synthetic, otherwise <code>false</code>.
+ * 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 <code>true</code> if synthetic, otherwise
+ * <code>false</code>.
*/
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 <code>abstract</code>
- * 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 <code>final</code>
- * 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 <code>interface</code>
- * 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 <code>native</code>
- * 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 <code>private</code>
- * 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 <code>protected</code>
- * 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 <code>public</code>
- * 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 <code>static</code>
- * 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 <code>strict</code>
- * 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
- * <code>synchronized</code> 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 <code>transient</code>
- * 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 <code>volatile</code>
- * 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:
- * <code>public private protected abstract static final transient volatile native synchronized interface strict</code>
- *
- * @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 <code>abstract</code>
+ * 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 <code>final</code>
+ * 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 <code>interface</code>
+ * 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 <code>native</code>
+ * 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 <code>private</code>
+ * 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 <code>protected</code>
+ * 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 <code>public</code>
+ * 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 <code>static</code>
+ * 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 <code>strict</code>
+ * 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
+ * <code>synchronized</code> 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 <code>transient</code>
+ * 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 <code>volatile</code>
+ * 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:
+ * <code>public private protected abstract static final transient volatile native synchronized interface strict</code>
+ *
+ * @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;
/**
- * <p>
* Represents a parameterized type.
- * </p>
*
* @since 1.5
*/
public interface ParameterizedType extends Type {
+
/**
- * <p>
* Gets the type arguments for this type.
- * </p>
*
* @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();
/**
- * <p>
* Gets the parent/owner type, if this type is an inner type, otherwise
* <code>null</code> is returned if this is a top-level type.
- * </p>
*
* @return An instance of {@link Type} or <code>null</code>.
- * @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();
/**
- * <p>
* Gets the raw type of this type.
- * </p>
*
* @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<ClassLoader, Map<String, WeakReference<Class<?>>>> loaderCache = new WeakHashMap<ClassLoader, Map<String, WeakReference<Class<?>>>>();
+ // maps class loaders to created classes by interface names
+ private static final Map<ClassLoader, Map<String, WeakReference<Class<?>>>> loaderCache = new WeakHashMap<ClassLoader, Map<String, WeakReference<Class<?>>>>();
- // to find previously created types
- private static final Map<Class<?>, String> proxyCache = new WeakHashMap<Class<?>, String>();
+ // to find previously created types
+ private static final Map<Class<?>, String> proxyCache = new WeakHashMap<Class<?>, 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 <code>Class</code> 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 <code>interfaces</code>.
- * @exception IllegalArgumentException
- * @exception NullPointerException
- * if either <code>interfaces</code> or any of its elements
- * are <code>null</code>.
- */
- 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 <code>Class</code> 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 <code>interfaces</code>.
+ * @exception IllegalArgumentException
+ * @exception NullPointerException
+ * if either <code>interfaces</code> or any of its elements
+ * are <code>null</code>.
+ */
+ 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<String, WeakReference<Class<?>>> interfaceCache = loaderCache
+ .get(loader);
+ if (interfaceCache == null) {
+ loaderCache
+ .put(
+ loader,
+ (interfaceCache = new HashMap<String, WeakReference<Class<?>>>()));
+ }
+
+ 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<String, WeakReference<Class<?>>> interfaceCache = loaderCache.get(loader);
- if (interfaceCache == null) {
- loaderCache.put(loader, (interfaceCache = new HashMap<String, WeakReference<Class<?>>>()));
- }
-
- 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<Class<?>> 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<Class<?>> 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<Class<?>>(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 <code>h</code>
- * @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 <code>proxy</code> 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<Class<?>>(
+ 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 <code>h</code>
+ * @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 <code>proxy</code> 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;
/**
- * <p>Represents a type variable.</p>
- *
- * @param <D>
+ * Represents a type variable.
+ *
* @since 1.5
*/
public interface TypeVariable<D extends GenericDeclaration> 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;
/**
- * <p>
* Represents a wildcard type, such as <code>?</code> or
* <code>? extends Comparable</code>.
- * </p>
*
* @since 1.5
*/
public interface WildcardType extends Type {
/**
- * <p>
* Gets the array of types that represent the upper bounds of this type. The
* default upper bound is {@link Object}.
- * </p>
*
* @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();
/**
- * <p>
* Gets the array of types that represent the lower bounds of this type. The
* default lower bound is <code>null</code>, in which case a empty array
* is returned.
- * </p>
*
* @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<ProxyMethod> allMethods,
- HashSet<Class<?>> interfacesSeen) {
+ private void findMethods(Class<?> nextInterface,
+ ArrayList<ProxyMethod> allMethods, HashSet<Class<?>> 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;
}
}