Index: java/io/Closeable.java
===================================================================
RCS file: java/io/Closeable.java
diff -N java/io/Closeable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/io/Closeable.java 20 Feb 2005 23:30:42 -0000
@@ -0,0 +1,63 @@
+/* Closeable.java -- Closeable object
+ Copyright (C) 2004, 2005 Free Software Foundation
+
+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.io;
+
+/**
+ * A Closeable
class represents a stream of
+ * data, which can be closed when it is no longer needed.
+ * Closing a stream allows the resources it uses to be
+ * freed for an alternate use.
+ *
+ * @author Tom Tromey (address@hidden)
+ * @author Andrew John Hughes (address@hidden)
+ * @since 1.5
+ */
+public interface Closeable
+{
+
+ /**
+ * Closes the stream represented by this class, thus freeing
+ * system resources. In that case that the stream is already
+ * in the closed state, this method has no effect.
+ *
+ * @throws IOException if an I/O error occurs in closing.
+ */
+ void close()
+ throws IOException;
+
+}
Index: java/io/Flushable.java
===================================================================
RCS file: java/io/Flushable.java
diff -N java/io/Flushable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/io/Flushable.java 20 Feb 2005 23:30:42 -0000
@@ -0,0 +1,62 @@
+/* Flushable.java -- Flushable object
+ Copyright (C) 2004, 2005 Free Software Foundation
+
+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.io;
+
+/**
+ * A Flushable
class represents a stream of
+ * data, for which internally buffered data can be `flushed'.
+ * Flushing such a stream causes the buffered data to be
+ * written to the stream.
+ *
+ * @author Tom Tromey (address@hidden)
+ * @author Andrew John Hughes (address@hidden)
+ * @since 1.5
+ */
+public interface Flushable
+{
+
+ /**
+ * Flushes the stream represented by this class,
+ * so that any buffered data is written to the stream.
+ *
+ * @throws IOException if an I/O error occurs in flushing.
+ */
+ void flush()
+ throws IOException;
+
+}
Index: java/lang/Appendable.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Appendable.java,v
retrieving revision 1.2
diff -u -3 -p -u -r1.2 Appendable.java
--- java/lang/Appendable.java 18 Jan 2005 21:17:36 -0000 1.2
+++ java/lang/Appendable.java 20 Feb 2005 23:30:42 -0000
@@ -55,7 +55,8 @@ import java.io.IOException;
*
* Note: implementation of this interface is required for
- * any class that wishes to receive data from a Formatter
instance.
+ * any class that wishes to receive data from a Formatter
+ * instance.
*
Readable
object is simply a source for Unicode character
+ * data. On request, a Readable
will provide its data in
+ * a supplied CharBuffer
.
+ *
+ * @author Tom Tromey
+ * @author Andrew John Hughes
+ * @since 1.5
+ */
+public interface Readable
+{
+
+ /**
+ * Adds the character data supplied by this Readable
+ * to the specified character buffer. This method simply places
+ * each character into the buffer as supplied, using put()
,
+ * without flipping or rewinding.
+ *
+ * @param buf the buffer to place the character data in.
+ * @return the number of char
values placed in the buffer,
+ * or -1 if no more characters are available.
+ * @throws IOException if an I/O error occurs.
+ * @throws NullPointerException if buf is null.
+ * @throws ReadOnlyBufferException if buf is read only.
+ */
+ int read(CharBuffer buf)
+ throws IOException;
+
+}
Index: java/lang/StringBuilder.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/StringBuilder.java,v
retrieving revision 1.3
diff -u -3 -p -u -r1.3 StringBuilder.java
--- java/lang/StringBuilder.java 16 Feb 2005 07:05:33 -0000 1.3
+++ java/lang/StringBuilder.java 20 Feb 2005 23:30:43 -0000
@@ -82,9 +82,9 @@ public final class StringBuilder
// want to change StringBuffer as well.
/**
- * Compatible with JDK 1.0+.
+ * For compatability with Sun's JDK
*/
- private static final long serialVersionUID = 3388685877147921107L;
+ private static final long serialVersionUID = 4383685877147921099L;
/**
* Index of next available character (and thus the size of the current
Index: java/lang/TypeNotPresentException.java
===================================================================
RCS file: java/lang/TypeNotPresentException.java
diff -N java/lang/TypeNotPresentException.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/lang/TypeNotPresentException.java 20 Feb 2005 23:30:43 -0000
@@ -0,0 +1,97 @@
+/* TypeNotPresentException.java -- Thrown when a string-based type is missing
+ Copyright (C) 2004, 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., 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;
+
+/**
+ *
+ * Thrown when a type is accessed using a String
-based
+ * representation, but no definition of the supplied type is found.
+ * This is effectively an unchecked equivalent of the existing
+ * ClassNotFound
exception.
+ *
+ * It may occur due to an attempt to load a missing class, interface or + * annotation, or when an undefined type variable is accessed. + *
+ * + * @author Tom Tromey (address@hidden) + * @author Andrew John Hughes (address@hidden) + * @see ClassNotFoundException + * @since 1.5 + */ +public class TypeNotPresentException + extends RuntimeException +{ + + /** + * Constructs aTypeNotPresentException
for
+ * the supplied type. The specified cause Throwable
+ * may be used to provide additional history, with regards to the
+ * root of the problem. It is perfectly valid for this to be null,
+ * if the cause of the problem is unknown.
+ *
+ * @param typeName the name of the missing type.
+ * @param cause the cause of this exception, or null if the cause
+ * is unknown.
+ */
+ public TypeNotPresentException(String typeName, Throwable cause)
+ {
+ super("type \"" + typeName + "\" not found", cause);
+ this.typeName = typeName;
+ }
+
+ /**
+ * Returns the name of the missing type.
+ *
+ * @return the missing type's name.
+ */
+ public String typeName()
+ {
+ return typeName;
+ }
+
+ /**
+ * The name of the missing type.
+ *
+ * @serial the missing type's name.
+ */
+ // Name fixed by serialization.
+ private String typeName;
+
+}
Index: java/lang/annotation/AnnotationFormatError.java
===================================================================
RCS file: java/lang/annotation/AnnotationFormatError.java
diff -N java/lang/annotation/AnnotationFormatError.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/AnnotationFormatError.java 20 Feb 2005 23:30:43 -0000
@@ -0,0 +1,104 @@
+/* AnnotationFormatError.java - Thrown when an binary annotation is malformed
+ Copyright (C) 2004, 2005 Free Software Foundation
+
+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.annotation;
+
+/**
+ * Thrown when an annotation found in a class file is
+ * malformed. When the virtual machine finds a class file
+ * containing annotations, it attempts to parse them.
+ * This error is thrown if this operation fails.
+ *
+ * @author Tom Tromey (address@hidden)
+ * @author Andrew John Hughes (address@hidden)
+ * @since 1.5
+ */
+public class AnnotationFormatError extends Error
+{
+
+ /**
+ * Constructs a new AnnotationFormatError
+ * using the specified message to give details of the error.
+ *
+ * @param message the message to use in the error output.
+ */
+ public AnnotationFormatError(String message)
+ {
+ super(message);
+ }
+
+ /**
+ *
+ * Constructs a new AnnotationFormatError
+ * using the specified message to give details of the error.
+ * The supplied cause Throwable
is used to
+ * provide additional history, with regards to the root
+ * of the problem. It is perfectly valid for this to be null, if
+ * the cause is unknown.
+ *
+ * Note: if a cause is supplied, the error + * message from this cause is not automatically included in the + * error message given by this error. + *
+ * + * @param message the message to use in the error output + * @param cause the cause of this error, or null if the cause + * is unknown. + */ + public AnnotationFormatError(String message, Throwable cause) + { + super(message, cause); + } + + /** + * Constructs a newAnnotationFormatError
using
+ * the supplied cause Throwable
to
+ * provide additional history, with regards to the root
+ * of the problem. It is perfectly valid for this to be null, if
+ * the cause is unknown. If the cause is not null, the error
+ * message from this cause will also be used as the message
+ * for this error.
+ *
+ * @param cause the cause of the error.
+ */
+ public AnnotationFormatError(Throwable cause)
+ {
+ super(cause);
+ }
+
+}
Index: java/lang/annotation/AnnotationTypeMismatchException.java
===================================================================
RCS file: java/lang/annotation/AnnotationTypeMismatchException.java
diff -N java/lang/annotation/AnnotationTypeMismatchException.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/AnnotationTypeMismatchException.java 20 Feb 2005 23:30:43 -0000
@@ -0,0 +1,116 @@
+/* AnnotationTypeMismatchException.java - Thrown when annotation has changed
+ Copyright (C) 2004, 2005 Free Software Foundation
+
+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.annotation;
+
+import java.lang.reflect.Method;
+
+/**
+ * Thrown when accessing an element within an annotation for
+ * which the type has changed, since compilation or serialization
+ * took place. The mismatch between the compiled or serialized
+ * type and the current type causes this exception to be thrown.
+ *
+ * @author Tom Tromey (address@hidden)
+ * @author Andrew John Hughes (address@hidden)
+ * @since 1.5
+ */
+public class AnnotationTypeMismatchException extends RuntimeException
+{
+
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = 8125925355765570191L;
+
+ /**
+ * Constructs an AnnotationTypeMismatchException
+ * which is due to a mismatched type in the annotation
+ * element, m
. The erroneous type used for the
+ * data in m
is represented by the string,
+ * type
. This string is of an undefined format,
+ * and may contain the value as well as the type.
+ *
+ * @param m the element from the annotation.
+ * @param type the name of the erroneous type found in m
.
+ */
+ public AnnotationTypeMismatchException(Method m, String type)
+ {
+ this.element = m;
+ this.foundType = type;
+ }
+
+ /**
+ * Returns the element from the annotation, for which a
+ * mismatch occurred.
+ *
+ * @return the element with the mismatched type.
+ */
+ public Method element()
+ {
+ return element;
+ }
+
+ /**
+ * Returns the erroneous type used by the element,
+ * represented as a String
. The format
+ * of this String
is not explicitly specified,
+ * and may contain the value as well as the type.
+ *
+ * @return the type found in the element.
+ */
+ public String foundType()
+ {
+ return foundType;
+ }
+
+ // Names are chosen from serialization spec.
+ /**
+ * The element from the annotation.
+ *
+ * @serial the element with the mismatched type.
+ */
+ private Method element;
+
+ /**
+ * The erroneous type used by the element.
+ *
+ * @serial the type found in the element.
+ */
+ private String foundType;
+
+}
Index: java/lang/reflect/GenericArrayType.java
===================================================================
RCS file: java/lang/reflect/GenericArrayType.java
diff -N java/lang/reflect/GenericArrayType.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/lang/reflect/GenericArrayType.java 20 Feb 2005 23:30:43 -0000
@@ -0,0 +1,61 @@
+/* GenericArrayType.java - Represent an array type with a generic component
+ Copyright (C) 2004, 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., 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;
+
+/**
+ * Represents the type of an array's components, which may be
+ * either a parameterized type or a type variable.
+ *
+ * @author Tom Tromey (address@hidden)
+ * @author Andrew John Hughes (address@hidden)
+ * @since 1.5
+ */
+public interface GenericArrayType
+ extends Type
+{
+
+ /**
+ * Returns the Type
of the components within the array.
+ *
+ * @return a Type
instance representing the type of
+ * the array's components.
+ */
+ Type getGenericComponentType();
+
+}
Index: java/lang/reflect/GenericSignatureFormatError.java
===================================================================
RCS file: java/lang/reflect/GenericSignatureFormatError.java
diff -N java/lang/reflect/GenericSignatureFormatError.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/lang/reflect/GenericSignatureFormatError.java 20 Feb 2005 23:30:43 -0000
@@ -0,0 +1,62 @@
+/* GenericSignatureFormatError.java - Thrown when a signature is malformed.
+ Copyright (C) 2004, 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., 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;
+
+/**
+ * Thrown on encountering a syntactically malformed signature in
+ * a reflective method. During reflection, the generic type signature
+ * of a type, method or constructor may be interpreted by the virtual
+ * machine. This error is thrown if this operation fails.
+ *
+ * @author Tom Tromey (address@hidden)
+ * @author Andrew John Hughes (address@hidden)
+ * @since 1.5
+ */
+public class GenericSignatureFormatError
+ extends ClassFormatError
+{
+
+ /**
+ * Constructs a new GenericSignatureFormatError
.
+ */
+ public GenericSignatureFormatError()
+ {
+ }
+
+}
Index: java/lang/reflect/ParameterizedType.java
===================================================================
RCS file: java/lang/reflect/ParameterizedType.java
diff -N java/lang/reflect/ParameterizedType.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/lang/reflect/ParameterizedType.java 20 Feb 2005 23:30:43 -0000
@@ -0,0 +1,122 @@
+/* ParameterizedType.java -- Represents parameterized types e.g. List
+ * Represents a type which is parameterized over one or more other
+ * types. For example, List<Integer>
is a parameterized
+ * type, with List
parameterized over the type
+ * Integer
.
+ *
+ * Instances of this classes are created as needed, during reflection.
+ * On creating a parameterized type, p
, the
+ * GenericTypeDeclaration
corresponding to p
+ * is created and resolved. Each type argument of p
+ * is then created recursively; details of this process are availble
+ * in the documentation of TypeVariable
. This creation
+ * process only happens once; repetition has no effect.
+ *
+ * Implementors of this interface must implement an appropriate
+ * equals()
method. This method should equate any
+ * two instances of the implementing class that have the same
+ * GenericTypeDeclaration
and Type
+ * parameters.
+ *
+ * @author Tom Tromey (address@hidden)
+ * @author Andrew John Hughes (address@hidden)
+ * @see GenericTypeDeclaration
+ * @see TypeVariable
+ * @since 1.5
+ */
+public interface ParameterizedType
+ extends Type
+{
+
+ /**
+ *
+ * Returns an array of Type
objects, which gives
+ * the parameters of this type.
+ *
+ * Note: the returned array may be empty. This
+ * occurs if the supposed ParameterizedType
is simply
+ * a normal type wrapped inside a parameterized type.
+ *
Type
s, representing the arguments
+ * of this type.
+ * @throws TypeNotPresentException if any of the types referred to by
+ * the parameters of this type do not actually exist.
+ * @throws MalformedParameterizedTypeException if any of the types
+ * refer to a type which can not be instantiated.
+ */
+ Type[] getActualTypeArguments();
+
+ /**
+ * Returns the type of which this type is a member. For example,
+ * in Top<String>.Bottom<Integer>
,
+ * Bottom<Integer>
is a member of
+ * Top<String>
, and so the latter is returned
+ * by this method. Calling this method on top-level types (such as
+ * Top<String>
) returns null.
+ *
+ * @return the type which owns this type.
+ * @throws TypeNotPresentException if the owner type referred to by
+ * this type do not actually exist.
+ * @throws MalformedParameterizedTypeException if the owner type
+ * referred to by this type can not be instantiated.
+ */
+ Type getOwnerType();
+
+ /**
+ * Returns a version of this type without parameters, which corresponds
+ * to the class or interface which declared the type. For example,
+ * the raw type corresponding to List<Double>
+ * is List
, which was declared by the List
+ * class.
+ *
+ * @return the raw variant of this type (i.e. the type without
+ * parameters).
+ */
+ Type getRawType();
+
+}
Index: java/lang/reflect/Type.java
===================================================================
RCS file: java/lang/reflect/Type.java
diff -N java/lang/reflect/Type.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/lang/reflect/Type.java 20 Feb 2005 23:30:43 -0000
@@ -0,0 +1,55 @@
+/* Type.java - Superinterface for all types.
+ Copyright (C) 2004, 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., 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;
+
+/**
+ * Represents any Type
within the Java programming
+ * language. This may be a primitive type (e.g. int
,
+ * an array type (e.g. double[]>/code>), a raw type
+ * (e.g. Calendar
), a parameterized type
+ * (e.g. List<Boolean>
, or a type
+ * variable (e.g. T extends String
).
+ *
+ * @author Tom Tromey (address@hidden)
+ * @author Andrew John Hughes (address@hidden)
+ * @since 1.5
+ */
+public interface Type
+{
+}
Index: java/lang/reflect/WildcardType.java
===================================================================
RCS file: java/lang/reflect/WildcardType.java
diff -N java/lang/reflect/WildcardType.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/lang/reflect/WildcardType.java 20 Feb 2005 23:30:43 -0000
@@ -0,0 +1,115 @@
+/* WildcardType.java -- A wildcard type expression e.g. ? extends String
+ Copyright (C) 2004, 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., 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;
+
+/**
+ * Represents a wildcard type expression, where the type variable
+ * is unnamed. The simplest example of this is ?
,
+ * which represents any unbounded type. Another example is
+ * ? extends Number
, which specifies any type
+ * which is a subclass of Number
(Number
+ * is the upper bound).
+ *
+ *
+ * ? super String
gives the type a less common lower bound,
+ * which means that the type must be either a String
or one
+ * of its superclasses. This can be useful in working with collections.
+ * You may want a method to add instances of a class to a collection
+ * with a more generic type (e.g. adding String
s to
+ * a list of Object
s), but don't want to allow users
+ * to pass in a collection with a more specific type.
+ *
+ *
+ * @author Tom Tromey (address@hidden)
+ * @author Andrew John Hughes (address@hidden)
+ * @since 1.5
+ */
+public interface WildcardType extends Type
+{
+
+ /**
+ *
+ * Returns an array of Type
s, which specify the
+ * lower bounds of this type. The default lower bound is
+ * null
, which causes this method to return an
+ * empty array.
+ *
+ *
+ * In generating the array of Type
s, each
+ * ParameterizedType
or TypeVariable
is
+ * created, (see the documentation for these classes for details of this
+ * process), if necessary, while all other types are simply
+ * resolved.
+ *
+ *
+ * @return an array of Type
objects, representing
+ * the wildcard type's lower bounds.
+ * @throws TypeNotPresentException if any of the types referred to by
+ * the lower bounds of this type do not actually exist.
+ * @throws MalformedParameterizedTypeException if any of the types
+ * refer to a type which can not be instantiated.
+ */
+ Type[] getLowerBounds();
+
+ /**
+ *
+ * Returns an array of Type
s, which specify the
+ * upper bounds of this type. The default upper bound is
+ * Object
, which causes this method to return an
+ * array, containing just the Type
instance for
+ * Object
.
+ *
+ *
+ * In generating the array of Type
s, each
+ * ParameterizedType
or TypeVariable
is
+ * created, (see the documentation for these classes for details of this
+ * process), if necessary, while all other types are simply
+ * resolved.
+ *
+ *
+ * @return an array of Type
objects, representing
+ * the wildcard type's upper bounds.
+ * @throws TypeNotPresentException if any of the types referred to by
+ * the upper bounds of this type do not actually exist.
+ * @throws MalformedParameterizedTypeException if any of the types
+ * refer to a type which can not be instantiated.
+ */
+ Type[] getUpperBounds();
+
+}