Imported GNU Classpath 0.90
Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887
This commit is contained in:
parent
eaec4980e1
commit
4f9533c772
1640 changed files with 126485 additions and 104808 deletions
|
@ -1,5 +1,5 @@
|
|||
/* java.lang.reflect.Constructor - reflection of Java constructors
|
||||
Copyright (C) 1998, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2001, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -38,6 +38,10 @@ exception statement from your version. */
|
|||
|
||||
package java.lang.reflect;
|
||||
|
||||
import gnu.java.lang.ClassHelper;
|
||||
|
||||
import gnu.java.lang.reflect.MethodSignatureParser;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
|
@ -74,11 +78,15 @@ import java.util.Arrays;
|
|||
* @status updated to 1.4
|
||||
*/
|
||||
public final class Constructor
|
||||
extends AccessibleObject implements Member
|
||||
extends AccessibleObject
|
||||
implements GenericDeclaration, Member
|
||||
{
|
||||
private Class clazz;
|
||||
private int slot;
|
||||
|
||||
private static final int CONSTRUCTOR_MODIFIERS
|
||||
= Modifier.PRIVATE | Modifier.PROTECTED | Modifier.PUBLIC;
|
||||
|
||||
/**
|
||||
* This class is uninstantiable except from native code.
|
||||
*/
|
||||
|
@ -111,6 +119,13 @@ extends AccessibleObject implements Member
|
|||
return getDeclaringClass().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the raw modifiers for this constructor. In particular
|
||||
* this will include the synthetic and varargs bits.
|
||||
* @return the constructor's modifiers
|
||||
*/
|
||||
private native int getModifiersInternal();
|
||||
|
||||
/**
|
||||
* Gets the modifiers this constructor uses. Use the <code>Modifier</code>
|
||||
* class to interpret the values. A constructor can only have a subset of the
|
||||
|
@ -119,7 +134,31 @@ extends AccessibleObject implements Member
|
|||
* @return an integer representing the modifiers to this Member
|
||||
* @see Modifier
|
||||
*/
|
||||
public native int getModifiers();
|
||||
public int getModifiers()
|
||||
{
|
||||
return getModifiersInternal() & CONSTRUCTOR_MODIFIERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this constructor is synthetic, false otherwise.
|
||||
* A synthetic member is one which is created by the compiler,
|
||||
* and which does not appear in the user's source code.
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean isSynthetic()
|
||||
{
|
||||
return (getModifiersInternal() & Modifier.SYNTHETIC) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a varargs constructor, that is if
|
||||
* the constructor takes a variable number of arguments.
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean isVarArgs()
|
||||
{
|
||||
return (getModifiersInternal() & Modifier.VARARGS) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parameter list for this constructor, in declaration order. If the
|
||||
|
@ -184,15 +223,15 @@ extends AccessibleObject implements Member
|
|||
public String toString()
|
||||
{
|
||||
// 128 is a reasonable buffer initial size for constructor
|
||||
StringBuffer sb = new StringBuffer(128);
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
Modifier.toString(getModifiers(), sb).append(' ');
|
||||
sb.append(getDeclaringClass().getName()).append('(');
|
||||
Class[] c = getParameterTypes();
|
||||
if (c.length > 0)
|
||||
{
|
||||
sb.append(c[0].getName());
|
||||
sb.append(ClassHelper.getUserName(c[0]));
|
||||
for (int i = 1; i < c.length; i++)
|
||||
sb.append(',').append(c[i].getName());
|
||||
sb.append(',').append(ClassHelper.getUserName(c[i]));
|
||||
}
|
||||
sb.append(')');
|
||||
c = getExceptionTypes();
|
||||
|
@ -204,7 +243,46 @@ extends AccessibleObject implements Member
|
|||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
/* FIXME[GENERICS]: Add X extends GenericDeclaration and TypeVariable<X> */
|
||||
static void addTypeParameters(StringBuilder sb, TypeVariable[] typeArgs)
|
||||
{
|
||||
if (typeArgs.length == 0)
|
||||
return;
|
||||
sb.append('<');
|
||||
for (int i = 0; i < typeArgs.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
sb.append(',');
|
||||
sb.append(typeArgs[i]);
|
||||
}
|
||||
sb.append("> ");
|
||||
}
|
||||
|
||||
public String toGenericString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
Modifier.toString(getModifiers(), sb).append(' ');
|
||||
addTypeParameters(sb, getTypeParameters());
|
||||
sb.append(getDeclaringClass().getName()).append('(');
|
||||
Type[] types = getGenericParameterTypes();
|
||||
if (types.length > 0)
|
||||
{
|
||||
sb.append(types[0]);
|
||||
for (int i = 1; i < types.length; ++i)
|
||||
sb.append(',').append(types[i]);
|
||||
}
|
||||
sb.append(')');
|
||||
types = getGenericExceptionTypes();
|
||||
if (types.length > 0)
|
||||
{
|
||||
sb.append(" throws ").append(types[0]);
|
||||
for (int i = 1; i < types.length; i++)
|
||||
sb.append(',').append(types[i]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance by invoking the constructor. Arguments are
|
||||
* automatically unwrapped and widened, if needed.<p>
|
||||
|
@ -246,4 +324,75 @@ extends AccessibleObject implements Member
|
|||
int slot)
|
||||
throws InstantiationException, IllegalAccessException,
|
||||
InvocationTargetException;
|
||||
|
||||
/**
|
||||
* Returns an array of <code>TypeVariable</code> objects that represents
|
||||
* the type variables declared by this constructor, in declaration order.
|
||||
* An array of size zero is returned if this constructor has no type
|
||||
* variables.
|
||||
*
|
||||
* @return the type variables associated with this constructor.
|
||||
* @throws GenericSignatureFormatError if the generic signature does
|
||||
* not conform to the format specified in the Virtual Machine
|
||||
* specification, version 3.
|
||||
* @since 1.5
|
||||
*/
|
||||
/* FIXME[GENERICS]: Add <Constructor<T>> */
|
||||
public TypeVariable[] getTypeParameters()
|
||||
{
|
||||
String sig = getSignature();
|
||||
if (sig == null)
|
||||
return new TypeVariable[0];
|
||||
MethodSignatureParser p = new MethodSignatureParser(this, sig);
|
||||
return p.getTypeParameters();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the String in the Signature attribute for this constructor. If there
|
||||
* is no Signature attribute, return null.
|
||||
*/
|
||||
private native String getSignature();
|
||||
|
||||
/**
|
||||
* Returns an array of <code>Type</code> objects that represents
|
||||
* the exception types declared by this constructor, in declaration order.
|
||||
* An array of size zero is returned if this constructor declares no
|
||||
* exceptions.
|
||||
*
|
||||
* @return the exception types declared by this constructor.
|
||||
* @throws GenericSignatureFormatError if the generic signature does
|
||||
* not conform to the format specified in the Virtual Machine
|
||||
* specification, version 3.
|
||||
* @since 1.5
|
||||
*/
|
||||
public Type[] getGenericExceptionTypes()
|
||||
{
|
||||
String sig = getSignature();
|
||||
if (sig == null)
|
||||
return getExceptionTypes();
|
||||
MethodSignatureParser p = new MethodSignatureParser(this, sig);
|
||||
return p.getGenericExceptionTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of <code>Type</code> objects that represents
|
||||
* the parameter list for this constructor, in declaration order.
|
||||
* An array of size zero is returned if this constructor takes no
|
||||
* parameters.
|
||||
*
|
||||
* @return a list of the types of the constructor's parameters
|
||||
* @throws GenericSignatureFormatError if the generic signature does
|
||||
* not conform to the format specified in the Virtual Machine
|
||||
* specification, version 3.
|
||||
* @since 1.5
|
||||
*/
|
||||
public Type[] getGenericParameterTypes()
|
||||
{
|
||||
String sig = getSignature();
|
||||
if (sig == null)
|
||||
return getParameterTypes();
|
||||
MethodSignatureParser p = new MethodSignatureParser(this, sig);
|
||||
return p.getGenericParameterTypes();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* java.lang.reflect.Field - reflection of Java fields
|
||||
Copyright (C) 1998, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -38,6 +38,10 @@ exception statement from your version. */
|
|||
|
||||
package java.lang.reflect;
|
||||
|
||||
import gnu.java.lang.ClassHelper;
|
||||
|
||||
import gnu.java.lang.reflect.FieldSignatureParser;
|
||||
|
||||
/**
|
||||
* The Field class represents a member variable of a class. It also allows
|
||||
* dynamic access to a member, via reflection. This works for both
|
||||
|
@ -78,6 +82,11 @@ extends AccessibleObject implements Member
|
|||
private String name;
|
||||
private int slot;
|
||||
|
||||
private static final int FIELD_MODIFIERS
|
||||
= Modifier.FINAL | Modifier.PRIVATE | Modifier.PROTECTED
|
||||
| Modifier.PUBLIC | Modifier.STATIC | Modifier.TRANSIENT
|
||||
| Modifier.VOLATILE;
|
||||
|
||||
/**
|
||||
* This class is uninstantiable except natively.
|
||||
*/
|
||||
|
@ -107,6 +116,12 @@ extends AccessibleObject implements Member
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the raw modifiers for this field.
|
||||
* @return the field's modifiers
|
||||
*/
|
||||
private native int getModifiersInternal();
|
||||
|
||||
/**
|
||||
* Gets the modifiers this field uses. Use the <code>Modifier</code>
|
||||
* class to interpret the values. A field can only have a subset of the
|
||||
|
@ -116,7 +131,29 @@ extends AccessibleObject implements Member
|
|||
* @return an integer representing the modifiers to this Member
|
||||
* @see Modifier
|
||||
*/
|
||||
public native int getModifiers();
|
||||
public int getModifiers()
|
||||
{
|
||||
return getModifiersInternal() & FIELD_MODIFIERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this field is synthetic, false otherwise.
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean isSynthetic()
|
||||
{
|
||||
return (getModifiersInternal() & Modifier.SYNTHETIC) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this field represents an enum constant,
|
||||
* false otherwise.
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean isEnumConstant()
|
||||
{
|
||||
return (getModifiersInternal() & Modifier.ENUM) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of this field.
|
||||
|
@ -169,14 +206,24 @@ extends AccessibleObject implements Member
|
|||
public String toString()
|
||||
{
|
||||
// 64 is a reasonable buffer initial size for field
|
||||
StringBuffer sb = new StringBuffer(64);
|
||||
StringBuilder sb = new StringBuilder(64);
|
||||
Modifier.toString(getModifiers(), sb).append(' ');
|
||||
sb.append(getType().getName()).append(' ');
|
||||
sb.append(ClassHelper.getUserName(getType())).append(' ');
|
||||
sb.append(getDeclaringClass().getName()).append('.');
|
||||
sb.append(getName());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String toGenericString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(64);
|
||||
Modifier.toString(getModifiers(), sb).append(' ');
|
||||
sb.append(getGenericType()).append(' ');
|
||||
sb.append(getDeclaringClass().getName()).append('.');
|
||||
sb.append(getName());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of this Field. If it is primitive, it will be wrapped
|
||||
* in the appropriate wrapper type (boolean = java.lang.Boolean).<p>
|
||||
|
@ -586,4 +633,30 @@ extends AccessibleObject implements Member
|
|||
*/
|
||||
public native void setDouble(Object o, double value)
|
||||
throws IllegalAccessException;
|
||||
|
||||
/**
|
||||
* Return the generic type of the field. If the field type is not a generic
|
||||
* type, the method returns the same as <code>getType()</code>.
|
||||
*
|
||||
* @throws GenericSignatureFormatError if the generic signature does
|
||||
* not conform to the format specified in the Virtual Machine
|
||||
* specification, version 3.
|
||||
* @since 1.5
|
||||
*/
|
||||
public Type getGenericType()
|
||||
{
|
||||
String signature = getSignature();
|
||||
if (signature == null)
|
||||
return getType();
|
||||
FieldSignatureParser p = new FieldSignatureParser(getDeclaringClass(),
|
||||
signature);
|
||||
return p.getFieldType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the String in the Signature attribute for this field. If there
|
||||
* is no Signature attribute, return null.
|
||||
*/
|
||||
private native String getSignature();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* java.lang.reflect.Method - reflection of Java methods
|
||||
Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -38,6 +38,10 @@ exception statement from your version. */
|
|||
|
||||
package java.lang.reflect;
|
||||
|
||||
import gnu.java.lang.ClassHelper;
|
||||
|
||||
import gnu.java.lang.reflect.MethodSignatureParser;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
|
@ -74,12 +78,17 @@ import java.util.Arrays;
|
|||
* @status updated to 1.4
|
||||
*/
|
||||
public final class Method
|
||||
extends AccessibleObject implements Member
|
||||
extends AccessibleObject implements Member, GenericDeclaration
|
||||
{
|
||||
Class declaringClass;
|
||||
String name;
|
||||
int slot;
|
||||
|
||||
private static final int METHOD_MODIFIERS
|
||||
= Modifier.ABSTRACT | Modifier.FINAL | Modifier.NATIVE
|
||||
| Modifier.PRIVATE | Modifier.PROTECTED | Modifier.PUBLIC
|
||||
| Modifier.STATIC | Modifier.STRICT | Modifier.SYNCHRONIZED;
|
||||
|
||||
/**
|
||||
* This class is uninstantiable.
|
||||
*/
|
||||
|
@ -109,6 +118,12 @@ extends AccessibleObject implements Member
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the raw modifiers for this method.
|
||||
* @return the method's modifiers
|
||||
*/
|
||||
private native int getModifiersInternal();
|
||||
|
||||
/**
|
||||
* Gets the modifiers this method uses. Use the <code>Modifier</code>
|
||||
* class to interpret the values. A method can only have a subset of the
|
||||
|
@ -118,7 +133,40 @@ extends AccessibleObject implements Member
|
|||
* @return an integer representing the modifiers to this Member
|
||||
* @see Modifier
|
||||
*/
|
||||
public native int getModifiers();
|
||||
public int getModifiers()
|
||||
{
|
||||
return getModifiersInternal() & METHOD_MODIFIERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this method is a bridge method. A bridge method
|
||||
* is generated by the compiler in some situations involving
|
||||
* generics and inheritance.
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean isBridge()
|
||||
{
|
||||
return (getModifiersInternal() & Modifier.BRIDGE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this method is synthetic, false otherwise.
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean isSynthetic()
|
||||
{
|
||||
return (getModifiersInternal() & Modifier.SYNTHETIC) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a varargs method, that is if
|
||||
* the method takes a variable number of arguments.
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean isVarArgs()
|
||||
{
|
||||
return (getModifiersInternal() & Modifier.VARARGS) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the return type of this method.
|
||||
|
@ -210,17 +258,17 @@ extends AccessibleObject implements Member
|
|||
public String toString()
|
||||
{
|
||||
// 128 is a reasonable buffer initial size for constructor
|
||||
StringBuffer sb = new StringBuffer(128);
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
Modifier.toString(getModifiers(), sb).append(' ');
|
||||
sb.append(getUserTypeName(getReturnType().getName())).append(' ');
|
||||
sb.append(ClassHelper.getUserName(getReturnType())).append(' ');
|
||||
sb.append(getDeclaringClass().getName()).append('.');
|
||||
sb.append(getName()).append('(');
|
||||
Class[] c = getParameterTypes();
|
||||
if (c.length > 0)
|
||||
{
|
||||
sb.append(getUserTypeName(c[0].getName()));
|
||||
sb.append(ClassHelper.getUserName(c[0]));
|
||||
for (int i = 1; i < c.length; i++)
|
||||
sb.append(',').append(getUserTypeName(c[i].getName()));
|
||||
sb.append(',').append(ClassHelper.getUserName(c[i]));
|
||||
}
|
||||
sb.append(')');
|
||||
c = getExceptionTypes();
|
||||
|
@ -233,53 +281,31 @@ extends AccessibleObject implements Member
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String getUserTypeName(String typeSpec)
|
||||
public String toGenericString()
|
||||
{
|
||||
int pos = 0;
|
||||
String typeName = "";
|
||||
String arrayPart = "";
|
||||
|
||||
while (typeSpec.charAt(pos) == '[')
|
||||
// 128 is a reasonable buffer initial size for constructor
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
Modifier.toString(getModifiers(), sb).append(' ');
|
||||
Constructor.addTypeParameters(sb, getTypeParameters());
|
||||
sb.append(getGenericReturnType()).append(' ');
|
||||
sb.append(getDeclaringClass().getName()).append('.');
|
||||
sb.append(getName()).append('(');
|
||||
Type[] types = getGenericParameterTypes();
|
||||
if (types.length > 0)
|
||||
{
|
||||
arrayPart += "[]";
|
||||
++pos;
|
||||
sb.append(types[0]);
|
||||
for (int i = 1; i < types.length; i++)
|
||||
sb.append(',').append(types[i]);
|
||||
}
|
||||
|
||||
switch (typeSpec.charAt(pos))
|
||||
sb.append(')');
|
||||
types = getGenericExceptionTypes();
|
||||
if (types.length > 0)
|
||||
{
|
||||
case 'Z':
|
||||
typeName = "boolean";
|
||||
break;
|
||||
case 'B':
|
||||
typeName = "byte";
|
||||
break;
|
||||
case 'C':
|
||||
typeName = "char";
|
||||
break;
|
||||
case 'D':
|
||||
typeName = "double";
|
||||
break;
|
||||
case 'F':
|
||||
typeName = "float";
|
||||
break;
|
||||
case 'I':
|
||||
typeName = "int";
|
||||
break;
|
||||
case 'J':
|
||||
typeName = "long";
|
||||
break;
|
||||
case 'S':
|
||||
typeName = "short";
|
||||
break;
|
||||
case 'L':
|
||||
typeName = typeSpec.substring(pos + 1, typeSpec.length() - 1);
|
||||
break;
|
||||
default:
|
||||
typeName = typeSpec;
|
||||
break;
|
||||
sb.append(" throws ").append(types[0]);
|
||||
for (int i = 1; i < types.length; i++)
|
||||
sb.append(',').append(types[i]);
|
||||
}
|
||||
|
||||
return typeName + arrayPart;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -336,4 +362,93 @@ extends AccessibleObject implements Member
|
|||
private native Object invokeNative(Object o, Object[] args,
|
||||
Class declaringClass, int slot)
|
||||
throws IllegalAccessException, InvocationTargetException;
|
||||
|
||||
/**
|
||||
* Returns an array of <code>TypeVariable</code> objects that represents
|
||||
* the type variables declared by this constructor, in declaration order.
|
||||
* An array of size zero is returned if this class has no type
|
||||
* variables.
|
||||
*
|
||||
* @return the type variables associated with this class.
|
||||
* @throws GenericSignatureFormatError if the generic signature does
|
||||
* not conform to the format specified in the Virtual Machine
|
||||
* specification, version 3.
|
||||
* @since 1.5
|
||||
*/
|
||||
/* FIXME[GENERICS]: Should be TypeVariable<Method>[] */
|
||||
public TypeVariable[] getTypeParameters()
|
||||
{
|
||||
String sig = getSignature();
|
||||
if (sig == null)
|
||||
return new TypeVariable[0];
|
||||
MethodSignatureParser p = new MethodSignatureParser(this, sig);
|
||||
return p.getTypeParameters();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the String in the Signature attribute for this method. If there
|
||||
* is no Signature attribute, return null.
|
||||
*/
|
||||
private native String getSignature();
|
||||
|
||||
/**
|
||||
* Returns an array of <code>Type</code> objects that represents
|
||||
* the exception types declared by this method, in declaration order.
|
||||
* An array of size zero is returned if this method declares no
|
||||
* exceptions.
|
||||
*
|
||||
* @return the exception types declared by this method.
|
||||
* @throws GenericSignatureFormatError if the generic signature does
|
||||
* not conform to the format specified in the Virtual Machine
|
||||
* specification, version 3.
|
||||
* @since 1.5
|
||||
*/
|
||||
public Type[] getGenericExceptionTypes()
|
||||
{
|
||||
String sig = getSignature();
|
||||
if (sig == null)
|
||||
return getExceptionTypes();
|
||||
MethodSignatureParser p = new MethodSignatureParser(this, sig);
|
||||
return p.getGenericExceptionTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of <code>Type</code> objects that represents
|
||||
* the parameter list for this method, in declaration order.
|
||||
* An array of size zero is returned if this method takes no
|
||||
* parameters.
|
||||
*
|
||||
* @return a list of the types of the method's parameters
|
||||
* @throws GenericSignatureFormatError if the generic signature does
|
||||
* not conform to the format specified in the Virtual Machine
|
||||
* specification, version 3.
|
||||
* @since 1.5
|
||||
*/
|
||||
public Type[] getGenericParameterTypes()
|
||||
{
|
||||
String sig = getSignature();
|
||||
if (sig == null)
|
||||
return getParameterTypes();
|
||||
MethodSignatureParser p = new MethodSignatureParser(this, sig);
|
||||
return p.getGenericParameterTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the return type of this method.
|
||||
*
|
||||
* @return the return type of this method
|
||||
* @throws GenericSignatureFormatError if the generic signature does
|
||||
* not conform to the format specified in the Virtual Machine
|
||||
* specification, version 3.
|
||||
* @since 1.5
|
||||
*/
|
||||
public Type getGenericReturnType()
|
||||
{
|
||||
String sig = getSignature();
|
||||
if (sig == null)
|
||||
return getReturnType();
|
||||
MethodSignatureParser p = new MethodSignatureParser(this, sig);
|
||||
return p.getGenericReturnType();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/* java.lang.reflect.VMArray - VM class for array manipulation by reflection.
|
||||
Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.lang.reflect;
|
||||
|
||||
import gnu.classpath.Configuration;
|
||||
|
||||
class VMArray
|
||||
{
|
||||
|
||||
static
|
||||
{
|
||||
if (Configuration.INIT_LOAD_LIBRARY)
|
||||
{
|
||||
System.loadLibrary("javalangreflect");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically create an array of objects.
|
||||
*
|
||||
* @param type guaranteed to be a valid object type
|
||||
* @param dim the length of the array
|
||||
* @return the new array
|
||||
* @throws NegativeArraySizeException if dim is negative
|
||||
* @throws OutOfMemoryError if memory allocation fails
|
||||
*/
|
||||
static native Object createObjectArray(Class type, int dim);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue