summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2012-11-30 11:12:12 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2012-11-30 11:12:12 +0000
commit18e5c7bc1392c64a9b1cc7a86540071eda8e4e5b (patch)
tree9bfddcf990cde0f1f7f9c425e6310b2c0747478b
parentf913ee5ae1a0338aaf622f25429d66fd8c888c63 (diff)
downloadclasspath-18e5c7bc1392c64a9b1cc7a86540071eda8e4e5b.tar.gz
Add remaining TypeMirror subclasses and associated methods.
2012-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org> * javax/lang/model/type/ArrayType.java: Added. (getComponentType()): Added. * javax/lang/model/type/ErrorType.java: Added. * javax/lang/model/type/ExecutableType.java: Added. (getParameterTypes()): Added. (getReturnType()): Likewise. (getThrownTypes()): Likewise. (getTypeVariables()): Likewise. * javax/lang/model/type/NoType.java: Added. * javax/lang/model/type/NullType.java: Added. * javax/lang/model/type/PrimitiveType.java: Added. * javax/lang/model/type/TypeVariable.java: Added. (asElement()): Added. (getLowerBound()): Likewise. (getUpperBound()): Likewise. * javax/lang/model/type/TypeVisitor.java: (visitArray(ArrayType, P)): Added. (visitError(ErrorType, P)): Likewise. (visitExecutable(ExecutableType, P)): Likewise. (visitNoType(NoType, P)): Likewise. (visitNull(NullType, P)): Likewise. (visitPrimitive(PrimitiveType, P)): Likewise. (visitTypeVariable(TypeVariable, P)): Likewise. (visitWildcard(WildcardType, P)): Likewise. * javax/lang/model/type/WildcardType.java: Added. (getExtendsBound()): Likewise. (getSuperBound()): Likewise. * javax/lang/model/util/Types.java, (boxedClass(PrimitiveType)): Likewise. (getArrayType(TypeMirror)): Likewise. (getNoType(TypeKind)): Likewise. (getNullType()): Likewise. (getPrimitiveType(TypeKind)): Likewise. (getWildcardType(TypeMirror, TypeMirror)): Likewise. (isSubsignature(ExecutableType, ExecutableType)): Likewise. (unboxedType(TypeMirror)): Likewise. Signed-off-by: Andrew John Hughes <gnu_andrew@member.fsf.org>
-rw-r--r--ChangeLog48
-rw-r--r--javax/lang/model/type/ArrayType.java59
-rw-r--r--javax/lang/model/type/ErrorType.java51
-rw-r--r--javax/lang/model/type/ExecutableType.java98
-rw-r--r--javax/lang/model/type/NoType.java60
-rw-r--r--javax/lang/model/type/NullType.java50
-rw-r--r--javax/lang/model/type/PrimitiveType.java52
-rw-r--r--javax/lang/model/type/TypeVariable.java87
-rw-r--r--javax/lang/model/type/TypeVisitor.java80
-rw-r--r--javax/lang/model/type/WildcardType.java79
-rw-r--r--javax/lang/model/util/Types.java117
11 files changed, 781 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index dbba91080..40e4ce944 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+2012-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * javax/lang/model/type/ArrayType.java:
+ Added.
+ (getComponentType()): Added.
+ * javax/lang/model/type/ErrorType.java:
+ Added.
+ * javax/lang/model/type/ExecutableType.java:
+ Added.
+ (getParameterTypes()): Added.
+ (getReturnType()): Likewise.
+ (getThrownTypes()): Likewise.
+ (getTypeVariables()): Likewise.
+ * javax/lang/model/type/NoType.java:
+ Added.
+ * javax/lang/model/type/NullType.java:
+ Added.
+ * javax/lang/model/type/PrimitiveType.java:
+ Added.
+ * javax/lang/model/type/TypeVariable.java:
+ Added.
+ (asElement()): Added.
+ (getLowerBound()): Likewise.
+ (getUpperBound()): Likewise.
+ * javax/lang/model/type/TypeVisitor.java:
+ (visitArray(ArrayType, P)): Added.
+ (visitError(ErrorType, P)): Likewise.
+ (visitExecutable(ExecutableType, P)): Likewise.
+ (visitNoType(NoType, P)): Likewise.
+ (visitNull(NullType, P)): Likewise.
+ (visitPrimitive(PrimitiveType, P)): Likewise.
+ (visitTypeVariable(TypeVariable, P)): Likewise.
+ (visitWildcard(WildcardType, P)): Likewise.
+ * javax/lang/model/type/WildcardType.java:
+ Added.
+ (getExtendsBound()): Likewise.
+ (getSuperBound()): Likewise.
+ * javax/lang/model/util/Types.java,
+ (boxedClass(PrimitiveType)): Likewise.
+ (getArrayType(TypeMirror)): Likewise.
+ (getNoType(TypeKind)): Likewise.
+ (getNullType()): Likewise.
+ (getPrimitiveType(TypeKind)): Likewise.
+ (getWildcardType(TypeMirror, TypeMirror)): Likewise.
+ (isSubsignature(ExecutableType, ExecutableType)):
+ Likewise.
+ (unboxedType(TypeMirror)): Likewise.
+
2012-11-29 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/lang/model/element/ElementVisitor.java:
diff --git a/javax/lang/model/type/ArrayType.java b/javax/lang/model/type/ArrayType.java
new file mode 100644
index 000000000..94538bccd
--- /dev/null
+++ b/javax/lang/model/type/ArrayType.java
@@ -0,0 +1,59 @@
+/* ArrayType.java -- Represents an array type.
+ Copyright (C) 2012 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 javax.lang.model.type;
+
+/**
+ * Represents an array type. Multidimensional arrays are
+ * represented as array types where the component type
+ * is also an array type.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface ArrayType
+ extends ReferenceType
+{
+
+ /**
+ * Returns the component type of the array.
+ *
+ * @return the component type.
+ */
+ TypeMirror getComponentType();
+
+}
diff --git a/javax/lang/model/type/ErrorType.java b/javax/lang/model/type/ErrorType.java
new file mode 100644
index 000000000..34ac7a5e3
--- /dev/null
+++ b/javax/lang/model/type/ErrorType.java
@@ -0,0 +1,51 @@
+/* ErrorType.java -- Represents a type that can't be modelled.
+ Copyright (C) 2012 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 javax.lang.model.type;
+
+/**
+ * Represents a type that can't be modelled. This may be as
+ * a result of a number of reasons, such as a missing class file,
+ * an erroneous source file or a processing error.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface ErrorType
+ extends DeclaredType
+{
+}
diff --git a/javax/lang/model/type/ExecutableType.java b/javax/lang/model/type/ExecutableType.java
new file mode 100644
index 000000000..72d81b4b7
--- /dev/null
+++ b/javax/lang/model/type/ExecutableType.java
@@ -0,0 +1,98 @@
+/* ExecutableType.java -- Represents a method, constructor or initialiser.
+ Copyright (C) 2012 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 javax.lang.model.type;
+
+import java.util.List;
+
+/**
+ * Represents something which may be executed i.e. a
+ * constructor, a method or an initialiser. The executable
+ * is viewed respective to a particular type. As a result,
+ * any type parameters will be substituted with actual type
+ * arguments as appropriate.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ * @see
+ */
+public interface ExecutableType
+ extends TypeMirror
+{
+
+ /**
+ * Returns the types of the formal parameters of this
+ * executable, or an empty list if the executable takes
+ * no parameters. For example, {@code doThis(int)} will
+ * return a list containing a single element, the type
+ * mirror for {@code int}.
+ *
+ * @return the executable's formal parameters.
+ */
+ List<? extends TypeMirror> getParameterTypes();
+
+ /**
+ * Returns the return type of the executable. If the
+ * executable is a constructor or an initialiser, or
+ * does not return anything, this method will return
+ * an instance of {@link NoType} with the kind
+ * {@link TypeKind#VOID}.
+ *
+ * @return the return type of this executable.
+ */
+ TypeMirror getReturnType();
+
+ /**
+ * Returns the types of any exceptions or other
+ * {@link Throwable}s mentioned in the {@code throws}
+ * clause of this executable, or an empty list if there
+ * are none.
+ *
+ * @return the exceptions and other throwables declared
+ * as thrown by this executable.
+ */
+ List<? extends TypeMirror> getThrownTypes();
+
+ /**
+ * Returns the type variables declared by the formal type
+ * parameters or an empty list if there are none.
+ *
+ * @return the type variables declared by this executable.
+ */
+ List<? extends TypeVariable> getTypeVariables();
+
+}
diff --git a/javax/lang/model/type/NoType.java b/javax/lang/model/type/NoType.java
new file mode 100644
index 000000000..7cccc436a
--- /dev/null
+++ b/javax/lang/model/type/NoType.java
@@ -0,0 +1,60 @@
+/* NoType.java -- Represents a pseudo-type used when nothing is appropriate.
+ Copyright (C) 2012 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 javax.lang.model.type;
+
+/**
+ * <p>Represents a pseudo-type used when a {@link TypeMirror}
+ * needs to be returned, but there is not one suitable.</p>
+ * <p>Further information is provided by the kind of the
+ * instance, as follows:</p>
+ * <ul>
+ * <li>{@link TypeKind#VOID}; used for method return types.</li>
+ * <li>{@link TypeKind#PACKAGE}; used for packages.</li>
+ * <li>{@link TypeKind#NONE}: used when nothing else fits.
+ * For example, requesting a superclass from
+ * {@code java.lang.Object}.</li>
+ * </ul>
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ * @see javax.lang.model.element.ExecutableElement#getReturnType()
+ */
+public interface NoType
+ extends TypeMirror
+{
+}
diff --git a/javax/lang/model/type/NullType.java b/javax/lang/model/type/NullType.java
new file mode 100644
index 000000000..53f9819bd
--- /dev/null
+++ b/javax/lang/model/type/NullType.java
@@ -0,0 +1,50 @@
+/* NullType.java -- Represents the null type.
+ Copyright (C) 2012 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 javax.lang.model.type;
+
+/**
+ * Represents the null type i.e. the type of the expression
+ * {@code null}.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface NullType
+ extends ReferenceType
+{
+}
diff --git a/javax/lang/model/type/PrimitiveType.java b/javax/lang/model/type/PrimitiveType.java
new file mode 100644
index 000000000..6586079df
--- /dev/null
+++ b/javax/lang/model/type/PrimitiveType.java
@@ -0,0 +1,52 @@
+/* PrimitiveType.java -- Represents a primitive type.
+ Copyright (C) 2012 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 javax.lang.model.type;
+
+/**
+ * Represents a primitive type such as a {@code byte},
+ * {@code boolean}, {@code char}, {@code double},
+ * {@code float}, {@code int}, {@code long} or
+ * {@code short}.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface PrimitiveType
+ extends TypeMirror
+{
+}
diff --git a/javax/lang/model/type/TypeVariable.java b/javax/lang/model/type/TypeVariable.java
new file mode 100644
index 000000000..87b308780
--- /dev/null
+++ b/javax/lang/model/type/TypeVariable.java
@@ -0,0 +1,87 @@
+/* TypeVariable.java -- Represents a type variable.
+ Copyright (C) 2012 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 javax.lang.model.type;
+
+import javax.lang.model.element.Element;
+
+/**
+ * Represents a type variable. Such variables may be the
+ * result of an explicitly declared type parameter on
+ * a type, method or constructor, or be created implicitly
+ * as a function of capture conversion on a wildcard type
+ * argument. See chapter 5 of the Java Language Specification.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface TypeVariable
+ extends ReferenceType
+{
+
+ /**
+ * Returns the element which corresponds to this type variable.
+ *
+ * @return the element corresponding to this type variable.
+ */
+ Element asElement();
+
+ /**
+ * Returns the lower bound of this type variable. While type
+ * variables can not be given an explicit lower bound, a
+ * non-trivial lower bound may be produced through capture
+ * conversion on a wildcard type argument. If this is not the
+ * case, the lower bound will be the {@link NullType}.
+ *
+ * @return the lower bound of this type variable.
+ */
+ TypeMirror getLowerBound();
+
+ /**
+ * Returns the upper bound of this type variable. If an
+ * explicit upper bound was not given, this will return
+ * {@code java.lang.Object}. Where multiple upper bounds
+ * are specified, an intersection type is generated and
+ * represented as an instance of {@link DeclaredType}.
+ * The supertypes of this may be examined to find the
+ * actual bounds specified.
+ *
+ * @return the upper bound of this type variable.
+ */
+ TypeMirror getUpperBound();
+
+}
diff --git a/javax/lang/model/type/TypeVisitor.java b/javax/lang/model/type/TypeVisitor.java
index ea00f5227..df0c2e5f1 100644
--- a/javax/lang/model/type/TypeVisitor.java
+++ b/javax/lang/model/type/TypeVisitor.java
@@ -104,4 +104,84 @@ public interface TypeVisitor<R,P>
*/
R visitDeclared(DeclaredType type, P param);
+ /**
+ * Visits an array type.
+ *
+ * @param type the array type to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ * @return the return value specific to the visitor.
+ */
+ R visitArray(ArrayType type, P param);
+
+ /**
+ * Visits an error type.
+ *
+ * @param type the error type to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ * @return the return value specific to the visitor.
+ */
+ R visitError(ErrorType type, P param);
+
+ /**
+ * Visits an executable type.
+ *
+ * @param type the executable type to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ * @return the return value specific to the visitor.
+ */
+ R visitExecutable(ExecutableType type, P param);
+
+ /**
+ * Visits a {@link NoType} instance.
+ *
+ * @param type the instance to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ * @return the return value specific to the visitor.
+ */
+ R visitNoType(NoType type, P param);
+
+ /**
+ * Visits the null type.
+ *
+ * @param type the type to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ * @return the return value specific to the visitor.
+ */
+ R visitNull(NullType type, P param);
+
+ /**
+ * Visits a primitive type.
+ *
+ * @param type the primitive type to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ * @return the return value specific to the visitor.
+ */
+ R visitPrimitive(PrimitiveType type, P param);
+
+ /**
+ * Visits a type variable.
+ *
+ * @param type the type variable to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ * @return the return value specific to the visitor.
+ */
+ R visitTypeVariable(TypeVariable type, P param);
+
+ /**
+ * Visits a wildcard type.
+ *
+ * @param type the wildcard type to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ * @return the return value specific to the visitor.
+ */
+ R visitWildcard(WildcardType type, P param);
+
}
diff --git a/javax/lang/model/type/WildcardType.java b/javax/lang/model/type/WildcardType.java
new file mode 100644
index 000000000..20dfd827a
--- /dev/null
+++ b/javax/lang/model/type/WildcardType.java
@@ -0,0 +1,79 @@
+/* WildcardType.java -- Represents a wildcard type argument.
+ Copyright (C) 2012 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 javax.lang.model.type;
+
+import javax.lang.model.element.Element;
+
+/**
+ * <p>Represents a wildcard type argument, which may take one
+ * of three forms:</p>
+ * <ul>
+ * <li>{@code ?}</li>
+ * <li>{@code ? extends X}</li>
+ * <li>{@code ? super Y}</li>
+ * </ul>
+ * <p>i.e. it may have no bounds, an upper bound set by
+ * the {@code extends} clause or a lower bound set by
+ * the {@code super} clause, but not both.</p>
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface WildcardType
+ extends TypeMirror
+{
+
+ /**
+ * Returns the upper bound of this wildcard type,
+ * as declared by the {@code extends} clause, or
+ * {@code null} if one wasn't specified.
+ *
+ * @return the upper bound.
+ */
+ TypeMirror getExtendsBound();
+
+ /**
+ * Returns the lower bound of this wildcard type,
+ * as declared by the {@code super} clause, or
+ * {@code null} if one wasn't specified.
+ *
+ * @return the upper bound.
+ */
+ TypeMirror getSuperBound();
+
+}
diff --git a/javax/lang/model/util/Types.java b/javax/lang/model/util/Types.java
index b05008c77..86647d1b6 100644
--- a/javax/lang/model/util/Types.java
+++ b/javax/lang/model/util/Types.java
@@ -42,8 +42,15 @@ import java.util.List;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.ArrayType;
import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.ExecutableType;
+import javax.lang.model.type.NoType;
+import javax.lang.model.type.NullType;
+import javax.lang.model.type.PrimitiveType;
+import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.WildcardType;
/**
* Utility methods for operating on types.
@@ -211,4 +218,114 @@ public interface Types
*/
boolean isSubtype(TypeMirror type1, TypeMirror type2);
+ /**
+ * <p>Returns the class which is used to wrap the given primitive
+ * type, according to the following mapping given in section
+ * 5.1.7 of the Java Language Specification:</p>
+ * <ul>
+ * <li>{@code boolean} ==&gt; {@code Boolean}</li>
+ * <li>{@code byte} ==&gt; {@code Byte}</li>
+ * <li>{@code char} ==&gt; {@code Character}</li>
+ * <li>{@code double} ==&gt; {@code Double}</li>
+ * <li>{@code float} ==&gt; {@code Float}</li>
+ * <li>{@code int} ==&gt; {@code Integer}</li>
+ * <li>{@code long} ==&gt; {@code Long}</li>
+ * <li>{@code short} ==&gt; {@code Short}</li>
+ * </ul>
+ *
+ * @param primitive the primitive type whose wrapper class should
+ * be returned.
+ * @return the wrapper class used for the given primitive type.
+ */
+ TypeElement boxedClass(PrimitiveType primitive);
+
+ /**
+ * Returns an array type with the specified component type.
+ *
+ * @param componentType the component type to be used in the array.
+ * @return an array type using the specified component type.
+ * @throws IllegalArgumentException if the component type given
+ * can not be used in an array.
+ */
+ ArrayType getArrayType(TypeMirror componentType);
+
+ /**
+ * Returns a pseudo-type of the specified kind for use where a real
+ * type is not applicable. Only the kinds {@link TypeKind#VOID}
+ * and {@link TypeKind#NONE} should be passed to this method.
+ * For packages, use
+ * {@code Elements#getPackageElement(CharSequence).asType()}
+ * instead.
+ *
+ * @param kind the kind of {@link NoType} to return.
+ * @return the corresponding instance.
+ * @throws IllegalArgumentException if an invalid kind is given.
+ */
+ NoType getNoType(TypeKind kind);
+
+ /**
+ * Returns the null type i.e. the type of {@code null}.
+ *
+ * @return the null type.
+ */
+ NullType getNullType();
+
+ /**
+ * Returns a primitive type of the given kind.
+ *
+ * @param kind the kind of primitive type to return.
+ * @return the corresponding instance.
+ * @throws IllegalArgumentException if the kind given is not
+ * a primitive type.
+ */
+ PrimitiveType getPrimitiveType(TypeKind kind);
+
+ /**
+ * Returns a wildcard type with the specified bounds.
+ * Each bound is optional and {@code null} may be passed
+ * instead. It is invalid for both bounds to be non-null.
+ *
+ * @param extendsBound the upper bound, which usually follows the
+ * {@code extends clause}, or {@code null}.
+ * @param superBound the lower bound, which usually follows the
+ * {@code super clause}, or {@code null}.
+ * @return the corresponding wildcard type.
+ * @throws IllegalArgumentException if the bounds are invalid.
+ */
+ WildcardType getWildcardType(TypeMirror extendsBound,
+ TypeMirror superBound);
+
+ /**
+ * Returns {@code true} if the signature of {@code method1} is
+ * a subsignature of the signature of {@code method2}, according
+ * to section 8.4.2 of the Java Language Specification.
+ *
+ * @param method1 the first method.
+ * @param method2 the second method.
+ * @return true if method1's signature is a subsignature of method2's.
+ */
+ boolean isSubsignature(ExecutableType method1, ExecutableType method2);
+
+ /**
+ * <p>Returns the primitive type which is used to unwrap the value
+ * contained in the specified wrapper class, according to the following
+ * mapping given in section 5.1.8 of the Java Language Specification:</p>
+ * <ul>
+ * <li>{@code Boolean} ==&gt; {@code boolean}</li>
+ * <li>{@code Byte} ==&gt; {@code byte}</li>
+ * <li>{@code Character} ==&gt; {@code char}</li>
+ * <li>{@code Double} ==&gt; {@code double}</li>
+ * <li>{@code Float} ==&gt; {@code float}</li>
+ * <li>{@code Integer} ==&gt; {@code int}</li>
+ * <li>{@code Long} ==&gt; {@code long}</li>
+ * <li>{@code Short} ==&gt; {@code short}</li>
+ * </ul>
+ *
+ * @param wrapper the wrapper class for which the corresponding primitive
+ * type should be returned.
+ * @return the corresponding primitive type.
+ * @throws IllegalArgumentException if the given class is not a wrapper class.
+ */
+ PrimitiveType unboxedType(TypeMirror wrapper);
+
}