saker.build Documentation TaskDoc JavaDoc
public class TypeReference
A reference to a type appearing in a class, field or method declaration, or on an instruction. Such a reference designates the part of the class where the referenced type is appearing (e.g. an 'extends', 'implements' or 'throws' clause, a 'new' instruction, a 'catch' clause, a type cast, a local variable declaration, etc).
Fields
public static final int
CAST = 71
The sort of type references that target the type declared in an explicit or implicit cast instruction.
public static final int
The sort of type references that target the super class of a class or one of the interfaces it implements.
public static final int
The sort of type references that target a type parameter of a generic class.
public static final int
The sort of type references that target a bound of a type parameter of a generic class.
public static final int
The sort of type references that target a type parameter of a generic constructor in a constructor call.
public static final int
The sort of type references that target the receiver type of a constructor reference.
public static final int
The sort of type references that target a type parameter of a generic constructor in a constructor reference.
public static final int
The sort of type references that target the type of the exception of a 'catch' clause in a method.
public static final int
FIELD = 19
The sort of type references that target the type of a field.
public static final int
The sort of type references that target the type declared in an 'instanceof' instruction.
public static final int
The sort of type references that target the type of a local variable in a method.
public static final int
The sort of type references that target the type of a formal parameter of a method.
public static final int
The sort of type references that target a type parameter of a generic method in a method call.
public static final int
The sort of type references that target the receiver type of a method.
public static final int
The sort of type references that target the receiver type of a method reference.
public static final int
The sort of type references that target a type parameter of a generic method in a method reference.
public static final int
The sort of type references that target the return type of a method.
public static final int
The sort of type references that target a type parameter of a generic method.
public static final int
The sort of type references that target a bound of a type parameter of a generic method.
public static final int
NEW = 68
The sort of type references that target the type of the object created by a 'new' instruction.
public static final int
The sort of type references that target the type of a resource variable in a method.
public static final int
THROWS = 23
The sort of type references that target the type of an exception declared in the throws clause of a method.
Constructors
public
TypeReference(int typeRef)
Constructs a new TypeReference.
Methods
public int
Returns the index of the exception, in a 'throws' clause of a method, whose type is referenced by this type reference.
public int
Returns the index of the formal parameter whose type is referenced by this type reference.
public int
Returns the sort of this type reference.
public int
Returns the index of the "super type" of a class that is referenced by this type reference.
public int
Returns the index of the try catch block (using the order in which they are visited with visitTryCatchBlock), whose 'catch' type is referenced by this type reference.
public int
Returns the index of the type argument referenced by this type reference.
public int
Returns the index of the type parameter bound, within the type parameter getTypeParameterIndex(), referenced by this type reference.
public int
Returns the index of the type parameter referenced by this type reference.
public int
Returns the int encoded value of this type reference, suitable for use in visit methods related to type annotations, like visitTypeAnnotation.
public static TypeReference
newExceptionReference(int exceptionIndex)
Returns a reference to the type of an exception, in a 'throws' clause of a method.
public static TypeReference
Returns a reference to the type of a formal parameter of a method.
public static TypeReference
newSuperTypeReference(int itfIndex)
Returns a reference to the super class or to an interface of the 'implements' clause of a class.
public static TypeReference
newTryCatchReference(int tryCatchBlockIndex)
Returns a reference to the type of the exception declared in a 'catch' clause of a method.
public static TypeReference
newTypeArgumentReference(int sort, int argIndex)
Returns a reference to the type of a type argument in a constructor or method call or reference.
public static TypeReference
newTypeParameterBoundReference(int sort, int paramIndex, int boundIndex)
Returns a reference to a type parameter bound of a generic class or method.
public static TypeReference
newTypeParameterReference(int sort, int paramIndex)
Returns a reference to a type parameter of a generic class or method.
public static TypeReference
Returns a type reference of the given sort.
public static final int CAST = 71
The sort of type references that target the type declared in an explicit or implicit cast instruction. See getSort().
public static final int CLASS_EXTENDS = 16
The sort of type references that target the super class of a class or one of the interfaces it implements. See getSort().
public static final int CLASS_TYPE_PARAMETER = 0
The sort of type references that target a type parameter of a generic class. See getSort().
public static final int CLASS_TYPE_PARAMETER_BOUND = 17
The sort of type references that target a bound of a type parameter of a generic class. See getSort().
public static final int CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT = 72
The sort of type references that target a type parameter of a generic constructor in a constructor call. See getSort().
public static final int CONSTRUCTOR_REFERENCE = 69
The sort of type references that target the receiver type of a constructor reference. See getSort().
public static final int CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = 74
The sort of type references that target a type parameter of a generic constructor in a constructor reference. See getSort().
public static final int EXCEPTION_PARAMETER = 66
The sort of type references that target the type of the exception of a 'catch' clause in a method. See getSort().
public static final int FIELD = 19
The sort of type references that target the type of a field. See getSort().
public static final int INSTANCEOF = 67
The sort of type references that target the type declared in an 'instanceof' instruction. See getSort().
public static final int LOCAL_VARIABLE = 64
The sort of type references that target the type of a local variable in a method. See getSort().
public static final int METHOD_FORMAL_PARAMETER = 22
The sort of type references that target the type of a formal parameter of a method. See getSort().
public static final int METHOD_INVOCATION_TYPE_ARGUMENT = 73
The sort of type references that target a type parameter of a generic method in a method call. See getSort().
public static final int METHOD_RECEIVER = 21
The sort of type references that target the receiver type of a method. See getSort().
public static final int METHOD_REFERENCE = 70
The sort of type references that target the receiver type of a method reference. See getSort().
public static final int METHOD_REFERENCE_TYPE_ARGUMENT = 75
The sort of type references that target a type parameter of a generic method in a method reference. See getSort().
public static final int METHOD_RETURN = 20
The sort of type references that target the return type of a method. See getSort().
public static final int METHOD_TYPE_PARAMETER = 1
The sort of type references that target a type parameter of a generic method. See getSort().
public static final int METHOD_TYPE_PARAMETER_BOUND = 18
The sort of type references that target a bound of a type parameter of a generic method. See getSort().
public static final int NEW = 68
The sort of type references that target the type of the object created by a 'new' instruction. See getSort().
public static final int RESOURCE_VARIABLE = 65
The sort of type references that target the type of a resource variable in a method. See getSort().
public static final int THROWS = 23
The sort of type references that target the type of an exception declared in the throws clause of a method. See getSort().
public TypeReference(int typeRef)
Constructs a new TypeReference.
typeRefthe int encoded value of the type reference, as received in a visit method related to type annotations, such as ClassVisitor.visitTypeAnnotation(int, TypePath, String, boolean).
public int getExceptionIndex()
Returns the index of the exception, in a 'throws' clause of a method, whose type is referenced by this type reference. This method must only be used for type references whose sort is THROWS.
the index of an exception in the 'throws' clause of a method.
Returns the index of the formal parameter whose type is referenced by this type reference. This method must only be used for type references whose sort is METHOD_FORMAL_PARAMETER.
a formal parameter index.
public int getSuperTypeIndex()
Returns the index of the "super type" of a class that is referenced by this type reference. This method must only be used for type references whose sort is CLASS_EXTENDS.
the index of an interface in the 'implements' clause of a class, or -1 if this type reference references the type of the super class.
Returns the index of the try catch block (using the order in which they are visited with visitTryCatchBlock), whose 'catch' type is referenced by this type reference. This method must only be used for type references whose sort is EXCEPTION_PARAMETER .
the index of an exception in the 'throws' clause of a method.
Returns the index of the type argument referenced by this type reference. This method must only be used for type references whose sort is CAST, CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, METHOD_INVOCATION_TYPE_ARGUMENT, CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT, or METHOD_REFERENCE_TYPE_ARGUMENT.
a type parameter index.
Returns the index of the type parameter bound, within the type parameter getTypeParameterIndex(), referenced by this type reference. This method must only be used for type references whose sort is CLASS_TYPE_PARAMETER_BOUND or METHOD_TYPE_PARAMETER_BOUND.
a type parameter bound index.
Returns the index of the type parameter referenced by this type reference. This method must only be used for type references whose sort is CLASS_TYPE_PARAMETER, METHOD_TYPE_PARAMETER, CLASS_TYPE_PARAMETER_BOUND or METHOD_TYPE_PARAMETER_BOUND.
a type parameter index.
public int getValue()
Returns the int encoded value of this type reference, suitable for use in visit methods related to type annotations, like visitTypeAnnotation.
the int encoded value of this type reference.
public static TypeReference newExceptionReference(int exceptionIndex)
Returns a reference to the type of an exception, in a 'throws' clause of a method.
exceptionIndexthe index of an exception in a 'throws' clause of a method.
a reference to the type of the given exception.
public static TypeReference newFormalParameterReference(int paramIndex)
Returns a reference to the type of a formal parameter of a method.
paramIndexthe formal parameter index.
a reference to the type of the given method formal parameter.
public static TypeReference newSuperTypeReference(int itfIndex)
Returns a reference to the super class or to an interface of the 'implements' clause of a class.
itfIndexthe index of an interface in the 'implements' clause of a class, or -1 to reference the super class of the class.
a reference to the given super type of a class.
public static TypeReference newTryCatchReference(int tryCatchBlockIndex)
Returns a reference to the type of the exception declared in a 'catch' clause of a method.
tryCatchBlockIndexthe index of a try catch block (using the order in which they are visited with visitTryCatchBlock).
a reference to the type of the given exception.
public static TypeReference newTypeArgumentReference(int sort, int argIndex)
Returns a reference to the type of a type argument in a constructor or method call or reference.
a reference to the type of the given type argument.
public static TypeReference newTypeParameterBoundReference(int sort, int paramIndex, int boundIndex)
Returns a reference to a type parameter bound of a generic class or method.
paramIndexthe type parameter index.
boundIndexthe type bound index within the above type parameters.
a reference to the given generic class or method type parameter bound.
public static TypeReference newTypeParameterReference(int sort, int paramIndex)
Returns a reference to a type parameter of a generic class or method.
paramIndexthe type parameter index.
a reference to the given generic class or method type parameter.
public static TypeReference newTypeReference(int sort)
Returns a type reference of the given sort.
a type reference of the given sort.