Uses of Interface javax.lang.model.type.TypeMirror (Java Platform SE 8 )
Date: 2026-04-17

## Uses of Interface
javax.lang.model.type.TypeMirror

- Packages that use TypeMirror
  Package | Description
  --- | ---
  javax.lang.model.element | Interfaces used to model elements of the Java programming language.
  javax.lang.model.type | Interfaces used to model Java programming language types.
  javax.lang.model.util | Utilities to assist in the processing of program elements and types.

- - ### Uses of TypeMirror in javax.lang.model.element

    Methods in javax.lang.model.element that return TypeMirror
    Modifier and Type | Method and Description
    --- | ---
    `TypeMirror` | Element.`asType()` Returns the type defined by this element.
    `TypeMirror` | ExecutableElement.`getReceiverType()` Returns the receiver type of this executable, or `NoType` with kind `NONE` if the executable has no receiver type.
    `TypeMirror` | ExecutableElement.`getReturnType()` Returns the return type of this executable.
    `TypeMirror` | TypeElement.`getSuperclass()` Returns the direct superclass of this type element.

    Methods in javax.lang.model.element that return types with arguments of type TypeMirror
    Modifier and Type | Method and Description
    --- | ---
    `List<? extends TypeMirror>` | TypeParameterElement.`getBounds()` Returns the bounds of this type parameter.
    `List<? extends TypeMirror>` | TypeElement.`getInterfaces()` Returns the interface types directly implemented by this class or extended by this interface.
    `List<? extends TypeMirror>` | ExecutableElement.`getThrownTypes()` Returns the exceptions and other throwables listed in this method or constructor's `throws` clause in declaration order.

    Methods in javax.lang.model.element with parameters of type TypeMirror
    Modifier and Type | Method and Description
    --- | ---
    `R` | AnnotationValueVisitor.`visitType(TypeMirror t, P p)` Visits a type value in an annotation.

  - ### Uses of TypeMirror in javax.lang.model.type

    Subinterfaces of TypeMirror in javax.lang.model.type
    Modifier and Type | Interface and Description
    --- | ---
    `interface` | `ArrayType` Represents an array type.
    `interface` | `DeclaredType` Represents a declared type, either a class type or an interface type.
    `interface` | `ErrorType` Represents a class or interface type that cannot be properly modeled.
    `interface` | `ExecutableType` Represents the type of an executable.
    `interface` | `IntersectionType` Represents an intersection type.
    `interface` | `NoType` A pseudo-type used where no actual type is appropriate.
    `interface` | `NullType` Represents the null type.
    `interface` | `PrimitiveType` Represents a primitive type.
    `interface` | `ReferenceType` Represents a reference type.
    `interface` | `TypeVariable` Represents a type variable.
    `interface` | `UnionType` Represents a union type.
    `interface` | `WildcardType` Represents a wildcard type argument.

    Methods in javax.lang.model.type that return TypeMirror
    Modifier and Type | Method and Description
    --- | ---
    `TypeMirror` | ArrayType.`getComponentType()` Returns the component type of this array type.
    `TypeMirror` | DeclaredType.`getEnclosingType()` Returns the type of the innermost enclosing instance or a `NoType` of kind `NONE` if there is no enclosing instance.
    `TypeMirror` | WildcardType.`getExtendsBound()` Returns the upper bound of this wildcard.
    `TypeMirror` | TypeVariable.`getLowerBound()` Returns the lower bound of this type variable.
    `TypeMirror` | ExecutableType.`getReceiverType()` Returns the receiver type of this executable, or `NoType` with kind `NONE` if the executable has no receiver type.
    `TypeMirror` | ExecutableType.`getReturnType()` Returns the return type of this executable.
    `TypeMirror` | WildcardType.`getSuperBound()` Returns the lower bound of this wildcard.
    `TypeMirror` | MirroredTypeException.`getTypeMirror()` Returns the type mirror corresponding to the type being accessed.
    `TypeMirror` | UnknownTypeException.`getUnknownType()` Returns the unknown type.
    `TypeMirror` | TypeVariable.`getUpperBound()` Returns the upper bound of this type variable.

    Methods in javax.lang.model.type that return types with arguments of type TypeMirror
    Modifier and Type | Method and Description
    --- | ---
    `List<? extends TypeMirror>` | UnionType.`getAlternatives()` Return the alternatives comprising this union type.
    `List<? extends TypeMirror>` | IntersectionType.`getBounds()` Return the bounds comprising this intersection type.
    `List<? extends TypeMirror>` | ExecutableType.`getParameterTypes()` Returns the types of this executable's formal parameters.
    `List<? extends TypeMirror>` | ExecutableType.`getThrownTypes()` Returns the exceptions and other throwables listed in this executable's `throws` clause.
    `List<? extends TypeMirror>` | DeclaredType.`getTypeArguments()` Returns the actual type arguments of this type.
    `List<? extends TypeMirror>` | MirroredTypesException.`getTypeMirrors()` Returns the type mirrors corresponding to the types being accessed.

    Methods in javax.lang.model.type with parameters of type TypeMirror
    Modifier and Type | Method and Description
    --- | ---
    `R` | TypeVisitor.`visit(TypeMirror t)` A convenience method equivalent to `v.visit(t, null)`.
    `R` | TypeVisitor.`visit(TypeMirror t, P p)` Visits a type.
    `R` | TypeVisitor.`visitUnknown(TypeMirror t, P p)` Visits an unknown kind of type.

    Constructors in javax.lang.model.type with parameters of type TypeMirror
    Constructor and Description
    `MirroredTypeException(TypeMirror type)` Constructs a new MirroredTypeException for the specified type.
    `UnknownTypeException(TypeMirror t, Object p)` Creates a new `UnknownTypeException`.The `p` parameter may be used to pass in an additional argument with information about the context in which the unknown type was encountered; for example, the visit methods of `TypeVisitor` may pass in their additional parameter.

    Constructor parameters in javax.lang.model.type with type arguments of type TypeMirror
    Constructor and Description
    `MirroredTypesException(List<? extends TypeMirror> types)` Constructs a new MirroredTypesException for the specified types.

  - ### Uses of TypeMirror in javax.lang.model.util

    Methods in javax.lang.model.util that return TypeMirror
    Modifier and Type | Method and Description
    --- | ---
    `TypeMirror` | Types.`asMemberOf(DeclaredType containing, Element element)` Returns the type of an element when that element is viewed as a member of, or otherwise directly contained by, a given type.
    `TypeMirror` | Types.`capture(TypeMirror t)` Applies capture conversion to a type.
    `TypeMirror` | Types.`erasure(TypeMirror t)` Returns the erasure of a type.

    Methods in javax.lang.model.util that return types with arguments of type TypeMirror
    Modifier and Type | Method and Description
    --- | ---
    `List<? extends TypeMirror>` | Types.`directSupertypes(TypeMirror t)` Returns the direct supertypes of a type.

    Methods in javax.lang.model.util with parameters of type TypeMirror
    Modifier and Type | Method and Description
    --- | ---
    `Element` | Types.`asElement(TypeMirror t)` Returns the element corresponding to a type.
    `TypeMirror` | Types.`capture(TypeMirror t)` Applies capture conversion to a type.
    `boolean` | Types.`contains(TypeMirror t1, TypeMirror t2)` Tests whether one type argument contains another.
    `protected R` | SimpleTypeVisitor6.`defaultAction(TypeMirror e, P p)` The default action for visit methods.
    `List<? extends TypeMirror>` | Types.`directSupertypes(TypeMirror t)` Returns the direct supertypes of a type.
    `TypeMirror` | Types.`erasure(TypeMirror t)` Returns the erasure of a type.
    `ArrayType` | Types.`getArrayType(TypeMirror componentType)` Returns an array type with the specified component type.
    `DeclaredType` | Types.`getDeclaredType(DeclaredType containing, TypeElement typeElem, TypeMirror... typeArgs)` Returns the type corresponding to a type element and actual type arguments, given a containing type of which it is a member.
    `DeclaredType` | Types.`getDeclaredType(TypeElement typeElem, TypeMirror... typeArgs)` Returns the type corresponding to a type element and actual type arguments.
    `WildcardType` | Types.`getWildcardType(TypeMirror extendsBound, TypeMirror superBound)` Returns a new wildcard type argument.
    `boolean` | Types.`isAssignable(TypeMirror t1, TypeMirror t2)` Tests whether one type is assignable to another.
    `boolean` | Types.`isSameType(TypeMirror t1, TypeMirror t2)` Tests whether two `TypeMirror` objects represent the same type.
    `boolean` | Types.`isSubtype(TypeMirror t1, TypeMirror t2)` Tests whether one type is a subtype of another.
    `PrimitiveType` | Types.`unboxedType(TypeMirror t)` Returns the type (a primitive type) of unboxed values of a given type.
    `R` | AbstractTypeVisitor6.`visit(TypeMirror t)` Visits any type mirror as if by passing itself to that type mirror's `accept` method and passing `null` for the additional parameter.
    `R` | AbstractTypeVisitor6.`visit(TypeMirror t, P p)` Visits any type mirror as if by passing itself to that type mirror's `accept` method.
    `R` | SimpleAnnotationValueVisitor6.`visitType(TypeMirror t, P p)` Visits a type value in an annotation.
    `R` | AbstractTypeVisitor6.`visitUnknown(TypeMirror t, P p)` Visits an unknown kind of type.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.