/** * Returns a reference to the type of an exception, in a 'throws' clause of * a method. * * @param exceptionIndex * the index of an exception in a 'throws' clause of a method. * * @return a reference to the type of the given exception. */ public static TypeReference newExceptionReference(int exceptionIndex) { return new TypeReference((THROWS << 24) | (exceptionIndex << 8)); }
/** * Returns a reference to the type of a formal parameter of a method. * * @param paramIndex * the formal parameter index. * * @return a reference to the type of the given method formal parameter. */ public static TypeReference newFormalParameterReference(int paramIndex) { return new TypeReference((METHOD_FORMAL_PARAMETER << 24) | (paramIndex << 16)); }
/** * Returns a reference to the super class or to an interface of the * 'implements' clause of a class. * * @param itfIndex * the index of an interface in the 'implements' clause of a * class, or -1 to reference the super class of the class. * @return a reference to the given super type of a class. */ public static TypeReference newSuperTypeReference(int itfIndex) { itfIndex &= 0xFFFF; return new TypeReference((CLASS_EXTENDS << 24) | (itfIndex << 8)); }
/** * Returns a reference to the type of the exception declared in a 'catch' * clause of a method. * * @param tryCatchBlockIndex * the index of a try catch block (using the order in which they * are visited with visitTryCatchBlock). * * @return a reference to the type of the given exception. */ public static TypeReference newTryCatchReference(int tryCatchBlockIndex) { return new TypeReference((EXCEPTION_PARAMETER << 24) | (tryCatchBlockIndex << 8)); }
/** * Returns a reference to a type parameter of a generic class or method. * * @param sort * {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER} or * {@link #METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER}. * @param paramIndex * the type parameter index. * @return a reference to the given generic class or method type parameter. */ public static TypeReference newTypeParameterReference(int sort, int paramIndex) { return new TypeReference((sort << 24) | (paramIndex << 16)); }
/** * Returns a type reference of the given sort. * * @param sort * {@link #FIELD FIELD}, {@link #METHOD_RETURN METHOD_RETURN}, * {@link #METHOD_RECEIVER METHOD_RECEIVER}, * {@link #LOCAL_VARIABLE LOCAL_VARIABLE}, * {@link #RESOURCE_VARIABLE RESOURCE_VARIABLE}, * {@link #INSTANCEOF INSTANCEOF}, {@link #NEW NEW}, * {@link #CONSTRUCTOR_REFERENCE CONSTRUCTOR_REFERENCE}, or * {@link #METHOD_REFERENCE METHOD_REFERENCE}. * @return a type reference of the given sort. */ public static TypeReference newTypeReference(int sort) { return new TypeReference(sort << 24); }
/** * Returns a reference to a type parameter bound of a generic class or * method. * * @param sort * {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER} or * {@link #METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER}. * @param paramIndex * the type parameter index. * @param boundIndex * the type bound index within the above type parameters. * @return a reference to the given generic class or method type parameter * bound. */ public static TypeReference newTypeParameterBoundReference(int sort, int paramIndex, int boundIndex) { return new TypeReference((sort << 24) | (paramIndex << 16) | (boundIndex << 8)); }
/** * Returns a reference to the type of a type argument in a constructor or * method call or reference. * * @param sort * {@link #CAST CAST}, * {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT * CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, * {@link #METHOD_INVOCATION_TYPE_ARGUMENT * METHOD_INVOCATION_TYPE_ARGUMENT}, * {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT * CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or * {@link #METHOD_REFERENCE_TYPE_ARGUMENT * METHOD_REFERENCE_TYPE_ARGUMENT}. * @param argIndex * the type argument index. * * @return a reference to the type of the given type argument. */ public static TypeReference newTypeArgumentReference(int sort, int argIndex) { return new TypeReference((sort << 24) | argIndex); }
/** * Returns a reference to the type of an exception, in a 'throws' clause of * a method. * * @param exceptionIndex * the index of an exception in a 'throws' clause of a method. * * @return a reference to the type of the given exception. */ public static TypeReference newExceptionReference(int exceptionIndex) { return new TypeReference((THROWS << 24) | (exceptionIndex << 8)); }
/** * Returns a reference to the type of a formal parameter of a method. * * @param paramIndex * the formal parameter index. * * @return a reference to the type of the given method formal parameter. */ public static TypeReference newFormalParameterReference(int paramIndex) { return new TypeReference((METHOD_FORMAL_PARAMETER << 24) | (paramIndex << 16)); }
/** * Returns a reference to the super class or to an interface of the * 'implements' clause of a class. * * @param itfIndex * the index of an interface in the 'implements' clause of a * class, or -1 to reference the super class of the class. * @return a reference to the given super type of a class. */ public static TypeReference newSuperTypeReference(int itfIndex) { itfIndex &= 0xFFFF; return new TypeReference((CLASS_EXTENDS << 24) | (itfIndex << 8)); }
/** * Returns a reference to a type parameter of a generic class or method. * * @param sort * {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER} or * {@link #METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER}. * @param paramIndex * the type parameter index. * @return a reference to the given generic class or method type parameter. */ public static TypeReference newTypeParameterReference(int sort, int paramIndex) { return new TypeReference((sort << 24) | (paramIndex << 16)); }
/** * Returns a reference to the type of the exception declared in a 'catch' * clause of a method. * * @param tryCatchBlockIndex * the index of a try catch block (using the order in which they * are visited with visitTryCatchBlock). * * @return a reference to the type of the given exception. */ public static TypeReference newTryCatchReference(int tryCatchBlockIndex) { return new TypeReference((EXCEPTION_PARAMETER << 24) | (tryCatchBlockIndex << 8)); }
/** * Returns a type reference of the given sort. * * @param sort * {@link #FIELD FIELD}, {@link #METHOD_RETURN METHOD_RETURN}, * {@link #METHOD_RECEIVER METHOD_RECEIVER}, * {@link #LOCAL_VARIABLE LOCAL_VARIABLE}, * {@link #RESOURCE_VARIABLE RESOURCE_VARIABLE}, * {@link #INSTANCEOF INSTANCEOF}, {@link #NEW NEW}, * {@link #CONSTRUCTOR_REFERENCE CONSTRUCTOR_REFERENCE}, or * {@link #METHOD_REFERENCE METHOD_REFERENCE}. * @return a type reference of the given sort. */ public static TypeReference newTypeReference(int sort) { return new TypeReference(sort << 24); }
/** * Returns a reference to a type parameter bound of a generic class or * method. * * @param sort * {@link #CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER} or * {@link #METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER}. * @param paramIndex * the type parameter index. * @param boundIndex * the type bound index within the above type parameters. * @return a reference to the given generic class or method type parameter * bound. */ public static TypeReference newTypeParameterBoundReference(int sort, int paramIndex, int boundIndex) { return new TypeReference((sort << 24) | (paramIndex << 16) | (boundIndex << 8)); }
/** * Returns a reference to the type of a type argument in a constructor or * method call or reference. * * @param sort * {@link #CAST CAST}, * {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT * CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, * {@link #METHOD_INVOCATION_TYPE_ARGUMENT * METHOD_INVOCATION_TYPE_ARGUMENT}, * {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT * CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or * {@link #METHOD_REFERENCE_TYPE_ARGUMENT * METHOD_REFERENCE_TYPE_ARGUMENT}. * @param argIndex * the type argument index. * * @return a reference to the type of the given type argument. */ public static TypeReference newTypeArgumentReference(int sort, int argIndex) { return new TypeReference((sort << 24) | argIndex); }
/** * Returns a reference to the type of an exception, in a 'throws' clause of * a method. * * @param exceptionIndex * the index of an exception in a 'throws' clause of a method. * * @return a reference to the type of the given exception. */ public static TypeReference newExceptionReference(int exceptionIndex) { return new TypeReference((THROWS << 24) | (exceptionIndex << 8)); }
/** * Returns a reference to the type of a formal parameter of a method. * * @param paramIndex * the formal parameter index. * * @return a reference to the type of the given method formal parameter. */ public static TypeReference newFormalParameterReference(int paramIndex) { return new TypeReference((METHOD_FORMAL_PARAMETER << 24) | (paramIndex << 16)); }
/** * Returns a reference to the type of an exception, in a 'throws' clause of * a method. * * @param exceptionIndex * the index of an exception in a 'throws' clause of a method. * * @return a reference to the type of the given exception. */ public static TypeReference newExceptionReference(int exceptionIndex) { return new TypeReference((THROWS << 24) | (exceptionIndex << 8)); }
/** * Returns a reference to the type of a formal parameter of a method. * * @param paramIndex * the formal parameter index. * * @return a reference to the type of the given method formal parameter. */ public static TypeReference newFormalParameterReference(int paramIndex) { return new TypeReference((METHOD_FORMAL_PARAMETER << 24) | (paramIndex << 16)); }