diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2012-11-27 04:08:20 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2012-11-27 04:08:20 +0000 |
commit | 449a0b97ab63a4bff26ae281322fc3afaab16569 (patch) | |
tree | 0eec62720551c4a9709c8f961be12c2466fa3543 /javax/lang/model/element/TypeParameterElement.java | |
parent | 75fab280b83e1d86b396276da8e1e5b1ec6c0169 (diff) | |
download | classpath-449a0b97ab63a4bff26ae281322fc3afaab16569.tar.gz |
Add annotation elements and start of type hierarchy.
2012-11-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/lang/model/element/AnnotationMirror.java:
Added.
(getAnnotationType()): Added.
(getElementValues()): Likewise.
* javax/lang/model/element/AnnotationValue.java:
Added.
(accept(AnnotationValueVisitor,P)): Added.
(getValue()): Likewise.
(toString()): Likewise.
* javax/lang/model/element/AnnotationValueVisitor.java:
Added.
(visit(AnnotationValue)): Added.
(visit(AnnotationValue, P)): Likewise.
(visitAnnotation(AnnotationMirror, P)): Likewise.
(visitArray(List, P)): Likewise.
(visitBoolean(boolean, P)): Likewise.
(visitByte(byte, P)): Likewise.
(visitChar(char, P)): Likewise.
(visitDouble(double, P)): Likewise.
(visitEnumConstant(VariableElement, P)): Likewise.
(visitFloat(float, P)): Likewise.
(visitInt(float, P)): Likewise.
(visitLong(long, P)): Likewise.
(visitShort(short, P)): Likewise.
(visitString(String, P)): Likewise.
(visitType(TypeMirror, P)): Likewise.
(visitUnknown(AnnotationValue, P)): Likewise.
* javax/lang/model/element/Element.java:
(asType()): Added.
(getAnnotationMirrors()): Likewise.
* javax/lang/model/element/ElementVisitor.java:
(visitExecutable(ExecutableElement, P)): Added.
(visitTypeParameter(TypeParameterElement, P)): Likewise.
(visitVariable(VariableElement, P)): Likewise.
* javax/lang/model/element/ExecutableElement.java:
Added.
(getDefaultValue()): Added.
(getParameters()): Likewise.
(getReturnType()): Likewise.
(getThrownTypes()): Likewise.
(getTypeParameters()): Likewise.
(isVarArgs()): Likewise.
* javax/lang/model/element/TypeElement.java:
(getInterfaces()): Added.
(getSuperclass()): Likewise.
(getTypeParameters()): Likewise.
* javax/lang/model/element/TypeParameterElement.java:
Added.
(getBounds()): Added.
(getGenericElement()): Likewise.
* javax/lang/model/element/VariableElement.java:
Added.
(getConstantValue()): Added.
* javax/lang/model/type/DeclaredType.java:
Added.
(asElement()): Added.
(getEnclosingType()): Likewise.
(getTypeArguments()): Likewise.
* javax/lang/model/type/ReferenceType.java:
Added.
* javax/lang/model/type/TypeKind.java:
Added.
(ARRAY): Added.
(BOOLEAN): Likewise.
(BYTE): Likewise.
(CHAR): Likewise.
(DECLARED): Likewise.
(DOUBLE): Likewise.
(ERROR): Likewise.
(EXECUTABLE): Likewise.
(FLOAT): Likewise.
(INT): Likewise.
(LONG): Likewise.
(NONE): Likewise.
(NULL): Likewise.
(OTHER): Likewise.
(PACKAGE): Likewise.
(SHORT): Likewise.
(TYPEVAR): Likewise.
(VOID): Likewise.
(WILDCARD): Likewise.
(isPrimitive()): Implemented.
* javax/lang/model/type/TypeMirror.java:
Added.
(accept(TypeVisitor, P)): Added.
(equals(Object)): Likewise.
(getKind()): Likewise.
(hashCode()): Likewise.
(toString()): Likewise.
* javax/lang/model/type/TypeVisitor.java:
Added.
(visit(TypeMirror)): Added.
(visit(TypeMirror, P)): Likewise.
(visitUnknown(TypeMirror, P)): Likewise.
(visitDeclared(DeclaredType, P)): Likewise.
* javax/lang/model/util/Elements.java:
(getAllAnnotationMirrors(Element)): Added.
(getElementValuesWithDefaults(AnnotationMirror)): Likewise.
(overrides(ExecutableElement, ExecutableElement)): Likewise.
* javax/lang/model/util/Types.java:
(asElement(TypeMirror)): Added.
(asMemberOf(DeclaredType, Element)): Likewise.
(capture(TypeMirror)): Likewise.
(contains(TypeMirror, TypeMirror)): Likewise.
(directSupertypes(TypeMirror)): Likewise.
(erasure(TypeMirror)): Likewise.
(getDeclaredType(DeclaredType, TypeElement,
TypeMirror...)): Likewise.
(getDeclaredType(TypeElement, TypeMirror...)):
Likewise.
(isAssignable(TypeMirror, TypeMirror)): Likewise.
(isSameType(TypeMirror, TypeMirror)): Likewise.
(isSubtype(TypeMirror, TypeMirror)): Likewise.
Signed-off-by: Andrew John Hughes <gnu_andrew@member.fsf.org>
Diffstat (limited to 'javax/lang/model/element/TypeParameterElement.java')
-rw-r--r-- | javax/lang/model/element/TypeParameterElement.java | 82 |
1 files changed, 82 insertions, 0 deletions
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(); + +} |