add classes and methods needed for GNU Classpath compatibility

Most of these methods are stubs which throw
UnsupportedOperationExceptions for now.
This commit is contained in:
Joel Dice
2009-06-02 17:14:38 -06:00
parent 70bd2d908f
commit 0615b8a09f
18 changed files with 416 additions and 17 deletions

View File

@ -10,7 +10,9 @@
package java.lang.reflect;
public class Constructor<T> extends AccessibleObject implements Member {
public class Constructor<T> extends AccessibleObject
implements Member, GenericDeclaration
{
private Method<T> method;
public Constructor(Method<T> method) {
@ -46,6 +48,18 @@ public class Constructor<T> extends AccessibleObject implements Member {
return method.getName();
}
public boolean isSynthetic() {
return method.isSynthetic();
}
public TypeVariable<Constructor<T>>[] getTypeParameters() {
throw new UnsupportedOperationException();
}
public Type[] getGenericParameterTypes() {
return method.getGenericParameterTypes();
}
private static native <T> T make(Class<T> c);
public T newInstance(Object ... arguments)

View File

@ -101,6 +101,38 @@ public class Field<T> extends AccessibleObject {
}
}
public boolean getBoolean(Object instance) throws IllegalAccessException {
return ((Boolean) get(instance)).booleanValue();
}
public byte getByte(Object instance) throws IllegalAccessException {
return ((Byte) get(instance)).byteValue();
}
public short getShort(Object instance) throws IllegalAccessException {
return ((Short) get(instance)).shortValue();
}
public char getChar(Object instance) throws IllegalAccessException {
return ((Character) get(instance)).charValue();
}
public int getInt(Object instance) throws IllegalAccessException {
return ((Integer) get(instance)).intValue();
}
public float getFloat(Object instance) throws IllegalAccessException {
return ((Float) get(instance)).floatValue();
}
public long getLong(Object instance) throws IllegalAccessException {
return ((Long) get(instance)).longValue();
}
public double getDouble(Object instance) throws IllegalAccessException {
return ((Double) get(instance)).doubleValue();
}
public void set(Object instance, Object value)
throws IllegalAccessException
{
@ -162,6 +194,10 @@ public class Field<T> extends AccessibleObject {
}
}
public boolean isEnumConstant() {
throw new UnsupportedOperationException();
}
private static native long getPrimitive
(Object instance, int code, int offset);

View File

@ -0,0 +1,15 @@
/* Copyright (c) 2009, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
package java.lang.reflect;
public interface GenericDeclaration {
public TypeVariable<?>[] getTypeParameters();
}

View File

@ -19,4 +19,6 @@ public interface Member {
public int getModifiers();
public String getName();
public boolean isSynthetic();
}

View File

@ -10,7 +10,9 @@
package java.lang.reflect;
public class Method<T> extends AccessibleObject implements Member {
public class Method<T> extends AccessibleObject
implements Member, GenericDeclaration
{
private byte vmFlags;
private byte returnCode;
private byte parameterCount;
@ -124,4 +126,28 @@ public class Method<T> extends AccessibleObject implements Member {
}
throw new RuntimeException();
}
public boolean isSynthetic() {
throw new UnsupportedOperationException();
}
public Object getDefaultValue() {
throw new UnsupportedOperationException();
}
public Type[] getGenericParameterTypes() {
throw new UnsupportedOperationException();
}
public Type getGenericReturnType() {
throw new UnsupportedOperationException();
}
public Class[] getExceptionTypes() {
throw new UnsupportedOperationException();
}
public TypeVariable<Method<T>>[] getTypeParameters() {
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,13 @@
/* Copyright (c) 2009, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
package java.lang.reflect;
public interface Type { }

View File

@ -0,0 +1,19 @@
/* Copyright (c) 2009, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
package java.lang.reflect;
public interface TypeVariable<T extends GenericDeclaration>
extends Type
{
public Type[] getBounds();
public T getGenericDeclaration();
public String getName();
}