diff options
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | java/lang/MalformedParameterizedTypeException.java | 46 | ||||
-rw-r--r-- | java/lang/TypeNotPresentException.java | 56 | ||||
-rw-r--r-- | java/lang/reflect/AnnotatedElement.java | 47 | ||||
-rw-r--r-- | java/lang/reflect/GenericArrayType.java | 44 | ||||
-rw-r--r-- | java/lang/reflect/GenericDeclaration.java | 44 | ||||
-rw-r--r-- | java/lang/reflect/GenericSignatureFormatError.java | 46 | ||||
-rw-r--r-- | java/lang/reflect/ParameterizedType.java | 46 | ||||
-rw-r--r-- | java/lang/reflect/Type.java | 43 | ||||
-rw-r--r-- | java/lang/reflect/TypeVariable.java | 46 | ||||
-rw-r--r-- | java/lang/reflect/WildcardType.java | 45 | ||||
-rw-r--r-- | vm/reference/java/lang/reflect/Constructor.java | 21 |
12 files changed, 493 insertions, 10 deletions
@@ -1,5 +1,24 @@ 2004-08-26 Tom Tromey <tromey@redhat.com> + * java/lang/reflect/AnnotatedElement.java: New file. + * vm/reference/java/lang/reflect/Constructor.java (Constructor): + Now generic. Implements GenericDeclaration. + (clazz): Now generic. + (getDeclaringClass): Likewise. + (getExceptionTypes): Likewise. + (getParameterTypes): Likewise. + (newInstance): Likewise. + (constructNative): Likewise. + * java/lang/reflect/GenericDeclaration.java: New file. + * java/lang/reflect/GenericSignatureFormatError.java: New file. + * java/lang/reflect/WildcardType.java: New file. + * java/lang/reflect/TypeVariable.java: New file. + * java/lang/reflect/ParameterizedType.java: New file. + * java/lang/MalformedParameterizedTypeException.java: New file. + * java/lang/TypeNotPresentException.java: New file. + * java/lang/reflect/GenericArrayType.java: New file. + * java/lang/reflect/Type.java: New file. + * java/io/Writer.java (Writer): Implements Closeable, Flushable, Appendable. (append): New methods. diff --git a/java/lang/MalformedParameterizedTypeException.java b/java/lang/MalformedParameterizedTypeException.java new file mode 100644 index 000000000..ec1b81d21 --- /dev/null +++ b/java/lang/MalformedParameterizedTypeException.java @@ -0,0 +1,46 @@ +/* MalformedParameterizedTypeException.java + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public class MalformedParameterizedTypeException extends RuntimeException +{ + public MalformedParameterizedTypeException() + { + } +} diff --git a/java/lang/TypeNotPresentException.java b/java/lang/TypeNotPresentException.java new file mode 100644 index 000000000..2facb9a4c --- /dev/null +++ b/java/lang/TypeNotPresentException.java @@ -0,0 +1,56 @@ +/* TypeNotPresentException.java + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public class TypeNotPresentException extends RuntimeException +{ + public TypeNotPresentException(String typeName, Throwable cause) + { + super("type \"" + typeName + "\" not found", cause); + this.typeName = typeName; + } + + public String typeName() + { + return typeName; + } + + // Name fixed by serialization. + private String typeName; +} diff --git a/java/lang/reflect/AnnotatedElement.java b/java/lang/reflect/AnnotatedElement.java new file mode 100644 index 000000000..01a7b607b --- /dev/null +++ b/java/lang/reflect/AnnotatedElement.java @@ -0,0 +1,47 @@ +/* AnnotatedElement.java + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public interface AnnotatedElement +{ + <T extends Annotation> T getAnnotation(Class<T> annoType); + Annotation[] getAnnotations(); + Annotation[] getDeclaredAnnotation(); + boolean isAnnotationPresent(Class<? extends Annotation> annoType); +} diff --git a/java/lang/reflect/GenericArrayType.java b/java/lang/reflect/GenericArrayType.java new file mode 100644 index 000000000..ebd9165fc --- /dev/null +++ b/java/lang/reflect/GenericArrayType.java @@ -0,0 +1,44 @@ +/* GenericArrayType.java - Represent an array type with generic componet + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public interface GenericArrayType extends Type +{ + Type getGenericComponentType(); +} diff --git a/java/lang/reflect/GenericDeclaration.java b/java/lang/reflect/GenericDeclaration.java new file mode 100644 index 000000000..de75ebaf1 --- /dev/null +++ b/java/lang/reflect/GenericDeclaration.java @@ -0,0 +1,44 @@ +/* GenericDeclaration.java + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public interface GenericDeclaration +{ + TypeVariable<?>[] getTypeParameters(); +} diff --git a/java/lang/reflect/GenericSignatureFormatError.java b/java/lang/reflect/GenericSignatureFormatError.java new file mode 100644 index 000000000..5863fb081 --- /dev/null +++ b/java/lang/reflect/GenericSignatureFormatError.java @@ -0,0 +1,46 @@ +/* GenericSignatureFormatError.java + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public class GenericSignatureFormatError extends ClassFormatError +{ + public GenericSignatureFormatError() + { + } +} diff --git a/java/lang/reflect/ParameterizedType.java b/java/lang/reflect/ParameterizedType.java new file mode 100644 index 000000000..bd081b020 --- /dev/null +++ b/java/lang/reflect/ParameterizedType.java @@ -0,0 +1,46 @@ +/* ParameterizedType.java + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public interface ParameterizedType extends Type +{ + Type[] getActualTypeArguments(); + Type getOwnerType(); + Type getRawType(); +} diff --git a/java/lang/reflect/Type.java b/java/lang/reflect/Type.java new file mode 100644 index 000000000..f511aa0cc --- /dev/null +++ b/java/lang/reflect/Type.java @@ -0,0 +1,43 @@ +/* Type.java - Superinterface for all types. + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public interface Type +{ +} diff --git a/java/lang/reflect/TypeVariable.java b/java/lang/reflect/TypeVariable.java new file mode 100644 index 000000000..6b062da3c --- /dev/null +++ b/java/lang/reflect/TypeVariable.java @@ -0,0 +1,46 @@ +/* TypeVariable.java + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public interface TypeVariable<T extends GenericDeclaration> extends Type +{ + Type[] getBounds(); + T getGenericDeclaration(); + String getName(); +} diff --git a/java/lang/reflect/WildcardType.java b/java/lang/reflect/WildcardType.java new file mode 100644 index 000000000..d5cdae41b --- /dev/null +++ b/java/lang/reflect/WildcardType.java @@ -0,0 +1,45 @@ +/* WildcardType.java + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public interface WildcardType extends Type +{ + Type[] getLowerBounds(); + Type[] getUpperBounds(); +} diff --git a/vm/reference/java/lang/reflect/Constructor.java b/vm/reference/java/lang/reflect/Constructor.java index 902cb1aa6..7b33d28b6 100644 --- a/vm/reference/java/lang/reflect/Constructor.java +++ b/vm/reference/java/lang/reflect/Constructor.java @@ -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 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -73,10 +73,11 @@ import java.util.Arrays; * @since 1.1 * @status updated to 1.4 */ -public final class Constructor -extends AccessibleObject implements Member +public final class Constructor<T> + extends AccessibleObject + implements GenericDeclaration, Member { - private Class clazz; + private Class<T> clazz; private int slot; private Class[] parameterTypes; private Class[] exceptionTypes; @@ -98,7 +99,7 @@ extends AccessibleObject implements Member * Gets the class that declared this constructor. * @return the class that declared this member */ - public Class getDeclaringClass() + public Class<T> getDeclaringClass() { return clazz; } @@ -129,7 +130,7 @@ extends AccessibleObject implements Member * * @return a list of the types of the constructor's parameters */ - public Class[] getParameterTypes() + public Class<?>[] getParameterTypes() { if (parameterTypes == null) return new Class[0]; @@ -143,7 +144,7 @@ extends AccessibleObject implements Member * * @return a list of the types in the constructor's throws clause */ - public Class[] getExceptionTypes() + public Class<?>[] getExceptionTypes() { if (exceptionTypes == null) return new Class[0]; @@ -247,15 +248,15 @@ extends AccessibleObject implements Member * @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; } |