summaryrefslogtreecommitdiff
path: root/libjava/classpath/vm/reference/java/lang/reflect
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/vm/reference/java/lang/reflect')
-rw-r--r--libjava/classpath/vm/reference/java/lang/reflect/Constructor.java24
-rw-r--r--libjava/classpath/vm/reference/java/lang/reflect/Field.java7
-rw-r--r--libjava/classpath/vm/reference/java/lang/reflect/Method.java14
3 files changed, 20 insertions, 25 deletions
diff --git a/libjava/classpath/vm/reference/java/lang/reflect/Constructor.java b/libjava/classpath/vm/reference/java/lang/reflect/Constructor.java
index 521190b6656..eebee5f5d2a 100644
--- a/libjava/classpath/vm/reference/java/lang/reflect/Constructor.java
+++ b/libjava/classpath/vm/reference/java/lang/reflect/Constructor.java
@@ -77,11 +77,11 @@ import java.util.Arrays;
* @since 1.1
* @status updated to 1.4
*/
-public final class Constructor
+public final class Constructor<T>
extends AccessibleObject
implements GenericDeclaration, Member
{
- private Class clazz;
+ private Class<T> clazz;
private int slot;
private static final int CONSTRUCTOR_MODIFIERS
@@ -104,7 +104,7 @@ public final class Constructor
* Gets the class that declared this constructor.
* @return the class that declared this member
*/
- public Class getDeclaringClass()
+ public Class<T> getDeclaringClass()
{
return clazz;
}
@@ -166,7 +166,7 @@ public final class Constructor
*
* @return a list of the types of the constructor's parameters
*/
- public native Class[] getParameterTypes();
+ public native Class<?>[] getParameterTypes();
/**
* Get the exception types this constructor says it throws, in no particular
@@ -175,7 +175,7 @@ public final class Constructor
*
* @return a list of the types in the constructor's throws clause
*/
- public native Class[] getExceptionTypes();
+ public native Class<?>[] getExceptionTypes();
/**
* Compare two objects to see if they are semantically equivalent.
@@ -244,8 +244,8 @@ public final class Constructor
return sb.toString();
}
- /* FIXME[GENERICS]: Add X extends GenericDeclaration and TypeVariable<X> */
- static void addTypeParameters(StringBuilder sb, TypeVariable[] typeArgs)
+ static <X extends GenericDeclaration>
+ void addTypeParameters(StringBuilder sb, TypeVariable<X>[] typeArgs)
{
if (typeArgs.length == 0)
return;
@@ -313,15 +313,15 @@ public final class Constructor
* @throws ExceptionInInitializerError if construction triggered class
* initialization, which then failed
*/
- public Object newInstance(Object args[])
+ public T newInstance(Object... args)
throws InstantiationException, IllegalAccessException,
InvocationTargetException
{
return constructNative(args, clazz, slot);
}
- private native Object constructNative(Object[] args, Class declaringClass,
- int slot)
+ private native T constructNative(Object[] args, Class declaringClass,
+ int slot)
throws InstantiationException, IllegalAccessException,
InvocationTargetException;
@@ -337,8 +337,7 @@ public final class Constructor
* specification, version 3.
* @since 1.5
*/
- /* FIXME[GENERICS]: Add <Constructor<T>> */
- public TypeVariable[] getTypeParameters()
+ public TypeVariable<Constructor<T>>[] getTypeParameters()
{
String sig = getSignature();
if (sig == null)
@@ -395,4 +394,3 @@ public final class Constructor
return p.getGenericParameterTypes();
}
}
-
diff --git a/libjava/classpath/vm/reference/java/lang/reflect/Field.java b/libjava/classpath/vm/reference/java/lang/reflect/Field.java
index 5121700fede..5db1fa3ecc1 100644
--- a/libjava/classpath/vm/reference/java/lang/reflect/Field.java
+++ b/libjava/classpath/vm/reference/java/lang/reflect/Field.java
@@ -102,7 +102,7 @@ extends AccessibleObject implements Member
* is a non-inherited member.
* @return the class that declared this member
*/
- public Class getDeclaringClass()
+ public Class<?> getDeclaringClass()
{
return declaringClass;
}
@@ -159,7 +159,7 @@ extends AccessibleObject implements Member
* Gets the type of this field.
* @return the type of this field
*/
- public native Class getType();
+ public native Class<?> getType();
/**
* Compare two objects to see if they are semantically equivalent.
@@ -213,7 +213,7 @@ extends AccessibleObject implements Member
sb.append(getName());
return sb.toString();
}
-
+
public String toGenericString()
{
StringBuilder sb = new StringBuilder(64);
@@ -658,5 +658,4 @@ extends AccessibleObject implements Member
* is no Signature attribute, return null.
*/
private native String getSignature();
-
}
diff --git a/libjava/classpath/vm/reference/java/lang/reflect/Method.java b/libjava/classpath/vm/reference/java/lang/reflect/Method.java
index a9920241b17..c520f057024 100644
--- a/libjava/classpath/vm/reference/java/lang/reflect/Method.java
+++ b/libjava/classpath/vm/reference/java/lang/reflect/Method.java
@@ -104,7 +104,7 @@ extends AccessibleObject implements Member, GenericDeclaration
* is a non-inherited member.
* @return the class that declared this member
*/
- public Class getDeclaringClass()
+ public Class<?> getDeclaringClass()
{
return declaringClass;
}
@@ -172,7 +172,7 @@ extends AccessibleObject implements Member, GenericDeclaration
* Gets the return type of this method.
* @return the type of this method
*/
- public native Class getReturnType();
+ public native Class<?> getReturnType();
/**
* Get the parameter list for this method, in declaration order. If the
@@ -180,7 +180,7 @@ extends AccessibleObject implements Member, GenericDeclaration
*
* @return a list of the types of the method's parameters
*/
- public native Class[] getParameterTypes();
+ public native Class<?>[] getParameterTypes();
/**
* Get the exception types this method says it throws, in no particular
@@ -189,7 +189,7 @@ extends AccessibleObject implements Member, GenericDeclaration
*
* @return a list of the types in the method's throws clause
*/
- public native Class[] getExceptionTypes();
+ public native Class<?>[] getExceptionTypes();
/**
* Compare two objects to see if they are semantically equivalent.
@@ -349,7 +349,7 @@ extends AccessibleObject implements Member, GenericDeclaration
* @throws ExceptionInInitializerError if accessing a static method triggered
* class initialization, which then failed
*/
- public Object invoke(Object o, Object[] args)
+ public Object invoke(Object o, Object... args)
throws IllegalAccessException, InvocationTargetException
{
return invokeNative(o, args, declaringClass, slot);
@@ -375,8 +375,7 @@ extends AccessibleObject implements Member, GenericDeclaration
* specification, version 3.
* @since 1.5
*/
- /* FIXME[GENERICS]: Should be TypeVariable<Method>[] */
- public TypeVariable[] getTypeParameters()
+ public TypeVariable<Method>[] getTypeParameters()
{
String sig = getSignature();
if (sig == null)
@@ -451,4 +450,3 @@ extends AccessibleObject implements Member, GenericDeclaration
return p.getGenericReturnType();
}
}
-