summaryrefslogtreecommitdiff
path: root/javax/lang/model/element
diff options
context:
space:
mode:
Diffstat (limited to 'javax/lang/model/element')
-rw-r--r--javax/lang/model/element/AnnotationMirror.java78
-rw-r--r--javax/lang/model/element/AnnotationValue.java86
-rw-r--r--javax/lang/model/element/AnnotationValueVisitor.java224
-rw-r--r--javax/lang/model/element/Element.java28
-rw-r--r--javax/lang/model/element/ElementVisitor.java29
-rw-r--r--javax/lang/model/element/ExecutableElement.java113
-rw-r--r--javax/lang/model/element/TypeElement.java36
-rw-r--r--javax/lang/model/element/TypeParameterElement.java82
-rw-r--r--javax/lang/model/element/VariableElement.java63
9 files changed, 738 insertions, 1 deletions
diff --git a/javax/lang/model/element/AnnotationMirror.java b/javax/lang/model/element/AnnotationMirror.java
new file mode 100644
index 000000000..eeaf688e8
--- /dev/null
+++ b/javax/lang/model/element/AnnotationMirror.java
@@ -0,0 +1,78 @@
+/* AnnotationMirror.java -- Represents an annotation.
+ 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.element;
+
+import java.util.Map;
+
+import javax.lang.model.type.DeclaredType;
+
+/**
+ * Represents an annotation. An annotation associates values
+ * with the elements of an annotation type. Annotations should
+ * be compared using {@link #equals(Object)}. There is no guarantee
+ * that the same annotation is always represented by the same
+ * instance.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface AnnotationMirror
+{
+
+ /**
+ * Returns the type of this annotation.
+ *
+ * @return the type of this annotation.
+ */
+ DeclaredType getAnnotationType();
+
+ /**
+ * Returns a map of elements to their values. Only those
+ * elements explicitly set in the annotation are present;
+ * default values are not included. To obtain the default
+ * values as well, use
+ * {@link javax.lang.model.util.Elements#getElementValuesWithDefaults(AnnotationMirror)}
+ * A marker annotation, by definition, returns an empty map.
+ * The order of the elements in the map follows that of the
+ * source code.
+ *
+ * @return the map of elements to values.
+ */
+ Map<? extends ExecutableElement, ? extends AnnotationValue> getElementValues();
+
+}
diff --git a/javax/lang/model/element/AnnotationValue.java b/javax/lang/model/element/AnnotationValue.java
new file mode 100644
index 000000000..d25ce4205
--- /dev/null
+++ b/javax/lang/model/element/AnnotationValue.java
@@ -0,0 +1,86 @@
+/* AnnotationValue.java -- Represents an annotation value.
+ 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.element;
+
+/**
+ * <p>Represents the value of an element in an annotation. This
+ * may be one of the following types:</p>
+ * <ul>
+ * <li>a wrapper class for a primitive type (e.g. {@code Integer}
+ * for {@code int}.</li>
+ * <li>{@code String}</li>
+ * <li>{@code TypeMirror}</li>
+ * <li>{@code VariableElement} (an enum constant)</li>
+ * <li>{@code AnnotationMirror}</li>
+ * <li>{@code List<? extends AnnotationValue>} (an array,
+ * with elements in the order they were declared)</li>
+ * </ol>
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface AnnotationValue
+{
+
+ /**
+ * Applies a visitor to this type.
+ *
+ * @param <R> the return type of the visitor's methods.
+ * @param <P> the type of the additional parameter used in the visitor's
+ * methods.
+ * @param visitor the visitor to apply to the element.
+ * @param param the additional parameter to be sent to the visitor.
+ * @return the return value from the visitor.
+ */
+ <R,P> R accept(AnnotationValueVisitor<R,P> visitor, P param);
+
+ /**
+ * Returns the value.
+ *
+ * @return the value.
+ */
+ Object getValue();
+
+ /**
+ * Returns a textual representation of the value.
+ *
+ * @return a textual representation.
+ */
+ String toString();
+
+}
diff --git a/javax/lang/model/element/AnnotationValueVisitor.java b/javax/lang/model/element/AnnotationValueVisitor.java
new file mode 100644
index 000000000..141aed6df
--- /dev/null
+++ b/javax/lang/model/element/AnnotationValueVisitor.java
@@ -0,0 +1,224 @@
+/* AnnotationValueVisitor.java -- A visitor of annotation values.
+ 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.element;
+
+import java.util.List;
+
+import javax.lang.model.type.TypeMirror;
+
+/**
+ * <p>A visitor for annotation values. Unlike other visitors, such
+ * as {@link ElementVisitor} and {@link javax.lang.model.type.TypeVisitor},
+ * which work on a concrete type hierarchy, this visitor dispatches based
+ * on the type of data stored in the annotation, some of which don't have
+ * distinct subclasses for storing them (e.g. primitives like {@code boolean}
+ * and {@code int}.</p>
+ * <p> The visitor is used when the specific type is not known at compile
+ * time. A visitor instance is passed to the
+ * {@link AnnotationValue#accept(AnnotationValueVisitor,P)} method of
+ * the type, which then calls the specific {@code visitN} method
+ * appropriate to that specific type.</p>
+ * <p>The additional parameter supplied to visitor methods may or
+ * may not be optional, and so the class is free to throw a
+ * {@code NullPointerException} if {@code null} is passed as the
+ * additional parameter.</p>
+ * <p>As this interface may be extended to accomodate future language
+ * versions, implementators are encouraged to extend one of the
+ * appropriate abstract classes rather than implementating this
+ * interface. However, this interface should be used as the type
+ * for parameters and return values.</p>
+ *
+ * @param <R> the return type of the visitor's methods. {@code Void}
+ * can be used where there is no return value.
+ * @param <P> the type of the additional parameter supplied to the visitor's
+ * methods.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface AnnotationValueVisitor<R,P>
+{
+
+ /**
+ * A convenience method for use when there is no additional
+ * parameter to pass. This is equivalent to {@code #visit(value, null)}.
+ *
+ * @param value the value to visit.
+ * @return the return value specific to the visitor.
+ */
+ R visit(AnnotationValue value);
+
+ /**
+ * Visits a value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visit(AnnotationValue value, P param);
+
+ /**
+ * Visits an annotation value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitAnnotation(AnnotationMirror value, P param);
+
+ /**
+ * Visits an array value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitArray(List<? extends AnnotationValue> value, P param);
+
+ /**
+ * Visits a boolean value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitBoolean(boolean value, P param);
+
+ /**
+ * Visits a byte value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitByte(byte value, P param);
+
+ /**
+ * Visits a character value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitChar(char value, P param);
+
+ /**
+ * Visits a double value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitDouble(double value, P param);
+
+ /**
+ * Visits an enum value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitEnumConstant(VariableElement value, P param);
+
+ /**
+ * Visits a float value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitFloat(float value, P param);
+
+ /**
+ * Visits an int value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitInt(int value, P param);
+
+ /**
+ * Visits a long value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitLong(long value, P param);
+
+ /**
+ * Visits a short value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitShort(short value, P param);
+
+ /**
+ * Visits a {@code String} value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitString(String value, P param);
+
+ /**
+ * Visits a type value.
+ *
+ * @param value the value to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitType(TypeMirror value, P param);
+
+ /**
+ * Visits an unknown type of value. This method is called if
+ * a new type is added to the hierarchy which isn't yet
+ * handled by the visitor.
+ *
+ * @param value the value 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 visitUnknown(AnnotationValue value, P param);
+
+}
diff --git a/javax/lang/model/element/Element.java b/javax/lang/model/element/Element.java
index 8f4adfbbf..aa01a8e91 100644
--- a/javax/lang/model/element/Element.java
+++ b/javax/lang/model/element/Element.java
@@ -41,6 +41,8 @@ import java.lang.annotation.Annotation;
import java.util.List;
+import javax.lang.model.type.TypeMirror;
+
/**
* <p>
* Represents a program element at the language level. For example,
@@ -159,4 +161,30 @@ public interface Element
*/
int hashCode();
+ /**
+ * Returns the type defined by this element. A generic
+ * element defines not one type, but a family of types.
+ * For such elements, a prototypical type is returned
+ * i.e. the element {@code Set<N extends Number>} will
+ * return the type {@code Set<N>}. The methods of
+ * {@link javax.lang.model.util.Types} should be used to
+ * obtain the full family of types.
+ *
+ * @return the type defined by this element.
+ * @see javax.lang.model.util.Types
+ */
+ TypeMirror asType();
+
+ /**
+ * Returns the annotations directly present on this element.
+ * To obtain inherited annotations as well, call
+ * the {@link javax.lang.model.util.Elements#getAllAnnotationMirrors()}
+ * method of {@link javax.lang.model.util.Elements}.
+ *
+ * @return the annotations directly present on this element or
+ * an empty list if there are none.
+ * @see javax.lang.model.util.ElementFilter
+ */
+ List<? extends AnnotationMirror> getAnnotationMirrors();
+
}
diff --git a/javax/lang/model/element/ElementVisitor.java b/javax/lang/model/element/ElementVisitor.java
index fd184c968..656795daa 100644
--- a/javax/lang/model/element/ElementVisitor.java
+++ b/javax/lang/model/element/ElementVisitor.java
@@ -66,7 +66,7 @@ public interface ElementVisitor<R,P>
/**
* A convenience method for use when there is no additional
- * parameter to pass. This is equivalent to {@code #visit(e, null)}.
+ * parameter to pass. This is equivalent to {@code #visit(element, null)}.
*
* @param element the element to visit.
* @return the return value specific to the visitor.
@@ -103,4 +103,31 @@ public interface ElementVisitor<R,P>
*/
R visitUnknown(Element element, P param);
+ /**
+ * Visits an executable element.
+ *
+ * @param element the type element to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitExecutable(ExecutableElement element, P param);
+
+ /**
+ * Visits a type parameter element.
+ *
+ * @param element the type element to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitTypeParameter(TypeParameterElement element, P param);
+
+ /**
+ * Visits a variable element.
+ *
+ * @param element the type element to visit.
+ * @param param the additional parameter, specific to the visitor.
+ * May be {@code null} if permitted by the visitor.
+ */
+ R visitVariable(VariableElement element, P param);
+
}
diff --git a/javax/lang/model/element/ExecutableElement.java b/javax/lang/model/element/ExecutableElement.java
new file mode 100644
index 000000000..389eff07e
--- /dev/null
+++ b/javax/lang/model/element/ExecutableElement.java
@@ -0,0 +1,113 @@
+/* ExecutableElement.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.element;
+
+import java.util.List;
+
+import javax.lang.model.type.TypeMirror;
+
+/**
+ * Represents a method, constructor or initialiser (static
+ * or instance) for a class or interface (including annotation
+ * types).
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ * @see javax.lang.model.type.ExecutableType
+ */
+public interface ExecutableElement
+ extends Element
+{
+
+ /**
+ * Returns the default value of this type if this is an
+ * annotation with a default, or {@code null} otherwise.
+ *
+ * @return the default value or {@code null}.
+ */
+ AnnotationValue getDefaultValue();
+
+ /**
+ * Returns the formal parameters of this executable
+ * in the order they were declared. If there are no
+ * parameters, the list is empty.
+ *
+ * @return the formal parameters.
+ */
+ List<? extends VariableElement> getParameters();
+
+ /**
+ * Returns the return type of this executable or
+ * an instance of {@link javax.lang.model.type.NoType}
+ * with the kind {@link javax.lang.model.type.TypeKind#VOID}
+ * if there is no return type or this is a
+ * constructor or initialiser.
+ *
+ * @return the return type of the executbale.
+ */
+ TypeMirror getReturnType();
+
+ /**
+ * Returns the exceptions or other throwables listed
+ * in the {@code throws} clause in the order they
+ * are declared. The list is empty if there is no
+ * {@code throws} clause.
+ *
+ * @return the exceptions or other throwables listed
+ * as thrown by this executable.
+ */
+ List<? extends TypeMirror> getThrownTypes();
+
+ /**
+ * Returns the formal type parameters of this executable
+ * in the order they were declared. The list is empty
+ * if there are no type parameters.
+ *
+ * @return the formal type parameters.
+ */
+ List<? extends TypeParameterElement> getTypeParameters();
+
+ /**
+ * Returns {@code true} if this method or constructor accepts
+ * a variable number of arguments.
+ *
+ * @return true if this is a varargs method or constructor.
+ */
+ boolean isVarArgs();
+
+}
diff --git a/javax/lang/model/element/TypeElement.java b/javax/lang/model/element/TypeElement.java
index 6cc0c6805..c6b76197e 100644
--- a/javax/lang/model/element/TypeElement.java
+++ b/javax/lang/model/element/TypeElement.java
@@ -37,6 +37,10 @@ exception statement from your version. */
package javax.lang.model.element;
+import java.util.List;
+
+import javax.lang.model.type.TypeMirror;
+
/**
* <p>Represents a class or interface program element.
* Note that enumerations are a kind of class and annotations
@@ -63,4 +67,36 @@ package javax.lang.model.element;
public interface TypeElement
extends Element
{
+
+ /**
+ * Returns the interface types directly implemented by this
+ * class or extended by this interface. If there are none,
+ * an empty list is returned.
+ *
+ * @return the interface types directly implemented by this
+ * class or extended by this interface.
+ */
+ List<? extends TypeMirror> getInterfaces();
+
+ /**
+ * Returns the direct superclass of this element. If this
+ * is an interface or the class {@link Object}, then a
+ * instance of {@link javax.lang.model.type.NoType} with
+ * the kind {@link javax.lang.model.type.TypeKind#NONE} is
+ * returned.
+ *
+ * @return the direct superclass or {@code NoType} if there
+ * isn't one.
+ */
+ TypeMirror getSuperclass();
+
+ /**
+ * Returns the formal type parameters of this element in the
+ * order they were declared. If there are none, then an empty
+ * list is returned.
+ *
+ * @return the formal type parameters.
+ */
+ List<? extends TypeParameterElement> getTypeParameters();
+
}
diff --git a/javax/lang/model/element/TypeParameterElement.java b/javax/lang/model/element/TypeParameterElement.java
new file mode 100644
index 000000000..fa5fb7424
--- /dev/null
+++ b/javax/lang/model/element/TypeParameterElement.java
@@ -0,0 +1,82 @@
+/* TypeParameterElement.java -- Represents a formal type parameter.
+ 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.element;
+
+import java.util.List;
+
+import javax.lang.model.type.TypeMirror;
+
+/**
+ * Represents a formal type parameter used by a generic class,
+ * interface, method or constructor element. A type parameter
+ * is a declaration of a {@link javax.lang.model.type.TypeVariable}.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ * @see javax.lang.model.type.TypeVariable
+ */
+public interface TypeParameterElement
+ extends Element
+{
+
+ /**
+ * Returns the bounds of the type parameter. These are the types
+ * declared after the {@code extends} clause. For example,
+ * the bounds for the type parameter {@code T} in
+ * {@code Set<T extends Integer>} would be a single element
+ * list containing the type mirror for {@code Integer}. Similarly,
+ * for {@code Set<T extends Number & Runnable>}, the bounds
+ * would be a two element list containing the type mirrors
+ * for {@code Number} and {@code Runnable}. For a parameter
+ * with no explicit bounds, {@code Object} is assumed to be
+ * the sole bound and an empty list is returned.
+ *
+ * @return the bounds of this type parameter, or an empty list if
+ * there are none.
+ */
+ List<? extends TypeMirror> getBounds();
+
+ /**
+ * Returns the generic class, interface, method or constructor
+ * in which this type parameter is used.
+ *
+ * @return the element parameterised by this type parameter.
+ */
+ Element getGenericElement();
+
+}
diff --git a/javax/lang/model/element/VariableElement.java b/javax/lang/model/element/VariableElement.java
new file mode 100644
index 000000000..2ff817f15
--- /dev/null
+++ b/javax/lang/model/element/VariableElement.java
@@ -0,0 +1,63 @@
+/* VariableElement.java -- Represents a field, enum constant, parameter or 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.element;
+
+/**
+ * Represents a field, enumeration constant, local variable or
+ * a method, constructor or exception parameter.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface VariableElement
+ extends Element
+{
+
+ /**
+ * Returns the constant value of the field if it has one
+ * or {@code null} otherwise. To have a constant value,
+ * a field must be declared {@code final} and be of either
+ * a primitive type or of type {@code String}. Enumeration
+ * constants do not meet this criteria and are not compile-time
+ * constants.
+ *
+ * @return the constant value of this variable if applicable.
+ */
+ Object getConstantValue();
+
+}