This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Modifier and Type | Field and Description |
|---|---|
| private static final Set | |
| private final Symtab | |
| private final Types |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Element | asElement(TypeMirror t)
Implements javax. Returns the element corresponding to a type. |
| public TypeMirror | Returns: the type of the element as viewed from the containing typethe containing type containing, Element the element element)Implements javax. Returns the type of an element when that element is viewed as a member of, or otherwise directly contained by, a given type. |
| public TypeElement | boxedClass(PrimitiveType p)
Implements javax. Returns the class of a boxed value of the primitive type argument. |
| public TypeMirror | capture(TypeMirror t)
Implements javax. Applies capture conversion to a type. |
| private static <T> T | |
| public boolean | contains(TypeMirror t1, TypeMirror t2)
Implements javax. Tests whether one type argument contains another. |
| public List | directSupertypes(TypeMirror t)
Implements javax. Returns the direct supertypes of a type. |
| public TypeMirror | |
| public ArrayType | getArrayType(TypeMirror componentType)
Implements javax. Returns an array type with the specified component type. |
| public DeclaredType | getDeclaredType(TypeElement typeElem, TypeMirror... typeArgs)
Implements javax. Returns the type corresponding to a type element and actual type arguments. |
| public DeclaredType | getDeclaredType(DeclaredType enclosing, TypeElement typeElem, TypeMirror... typeArgs)
Implements javax. Returns the type corresponding to a type element and actual type arguments, given a containing type of which it is a member. |
| private DeclaredType | |
| public NoType | getNoType(TypeKind kind)
Implements javax. Returns a pseudo-type used where no actual type is appropriate. |
| public NullType | |
| public Set | |
| public PrimitiveType | getPrimitiveType(TypeKind kind)
Implements javax. Returns a primitive type. |
| public WildcardType | getWildcardType(TypeMirror extendsBound, TypeMirror superBound)
Implements javax. Returns a new wildcard type. |
| public static JavacTypes | |
| public boolean | isAssignable(TypeMirror t1, TypeMirror t2)
Implements javax. Tests whether one type is assignable to another. |
| public boolean | isSameType(TypeMirror t1, TypeMirror t2)
Implements javax. Tests whether two |
| public boolean | isSubsignature(ExecutableType m1, ExecutableType m2)
Implements javax. Tests whether the signature of one method is a subsignature of another. |
| public boolean | isSubtype(TypeMirror t1, TypeMirror t2)
Implements javax. Tests whether one type is a subtype of another. |
| public <T extends TypeMirror> T | stripAnnotations(T t)
Overrides default javax. Returns a type mirror equivalent to the argument, but with no annotations. |
| public PrimitiveType | unboxedType(TypeMirror t)
Implements javax. Returns the type (a primitive type) of unboxed values of a given type. |
| private void | validateTypeNotIn(TypeMirror t, Set<TypeKind> invalidKinds)
Throws an IllegalArgumentException if a type's kind is one of a set. |
| EXEC_OR_PKG_OR_MOD | back to summary |
|---|---|
| private static final Set<TypeKind> EXEC_OR_PKG_OR_MOD | |
| syms | back to summary |
|---|---|
| private final Symtab syms | |
| types | back to summary |
|---|---|
| private final Types types | |
| JavacTypes | back to summary |
|---|---|
protected JavacTypes(Context context)
| |
| asElement | back to summary |
|---|---|
| public Element asElement(TypeMirror t) Implements javax. Doc from javax. Returns the element corresponding to a type. The type may be one of:
null if the type is not one with a
corresponding element.
Types without corresponding elements include:
| |
| asMemberOf | back to summary |
|---|---|
| public TypeMirror asMemberOf(DeclaredType containing, Element element) Implements javax. Returns the type of an element when that element is viewed as
a member of, or otherwise directly contained by, a given type.
For example,
when viewed as a member of the parameterized type
| |
| boxedClass | back to summary |
|---|---|
| public TypeElement boxedClass(PrimitiveType p) Implements javax. Doc from javax. Returns the class of a boxed value of the primitive type argument. That is, boxing conversion is applied.
| |
| capture | back to summary |
|---|---|
| public TypeMirror capture(TypeMirror t) Implements javax. Doc from javax. Applies capture conversion to a type.
| |
| cast | back to summary |
|---|---|
| private static <T> T cast(Class<T> clazz, Object o) Returns an object cast to the specified type.
| |
| contains | back to summary |
|---|---|
| public boolean contains(TypeMirror t1, TypeMirror t2) Implements javax. Doc from javax. Tests whether one type argument contains another.
| |
| directSupertypes | back to summary |
|---|---|
| public List Implements javax. Doc from javax. Returns the direct supertypes of a type. The interface types, if any,
will appear last in the list. For an interface type with no direct
super-interfaces, a type mirror representing
| |
| erasure | back to summary |
|---|---|
| public TypeMirror erasure(TypeMirror t) Implements javax. Doc from javax. Returns the erasure of a type.
| |
| getArrayType | back to summary |
|---|---|
| public ArrayType getArrayType(TypeMirror componentType) Implements javax. Doc from javax. Returns an array type with the specified component type. Annotations on the component type are preserved.
| |
| getDeclaredType | back to summary |
|---|---|
| public DeclaredType getDeclaredType(TypeElement typeElem, TypeMirror... typeArgs) Implements javax. Doc from javax. Returns the type corresponding to a type element and
actual type arguments.
Given the type element for The number of type arguments must either equal the number of the type element's formal type parameters, or must be zero. If zero, and if the type element is generic, then the type element's raw type is returned. If a parameterized type is being returned, its type element
must not be contained within a generic outer class.
The parameterized type
| |
| getDeclaredType | back to summary |
|---|---|
| public DeclaredType getDeclaredType(DeclaredType enclosing, TypeElement typeElem, TypeMirror... typeArgs) Implements javax. Doc from javax. Returns the type corresponding to a type element
and actual type arguments, given a
containing type
of which it is a member.
The parameterized type If the containing type is a parameterized type,
the number of type arguments must be equal to the
number of
| |
| getDeclaredType0 | back to summary |
|---|---|
| private DeclaredType getDeclaredType0(Type outer, Symbol. | |
| getNoType | back to summary |
|---|---|
| public NoType getNoType(TypeKind kind) Implements javax. Doc from javax. Returns a pseudo-type used where no actual type is appropriate.
The kind of type to return may be either
To get the pseudo-type corresponding to a package or module,
call
| |
| getNullType | back to summary |
|---|---|
| public NullType getNullType() Implements javax. Doc from javax. Returns the null type. This is the type of
| |
| getOverriddenMethods | back to summary |
|---|---|
| public Set | |
| getPrimitiveType | back to summary |
|---|---|
| public PrimitiveType getPrimitiveType(TypeKind kind) Implements javax. Doc from javax. Returns a primitive type.
| |
| getWildcardType | back to summary |
|---|---|
| public WildcardType getWildcardType(TypeMirror extendsBound, TypeMirror superBound) Implements javax. Doc from javax. Returns a new wildcard type. Either of the wildcard's bounds may be specified, or neither, but not both. Annotations on the bounds are preserved.
| |
| instance | back to summary |
|---|---|
| public static JavacTypes instance(Context context) | |
| isAssignable | back to summary |
|---|---|
| public boolean isAssignable(TypeMirror t1, TypeMirror t2) Implements javax. Doc from javax. Tests whether one type is assignable to another.
| |
| isSameType | back to summary |
|---|---|
| public boolean isSameType(TypeMirror t1, TypeMirror t2) Implements javax. Doc from javax. Tests whether two Caveat if either of the arguments to this method represents a wildcard, this method will return false. As a consequence, a wildcard is not the same type as itself. This might be surprising at first, but makes sense once you consider that an example like this must be rejected by the compiler:
Since annotations are only meta-data associated with a type,
the set of annotations on either argument is not taken
into account when computing whether or not two
| |
| isSubsignature | back to summary |
|---|---|
| public boolean isSubsignature(ExecutableType m1, ExecutableType m2) Implements javax. Doc from javax. Tests whether the signature of one method is a subsignature of another.
| |
| isSubtype | back to summary |
|---|---|
| public boolean isSubtype(TypeMirror t1, TypeMirror t2) Implements javax. Doc from javax. Tests whether one type is a subtype of another. Any type is considered to be a subtype of itself.
| |
| stripAnnotations | back to summary |
|---|---|
| public <T extends TypeMirror> T stripAnnotations(T t) Overrides default javax. Doc from javax. Returns a type mirror equivalent to the argument, but with no annotations. If the type mirror is a composite type, such as an array type or a wildcard type, any constituent types, such as the component type of an array and the type of the bounds of a wildcard type, also have no annotations, recursively. For most kinds of type mirrors, the result of types.isSameType(typeMirror, types.stripAnnotations(typeMirror)) true. The predicate is false on wildcard
types for reasons discussed elsewhere.
| |
| unboxedType | back to summary |
|---|---|
| public PrimitiveType unboxedType(TypeMirror t) Implements javax. Doc from javax. Returns the type (a primitive type) of unboxed values of a given type. That is, unboxing conversion is applied.
| |
| validateTypeNotIn | back to summary |
|---|---|
| private void validateTypeNotIn(TypeMirror t, Set<TypeKind> invalidKinds) Throws an IllegalArgumentException if a type's kind is one of a set. | |