public class CommonUtilities extends Conversions implements JavaConstants
Conversions.ConversionType
JavaPreferences.MemberOrder
ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEFAULT, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_none, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICTFP, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ACCX_DEPRECATED, ACCX_HIDDEN, ARRAY_implements, BOUND_EXTENDS, BOUND_NARROW, BOUND_NONE, BOUND_SUPER, ELEM_ANNOTATION, ELEM_base, ELEM_CLASS, ELEM_COMPONENT, ELEM_EXPRESSION, ELEM_FIELD, ELEM_FILE, ELEM_IMPORT, ELEM_INTERSECTION_TYPE, ELEM_invalid, ELEM_LOCAL_VARIABLE, ELEM_max, ELEM_METHOD, ELEM_NOTHING, ELEM_PACKAGE, ELEM_SELF_VARIABLE, ELEM_STATEMENT_LABEL, ELEM_TMP_VARIABLE, ELEM_TYPE_VARIABLE, ELEM_WILDCARD_TYPE, ELEM_words, EMPTY_OBJECT_ARRAY, EMPTY_STRING_ARRAY, FOR_ENHANCED, FOR_EXPRESSION, FOR_VARIABLE_D, kEmptyCollection, opt2srcTable, PACKAGE_INFO, PRIMITIVE_autoboxes, PRIMITIVE_binary, PRIMITIVE_BOOLEAN, PRIMITIVE_BYTE, PRIMITIVE_CHAR, PRIMITIVE_descriptors, PRIMITIVE_DOUBLE, PRIMITIVE_FLOAT, PRIMITIVE_INT, PRIMITIVE_invalid, PRIMITIVE_LONG, PRIMITIVE_max, PRIMITIVE_min, PRIMITIVE_NULL, PRIMITIVE_SHORT, PRIMITIVE_tokens, PRIMITIVE_unary, PRIMITIVE_VOID, SRC_ANNOTATION, SRC_base, SRC_BLOCK, SRC_CATCH_PARAMETER, SRC_CLASS, SRC_CLASS_BODY, SRC_CLASS_INITIALIZER, SRC_CONSTRUCTOR_D, SRC_DOC_base, SRC_DOC_BLOCK_TAG, SRC_DOC_COMMENT, SRC_DOC_DESCRIPTION, SRC_DOC_INLINE_TAG, SRC_DOC_max, SRC_DOC_REFERENCE, SRC_DOC_TAG_NAME, SRC_DOC_TEXT, SRC_ENUM_CONSTANT_D, SRC_ERROR, SRC_EXPR_ANNOTATION, SRC_EXPR_ARRAY_ACCESS, SRC_EXPR_ASSIGNMENT, SRC_EXPR_base, SRC_EXPR_DOT, SRC_EXPR_INFIX, SRC_EXPR_INTERSECTION_TYPE, SRC_EXPR_LAMBDA, SRC_EXPR_LIST, SRC_EXPR_LITERAL, SRC_EXPR_max, SRC_EXPR_METHOD_CALL, SRC_EXPR_METHOD_REFERENCE, SRC_EXPR_NEW_ARRAY, SRC_EXPR_NEW_CLASS, SRC_EXPR_QUESTION, SRC_EXPR_SIMPLE_NAME, SRC_EXPR_TYPE, SRC_EXPR_TYPECAST, SRC_EXPR_UNARY, SRC_EXPR_WRAPPER, SRC_FIELD_D, SRC_FIELD_VARIABLE, SRC_FILE, SRC_FORMAL_PARAMETER, SRC_FORMAL_PARAMETER_LIST, SRC_IMPORT_D, SRC_INTERFACES_CLAUSE, SRC_invalid, SRC_LABEL, SRC_LAMBDA_PARAMETER, SRC_LEX_base, SRC_LEX_BLANKLINE, SRC_LEX_COMMENT, SRC_LEX_max, SRC_LEX_SQLJ, SRC_LOCAL_VARIABLE, SRC_LOCAL_VARIABLE_D, SRC_max, SRC_METHOD_D, SRC_NAME, SRC_PACKAGE_D, SRC_STMT_ASSERT, SRC_STMT_base, SRC_STMT_BLOCK, SRC_STMT_BREAK, SRC_STMT_CATCH, SRC_STMT_CONTINUE, SRC_STMT_DO, SRC_STMT_ELSE, SRC_STMT_EMPTY, SRC_STMT_EXPRESSION, SRC_STMT_FINALLY, SRC_STMT_FOR, SRC_STMT_IF, SRC_STMT_max, SRC_STMT_RETURN, SRC_STMT_SWITCH, SRC_STMT_SYNCH, SRC_STMT_THROW, SRC_STMT_TRY, SRC_STMT_WHILE, SRC_SUPERCLASS_CLAUSE, SRC_SWITCH_LABEL, SRC_THROWS_CLAUSE, SRC_TRY_RESOURCES_LIST, SRC_TYPE_ARGUMENT, SRC_TYPE_ARGUMENT_LIST, SRC_TYPE_PARAMETER, SRC_TYPE_REF, SRC_words, TY_ANNOTATE, TY_CLASS, TY_ENUM, TY_INTERFACE, TY_invalid, TY_max, TY_words
ERROR_ABSTRACT_CLASS, ERROR_ABSTRACT_METHOD_CALL, ERROR_AMBIGUOUS_IMPORT, ERROR_AMBIGUOUS_REF, ERROR_ANNOTATION_ELEMENT_NAME_NOT_FOUND, ERROR_ANONYMOUS_CLASS_CONSTRUCTOR, ERROR_ASSERT_IDENTIFIER, ERROR_base, ERROR_BREAK_OUTSIDE_SWITCH_OR_LOOP, ERROR_CANCELLED, ERROR_CANNOT_ASSIGN_FINAL, ERROR_CANNOT_INSTANTIATE_ENUMS, ERROR_CANT_ASSIGN, ERROR_CANT_EXTEND_ENUM, ERROR_CANT_EXTEND_FINAL, ERROR_CANT_EXTEND_INTERFACE, ERROR_CANT_IMPLEMENT_CLASS, ERROR_CANT_TYPECAST, ERROR_CATEGORY_ALL, ERROR_CATEGORY_COMPILE, ERROR_CATEGORY_PARSE, ERROR_CATEGORY_SCAN, ERROR_CATEGORY_unclassified, ERROR_CHECK_EXCEPTION, ERROR_CLASS_CIRCULARITY, ERROR_COMPILE_base, ERROR_COMPILE_GENERIC, ERROR_COMPILE_max, ERROR_CONSTRUCTOR_NAME, ERROR_CONTINUE_OUTSIDE_OF_LOOP, ERROR_CYCLIC_ANNOTATION_TYPE_REFERENCE, ERROR_DUPLICATE, ERROR_EMPTY_CHAR_LITERAL, ERROR_EMPTY_EXPRESSION, ERROR_EXCEPTION_NEVER_THROWN, ERROR_EXPECTING_ONE, ERROR_EXPECTING_TWO, ERROR_EXPECTING_TYPE, ERROR_EXTENDS_NOT_ALLOWED, ERROR_EXTENDS_TOO_MANY, ERROR_FINAL_ALREADY_ASSIGNED, ERROR_FORWARD_REFERENCE, ERROR_GENERIC_COMPILER_ERROR, ERROR_GENERIC_TYPE, ERROR_ILLEGAL_ANNOTATION, ERROR_ILLEGAL_ARRAY_INITIALIZER, ERROR_ILLEGAL_DEFAULT, ERROR_ILLEGAL_DIAMOND, ERROR_ILLEGAL_LABEL, ERROR_ILLEGAL_METHOD_ARGUMENT_EXPRESSION, ERROR_ILLEGAL_METHOD_RETURN_TYPE_OVERRIDE, ERROR_ILLEGAL_METHOD_THROW_TYPE_OVERRIDE, ERROR_ILLEGAL_METHOD_VISIBILITY_OVERRIDE, ERROR_ILLEGAL_OVERRIDE_ANNOTATION, ERROR_ILLEGAL_START_OF_EXPR, ERROR_ILLEGAL_TYPE_PARAMETERS, ERROR_ILLEGAL_VARARGS, ERROR_IMPLEMENTS_NOT_ALLOWED, ERROR_IMPORT_NOT_FOUND, ERROR_INCOMPATIBLE_TYPES, ERROR_INCOMPATIBLE_WITH_FUNCTIONAL_INTERFACE_TARGET, ERROR_INTERNAL, ERROR_INVALID_ANNOTATION_MEMBER_TYPE, ERROR_INVALID_CHAR_LITERAL, ERROR_INVALID_ESCAPE_SEQUENCE, ERROR_INVALID_EXPR_STMT, ERROR_INVALID_NAME, ERROR_INVALID_OPERATION, ERROR_INVALID_STRING_LITERAL, ERROR_INVALID_SUPERTYPE, ERROR_keys, ERROR_LONE_CATCH, ERROR_LONE_ELSE, ERROR_LONE_FINALLY, ERROR_LONE_TRY, ERROR_max, ERROR_MEMBER_NOT_FOUND, ERROR_METHOD_NOT_FOUND, ERROR_MISSING_ANNOTATION_ARGUMENT, ERROR_MISSING_ANNOTATION_ELEMENT_NAME, ERROR_MISSING_CASE_OR_DEFAULT_LABEL, ERROR_MISSING_CONDITION, ERROR_MISSING_METHOD_BODY, ERROR_MISSING_RETURN, ERROR_MODIFIER_NOT_ALLOWED, ERROR_MODIFIER_REPEATED, ERROR_MULTIPLE_COMPONENTS, ERROR_NAME_NOT_FOUND, ERROR_none, ERROR_NOT_A_CONSTANT_EXPRESSION, ERROR_NOT_ACCESSIBLE, ERROR_NOT_ANNOTATION_TYPE, ERROR_NOT_ASSIGNABLE, ERROR_NOT_GENERIC_TYPE, ERROR_NOT_IMPLEMENTED_YET, ERROR_NOT_THROWABLE, ERROR_NUMBER_FORMAT, ERROR_NUMERIC_OVERFLOW, ERROR_NUMERIC_UNDERFLOW, ERROR_ONLY_STATIC_ACCESS, ERROR_PARSE_base, ERROR_PARSE_GENERIC, ERROR_PARSE_max, ERROR_REQUIRE_ARRAY, ERROR_REQUIRE_BLOCK, ERROR_REQUIRE_FINAL, ERROR_REQUIRE_FINAL_OR_EFFECTIVELY_FINAL, ERROR_REQUIRE_OBJECT, ERROR_REQUIRE_OUTER_CLASS, ERROR_REQUIRE_VARIABLE, ERROR_SCAN_base, ERROR_SCAN_GENERIC, ERROR_SCAN_max, ERROR_SUPER_NOT_FIRST, ERROR_TARGET_NOT_FUNCTIONAL_INTERFACE, ERROR_THIS_NOT_FIRST, ERROR_TYPE_ARGUMENT_MISMATCH, ERROR_TYPE_IS_NOT_AUTOCLOSEABLE, ERROR_TYPE_IS_NOT_DISJUNCTIVE, ERROR_TYPE_IS_NOT_ITERABLE, ERROR_TYPE_NOT_ALLOWED, ERROR_TYPE_NOT_FOUND, ERROR_UNEXPECTED, ERROR_UNKNOWN, ERROR_UNREACHABLE_STATEMENT, ERROR_VARIABLE_NOT_ASSIGNED, ERROR_VOID_RETURN, ERROR_warnings, ERROR_words, ERROR_WRONG_RECEIVER_TYPE, ERROR_WRONG_TARGET_META_ANNOTATION, NOTE_GENERIC_COMPILER_NOTE, SEVERITY_ERROR, SEVERITY_FATAL, SEVERITY_LINT, SEVERITY_NOTE, SEVERITY_WARNING, SEVERITY_ZERO, WARNING_AMBIGUOUS_DOC_REFERENCE, WARNING_ASSERT_IDENTIFIER, WARNING_DOC_REFERENCE_NOT_FOUND, WARNING_FINALLY_CANNOT_COMPLETE, WARNING_GENERIC_COMPILER_WARNING, WARNING_IMPORT_UNUSED, WARNING_INVALID_NAME, WARNING_METHOD_NAME, WARNING_SWITCH_CASE_FALL_THROUGH, WARNING_UNCHECKED_CONVERSION
OPT_ADD, OPT_ADDASG, OPT_AND, OPT_ANNOTATION, OPT_ARRAYCONST, OPT_ASG, OPT_base, OPT_BITAND, OPT_BITANDASG, OPT_BITNOT, OPT_BITOR, OPT_BITORASG, OPT_BITXOR, OPT_BITXORASG, OPT_CLASS_LITERAL, OPT_COND, OPT_DEREF, OPT_DIV, OPT_DIVASG, OPT_DOT, OPT_EQ, OPT_GE, OPT_GT, OPT_INSTANCEOF, OPT_INTERSECTION_TYPE, OPT_invalid, OPT_INVOKE, OPT_LAMBDA, OPT_LE, OPT_LIST, OPT_LITERAL, OPT_LSH, OPT_LSHASG, OPT_LT, OPT_max, OPT_METHOD_REFERENCE, OPT_MINUS, OPT_MINUSASG, OPT_MOD, OPT_MODASG, OPT_MUL, OPT_MULASG, OPT_NEGATIVE, OPT_NESTEXP, OPT_NEWARRAY, OPT_NEWOBJECT, OPT_NOT, OPT_NOTEQ, OPT_OR, OPT_POSITIVE, OPT_POSTDEC, OPT_POSTINC, OPT_precedence, OPT_PREDEC, OPT_PREINC, OPT_QUALIFIED_SUPER, OPT_QUALIFIED_THIS, OPT_RSH, OPT_RSHASG, OPT_SIMPLE_NAME, OPT_tokens, OPT_TYPE, OPT_TYPECAST, OPT_URSH, OPT_URSHASG, OPT_words
DW_values, DW_words, J2SE_13, J2SE_14, J2SE_15, J2SE_16, J2SE_17, J2SE_18, J2SE_MAX, J2SE_MIN, KW_ABSTRACT, KW_ASSERT, KW_base, KW_BOOLEAN, KW_BREAK, KW_BYTE, KW_CASE, KW_CATCH, KW_CHAR, KW_CLASS, KW_CONST, KW_CONTINUE, KW_DEFAULT, KW_DO, KW_DOUBLE, KW_ELSE, KW_ENUM, KW_EXTENDS, KW_FINAL, KW_FINALLY, KW_FLOAT, KW_FOR, KW_GOTO, KW_IF, KW_IMPLEMENTS, KW_IMPORT, KW_INSTANCEOF, KW_INT, KW_INTERFACE, KW_j2se13_max, KW_j2se14_max, KW_j2se15_max, KW_j2se16_max, KW_j2se17_max, KW_j2se18_max, KW_LONG, KW_max, KW_NATIVE, KW_NEW, KW_PACKAGE, KW_PRIVATE, KW_PROTECTED, KW_PUBLIC, KW_RETURN, KW_SHORT, KW_STATIC, KW_STRICTFP, KW_SUPER, KW_SWITCH, KW_SYNCHRONIZED, KW_THIS, KW_THROW, KW_THROWS, KW_TRANSIENT, KW_TRY, KW_VOID, KW_VOLATILE, KW_WHILE, KW_words, OP_AND_ASG, OP_ASG, OP_AT, OP_base, OP_BINAND, OP_binary, OP_BINNOT, OP_BINOR, OP_BINXOR, OP_COLON, OP_COLONCOLON, OP_COMMA, OP_DEC, OP_DIV, OP_DIV_ASG, OP_DOT, OP_ELLIPSIS, OP_EQ, OP_GE, OP_GT, OP_HASH, OP_INC, OP_LBRACE, OP_LBRACKET, OP_LE, OP_LOGAND, OP_LOGNOT, OP_LOGOR, OP_LPAREN, OP_LSH, OP_LSH_ASG, OP_LT, OP_max, OP_MINUS, OP_MINUS_ASG, OP_MOD, OP_MOD_ASG, OP_MUL, OP_MUL_ASG, OP_NE, OP_OR_ASG, OP_PLUS, OP_PLUS_ASG, OP_prefix, OP_QUES, OP_RBRACE, OP_RBRACKET, OP_RIGHT_ARROW, OP_RPAREN, OP_RSH, OP_RSH_ASG, OP_SEMI, OP_URSH, OP_URSH_ASG, OP_words, OP_XOR_ASG, TK_base, TK_BOOLEAN_LITERAL, TK_CHAR_LITERAL, TK_DOC_COMMENT, TK_DOUBLE_LITERAL, TK_EOF, TK_FLOAT_LITERAL, TK_IDENTIFIER, TK_INT_LITERAL, TK_LITERAL_base, TK_LITERAL_max, TK_LONG_LITERAL, TK_max, TK_MULTI_COMMENT, TK_NULL_LITERAL, TK_SINGLE_COMMENT, TK_SQLJ, TK_STRING_LITERAL, TK_WHITESPACE, TK_words
ALIGN_ANONYMOUS_CLASS, ALIGN_ARRAY_INITIALIZERS, ALIGN_VARIABLE_NAMES, BLANKLINES_AFTER_LAST_MEMBER, BLANKLINES_BEFORE_DOC_COMMENT, BLANKLINES_BEFORE_FIELD, BLANKLINES_BEFORE_FIRST_CLASS, BLANKLINES_BEFORE_FIRST_MEMBER, BLANKLINES_BEFORE_MEMBER_CLASS, BLANKLINES_BEFORE_METHOD, BLANKLINES_EMPTY_ANONYMOUS, BLANKLINES_EMPTY_BLOCK, BLANKLINES_EMPTY_CLASS, BLANKLINES_EMPTY_METHOD, BLANKLINES_IMPORTS_AFTER, BLANKLINES_PACKAGE_AFTER, BLANKLINES_PRESERVE_COUNT, CLONE_QUALIFIES_TYPES, CUDDLE_EMPTY_BRACES, FALSE, IGNORED_I, IGNORED_Z, IMPORT_GROUP_IMPORTS, IMPORT_GROUP_PACKAGE_DEPTH, IMPORT_INNER_CLASS_NAME, IMPORT_NARROW_MEMBERS_THRESHOLD, IMPORT_NARROW_THRESHOLD, INDENT_BLOCK_CHILDREN, INDENT_CLASS_MEMBERS, INDENT_CONTROL_BLOCKS, INDENT_NUM_SPACES, INDENT_REPLACE_WITH_TABS, INDENT_SWITCH_CASES, INDENT_TAB_SIZE, INDENT_TRAILING_COMMENTS, INTEGER_ALWAYS_WRAP, INTEGER_NEVER_WRAP, INTEGER_WRAP_IF_LONG, MEMBER_ORDER, NEWLINE_AFTER_SWITCH_CASE, NEWLINE_ANONYMOUS_CLASS_BRACES, NEWLINE_ARRAY_BRACES, NEWLINE_BLOCK_BRACES, NEWLINE_CASE_BRACES, NEWLINE_CATCH, NEWLINE_CATCH_BRACES, NEWLINE_CLASS_BRACES, NEWLINE_DO_BRACES, NEWLINE_ELSE, NEWLINE_ELSE_BRACES, NEWLINE_EXTENDS, NEWLINE_FINALLY, NEWLINE_FINALLY_BRACES, NEWLINE_FOR_BRACES, NEWLINE_IF_BRACES, NEWLINE_IMPLEMENTS, NEWLINE_METHOD_BRACES, NEWLINE_STATIC_INITIALIZER_BRACES, NEWLINE_SWITCH_BRACES, NEWLINE_SYNCHRONIZED_BRACES, NEWLINE_THROWS, NEWLINE_TRY_BRACES, NEWLINE_WHILE, NEWLINE_WHILE_BRACES, ONE, PREFERENCES_base, PREFERENCES_defaults, PREFERENCES_explanations, PREFERENCES_keys, PREFERENCES_max, PREFERENCES_sun, SPACE_ARGUMENTS_BEFORE, SPACE_ASSIGN_AROUND, SPACE_BINARYOP_AROUND, SPACE_BRACES_AROUND, SPACE_BRACKETS_WITHIN, SPACE_COLON_AFTER, SPACE_COLON_BEFORE, SPACE_COMMA_AFTER, SPACE_COMMA_BEFORE, SPACE_KEYWORD_AFTER, SPACE_LAMBDA_OPERATOR_AROUND, SPACE_OPENBRACE_BEFORE, SPACE_PARAMETERS_BEFORE, SPACE_PARENS_WITHIN, SPACE_QUESTION_AFTER, SPACE_QUESTION_BEFORE, SPACE_SEMICOLON_AFTER, SPACE_SEMICOLON_BEFORE, SPACE_TYPECAST_AFTER, TRI_ALWAYS_WRAP, TRI_NEVER_WRAP, TRI_WRAP_IF_LONG, TRUE, TWO, UNKNOWN_I, UNKNOWN_Z, WRAP_ALIGN, WRAP_ANNOTATIONS, WRAP_ANONYMOUS_CLASS_ASSIGNMENTS, WRAP_ARRAY_CONSTANT, WRAP_ASSERT_OPERATORS, WRAP_BEFORE_OPERATORS, WRAP_BEFORE_TERNARY_OPERATORS, WRAP_BINARY_OPERATOR, WRAP_CLASS_ANNOTATIONS, WRAP_DOT_CHAIN, WRAP_EXTENDS, WRAP_FIELD_ANNOTATIONS, WRAP_FOR_STATEMENT, WRAP_IMPLEMENTS, WRAP_INVOKE_ARGUMENTS, WRAP_LINE_WIDTH, WRAP_LOCAL_VARIABLE_ANNOTATIONS, WRAP_MARKER_ANNOTATIONS, WRAP_METHOD_ANNOTATIONS, WRAP_MODIFIERS, WRAP_PARAMETER_ANNOTATIONS, WRAP_PARAMETER_LIST, WRAP_QUES_OPERATOR, WRAP_STRING_EOL_CONCATENATIONS, WRAP_THROWS, WRAP_TYPE_ANNOTATIONS, ZERO
Constructor and Description |
---|
CommonUtilities() |
Modifier and Type | Method and Description |
---|---|
protected static byte |
asg_op(int token) |
protected static boolean |
classProcessed(java.util.Set processed,
JavaType javaClass)
After this function, the input class will be added to the
processed list.
|
static boolean |
containsClassThisSuper(java.lang.String qualifiedName) |
static JavaType |
createAnnotatedJavaType(JavaType javaType,
java.util.List<JavaAnnotation> annotations)
Given a JavaType and some annotations, create the appropriate
annotated JavaType.
|
static JavaType |
createArrayType(JavaProvider provider,
JavaType component,
int dimensions) |
static JavaType |
createArrayType(JavaProvider provider,
JavaType component,
int dimensions,
java.util.List<java.util.List<JavaAnnotation>> typeAnnotations) |
static JavaType |
createDiamondParameterizedType(JavaProvider provider,
JavaType type)
Create a parameterized type (a type with type arguments) with an empty
type argument list, useful for the 'new Type<>()' syntax
|
static JavaMethod |
createParameterizedMethod(JavaProvider provider,
JavaMethod generic,
JavaType[] typeArguments) |
static JavaType |
createParameterizedType(JavaProvider provider,
JavaType generic,
JavaType[] typeArguments) |
static JavaType |
createTypeErasedClass(JavaProvider provider,
JavaType type) |
static JavaType |
createWildcardType(byte bound,
JavaType t,
JavaProvider provider)
Creates a wildcard type.
|
static boolean |
equals(JavaMember one,
JavaMember two) |
static boolean |
equals(JavaPackage one,
JavaPackage two) |
static java.lang.String |
format(java.lang.String input,
java.lang.String arg0) |
static java.lang.String |
format(java.lang.String input,
java.lang.String arg0,
java.lang.String arg1) |
static JavaAnnotation |
getAnnotation(JavaType target,
JavaType annotationType) |
static java.util.Collection<JavaAnnotation> |
getAnnotations(JavaType target) |
static java.util.List<java.lang.Integer> |
getArgumentCommaLocations(SourceInvokeExpression invokeExpression)
Given a SourceInvokeExpression, find the locations of the commas separating
the arguments of that SourceInvokeExpression
|
static JavaClass |
getClass(JavaFile target,
java.lang.String name) |
static JavaClass |
getClass(JavaType target,
java.lang.String name) |
static java.util.Collection<JavaClass> |
getClasses(JavaType target) |
static java.util.List<JavaType> |
getClassHierarchy(JavaType javaType)
Computes the class hierarchy of a JavaType that correctly
erases classes in the type hierarchy depending if a
generic class was instantiated with type arguments or not.
|
static JavaAnnotation |
getDeclaredAnnotation(JavaHasAnnotations target,
JavaType annotationType) |
static JavaClass |
getDeclaredClass(JavaType target,
java.lang.String name) |
static JavaMethod |
getDeclaredConstructor(JavaType target,
JavaType[] targetTypes)
Get the declared constructor of 'target' whose parameter
types match the incoming types.
|
static JavaField |
getDeclaredField(JavaType target,
java.lang.String name) |
static JavaField |
getDeclaredFieldFromUniqueId(JavaClass javaClass,
java.lang.String uniqueIdentifier)
Given a JavaClass and a unique identifier, find the JavaField in the JavaClass
that has that unique identifier.
|
static JavaField |
getDeclaredFieldFromUniqueId(JavaFile javaFile,
java.lang.String uniqueIdentifier)
Given a JavaFile and a unique identifier, find the JavaField in the JavaFile
that has that unique identifier.
|
static JavaMethod |
getDeclaredMethod(JavaType target,
java.lang.String name,
JavaType[] targetTypes)
Get the declared method of 'target' whose name and parameter
types match the incoming name and types.
|
static JavaMethod |
getDeclaredMethodFromUniqueId(JavaClass javaClass,
java.lang.String uniqueIdentifier)
Given a JavaClass and a unique identifier, find the JavaMethod in the JavaClass
that has that unique identifier.
|
static JavaMethod |
getDeclaredMethodFromUniqueId(JavaFile javaFile,
java.lang.String uniqueIdentifier)
Given a JavaFile and a unique identifier, find the JavaMethod in the JavaFile
that has that unique identifier.
|
static java.util.Collection |
getDeclaredMethods(JavaType target,
java.lang.String name) |
static java.lang.String |
getDescriptor(JavaClass input)
Get the descriptor of the incoming class, which is the pre-JDK1.5 way
of making a unique description of a class, e.g.
|
static java.lang.String |
getDescriptor(JavaField input)
Get the descriptor of a JavaField which is the pre JDK1.5 way to describe
a field.
|
static java.lang.String |
getDescriptor(JavaMethod input)
Get the descriptor of the incoming method, which is the pre JDK1.5 way to
describe methods.
|
static java.lang.String |
getDescriptor(JavaTypeVariable input)
Get the descriptor of a type parameter, which returns the descriptor
of the erasure of that type parameter.
|
static SourceMember |
getEnclosingMember(SourceElement sourceElement)
Get the enclosing SourceMember of the incoming SourceElement.
|
static SourceMethod |
getEnclosingMethod(SourceElement sourceElement)
Get the enclosing method of the incoming SourceElement.
|
static SourceClass |
getEnclosingType(SourceElement sourceElement)
Get the enclosing type of the incoming SourceElement, where a type is a
SourceElement with symbol kind equals to JavaConstants.SRC_CLASS,
such as classes, interfaces, enums, and annotation types.
|
static JavaField |
getField(JavaType target,
java.lang.String name) |
static java.util.Collection<JavaField> |
getFields(JavaType target) |
static JavaMethod |
getFunctionalInterfaceMethod(JavaType javaType)
IFF the incoming JavaType is a functional interface, return the
single abstract method of that interface.
|
static JavaHasNameSet<JavaType> |
getHandledExceptions(SourceElement sourceElement)
Gets the exceptions handled by the enclosing context of a source element.
|
static java.lang.String |
getInstantiatedTypeToString(JavaType type)
Create a printable String representation of an instantiated type.
|
static JavaMethod |
getMethod(JavaType target,
java.lang.String name,
JavaType[] parameterTypes)
Get the first method of the target type with the specified name
and parameter types.
|
static java.util.Collection<JavaMethod> |
getMethods(JavaType target)
Get all the methods of the incoming target type.
|
static java.util.Collection<JavaMethod> |
getMethods(JavaType target,
java.lang.String name)
Get all the methods of the target type with the specified name.
|
static java.util.List<java.lang.Integer> |
getParameterCommaLocations(SourceMethod sourceMethod)
Given a SourceMethod, find the locations of the commas separating
the parameters of that SourceMethod.
|
static JavaType[] |
getParameterTypes(JavaMethod target)
Get the parameter types of the incoming method.
|
static PrimitiveType |
getPrimitiveType(java.lang.String name) |
static java.lang.String |
getSignature(JavaClass input)
Get the signature of a class, which is the JDK1.5 and higher
descriptor of the declaration of a class.
|
static java.lang.String |
getSignature(JavaField input)
Get the signature of a JavaField, which is the JDK1.5 and beyond descriptor
of the declaration of the JavaField.
|
static java.lang.String |
getSignature(JavaMethod input)
Get the signature of the incoming method, which is the signature of
the method declaration.
|
static java.lang.String |
getSignature(JavaTypeVariable input)
Get the signature of a type parameter, which is the descriptor of
the declaration of the type parameter.
|
static java.util.List<SourceClass> |
getSourceAnonymousClasses(SourceElement sourceElement)
Get the anonymous classes enclosed by the incoming source member.
|
static SourceAnnotation |
getSourceElement(JavaAnnotation target,
SourceHasModifiers searchSpace) |
static SourceClass |
getSourceElement(JavaClass target,
SourceClass searchSpace)
Searches for the target type as a member of the search class.
|
static SourceClass |
getSourceElement(JavaClass target,
SourceFile searchSpace)
Searches for the target type as a member of the search class.
|
static SourceElement |
getSourceElement(JavaElement target,
SourceFile searchSpace) |
static SourceMemberVariable |
getSourceElement(JavaField target,
SourceClass searchSpace)
Searches for the target field as a member of the search class.
|
static SourceMethod |
getSourceElement(JavaMethod target,
SourceClass searchSpace)
Searches for the target method as a member of the search class.
|
static java.util.List<SourceClass> |
getSourceLocalClasses(SourceElement sourceElement)
Get the local classes enclosed by the incoming source element.
|
static java.util.Collection<JavaType> |
getTargetType(SourceExpression expression,
java.util.Collection<JavaType> exceptions)
Given a SourceExpression, find the type that the context surrounding that
SourceExpression expects from this SourceExpression.
|
static JavaClass |
getTypeErasure(JavaTypeVariable thing) |
static JavaTypeVariable |
getTypeParameter(JavaIsGeneric target,
java.lang.String name) |
static java.lang.String |
getTypeSignature(JavaClass input)
Get the type signature of a class which is the JDK1.5 and higher
descriptor of the usage of a class.
|
static java.lang.String |
getTypeSignature(JavaMethod input)
Get the type signature of the incoming method, which is the JDK1.5 and
higher signature of the usage of a method.
|
static java.lang.String |
getTypeSignature(JavaTypeVariable input)
Get the type signature of a type parameter, which is the descriptor of
a usage of the type parameter.
|
static java.lang.String |
getUniqueIdentifier(JavaClass thing) |
static java.lang.String |
getUniqueIdentifier(JavaField thing) |
static java.lang.String |
getUniqueIdentifier(JavaMethod thing)
Get a String that uniquely identifies this method.
|
static java.lang.String |
getUniqueIdentifier(JavaPackage thing) |
static java.lang.String |
getUniqueIdentifier(JavaTypeVariable thing) |
static java.lang.String |
getUniqueIdentifier(JavaWildcardType thing) |
static boolean |
hasBoundsCircularity(JavaTypeVariable javaTypeVariable)
Detect circular references in the bounds of a JavaTypeVariable, such as:
<E extends E> or
<E extends T, T extends E>
|
static int |
hashCode(JavaMember thing) |
static int |
hashCode(JavaPackage thing) |
static boolean |
hasOverrideCompatibleVisibility(JavaMethod method,
JavaMethod otherMethod)
Determine if qua visibility method can override the other method.
|
static java.util.List |
immutableCopy(java.util.Collection src) |
protected static byte |
infix_op(int token) |
static boolean |
isFunctionalInterface(JavaType javaType)
Determine if the incoming JavaType is a functional interface,
meaning an interface with one abstract method.
|
static boolean |
isInGuardedSection(SourceElement sourceElement)
Determine if the incoming SourceElement is completely or partly in
a guarded section of a GuardedTextBuffer.
|
protected static boolean |
isInheritedAnnotation(JavaAnnotation annotation) |
protected static boolean |
isInheritedAnnotation(JavaType annotationType) |
static boolean |
isKeyword(java.lang.String word,
byte j2se)
Deprecated.
User isKeyword( String, JdkVersion ) instead
|
static boolean |
isKeyword(java.lang.String word,
JdkVersion jdkVersion)
Determine if the incoming word is a keyword in the specified JDK version
|
static boolean |
isMarkerInterface(JavaType javaType)
Determine if the incoming JavaType is a marker interface, meaning
an interface with no members and as parent either java.lang.Object
or another marker interface.
|
static boolean |
isParameterizedMethod(JavaMethod method)
Find out if the incoming method has bound type arguments, either from
explicit type arguments, or from inferred type arguments.
|
static boolean |
isSameDeclaration(JavaField one,
JavaField two)
Determine if two JavaFields have the same declaration
|
static boolean |
isSameDeclaration(JavaMethod one,
JavaMethod two)
Determine if two JavaMethods have the same declaration
|
static boolean |
isSameDeclaration(JavaType one,
JavaType two)
Determine if two JavaTypes have the same declaration
|
static boolean |
isTypeUseAnnotation(JavaAnnotation javaAnnotation,
boolean strict)
Is this a type use annotation, which is an annotation annotated with @Target(TYPE_USE)
meant to be used as a type annotation.
|
static boolean |
isValidImportName(java.lang.String name)
Identifiers and keywords are allowed.
|
static boolean |
isValidQualifiedName(java.lang.String name)
Identifiers and keywords are allowed.
|
static boolean |
isValidSimpleName(java.lang.String name)
Identifiers and keywords are allowed.
|
static JavaElement |
locateByUniqueIdentifier(java.lang.String uniqueIdentifier,
JavaProvider provider)
This will work for packages, classes, methods, and fields.
|
static boolean |
matchMethod(JavaMethod method,
JavaType[] targetParameterTypes)
Determine if the incoming method has parameters with types
that match the incoming target parameter types.
|
static boolean |
methodThrowsMoreCheckedExceptions(JavaMethod subject,
JavaMethod target)
Determine if the subject method throws more checked Exceptions than the target method.
|
static java.util.ArrayList |
mutableCopy(java.util.Collection src) |
static void |
notImplementedYet() |
static void |
panic() |
static void |
panic(java.lang.String msg) |
protected static byte |
postfix_op(int token) |
protected static byte |
prefix_op(int token) |
static byte |
provider2jdkVersion(JavaProvider provider) |
protected static byte |
rel_op(int token) |
protected static byte |
shift_op(int token) |
static void |
unsupported() |
static void |
unsupported(java.lang.String msg) |
applyAssignmentConversion, applyAssignmentConversion, applyAssignmentConversion, applyBinaryPromotion, applyBoxingConversion, applyBoxingConversion, applyCastingConversion, applyCastingConversion, applyMethodConversion, applyMethodConversion, applyNarrowingConversion, applyUnaryPromotion, applyUnboxingConversion, applyUnboxingConversion, applyWideningConversion, hasSubsignatureOf, inheritsFrom, isReturnTypeSubstitutable, isSubtypeOf, isSubtypeOfImpl, isSubtypeOfImpl
allocArrayList, freeArrayList
public static byte provider2jdkVersion(JavaProvider provider)
provider
- The provider to test the jdk version of.public static boolean isInGuardedSection(SourceElement sourceElement)
sourceElement
- A SourceElementjava.lang.IllegalArgumentException
- if sourceElement is nullpublic static PrimitiveType getPrimitiveType(java.lang.String name)
public static JavaType createArrayType(JavaProvider provider, JavaType component, int dimensions)
provider
- The provider to create types, which should not be nullcomponent
- The component type which should not be nulldimensions
- The array dimension which should be larger than 0java.lang.IllegalArgumentException
- if dimension is negative.public static JavaType createArrayType(JavaProvider provider, JavaType component, int dimensions, java.util.List<java.util.List<JavaAnnotation>> typeAnnotations)
provider
- The provider to create types, which should not be nullcomponent
- The component type which should not be nulldimensions
- The array dimension which should be larger than 0typeAnnotations
- Optional type annotations for each dimension
(from left to right). Use null or an empty List for no type
annotations at all. Otherwise the size of this typeAnnotations
List of Lists should be equal to dimensions and should contain
valid Lists, one for each dimension, either empty or filled
with annotation typesjava.lang.IllegalArgumentException
- if dimension is negative.public static JavaType createTypeErasedClass(JavaProvider provider, JavaType type)
public static JavaType createParameterizedType(JavaProvider provider, JavaType generic, JavaType[] typeArguments)
typeArguments
- Collection of JavaType's.java.lang.IllegalArgumentException
- if input type is not a generic
type, if the input type is already bound, or if the type arguments are
not legal type arguments to this generic type.public static JavaType createDiamondParameterizedType(JavaProvider provider, JavaType type)
provider
- The java providertype
- The type to use for the parameterized typejava.lang.IllegalArgumentException
- if input type is not a generic
type, meaning it doesn't have typeParameters.public static JavaType createAnnotatedJavaType(JavaType javaType, java.util.List<JavaAnnotation> annotations)
javaType
- A JavaType, which should not be nullannotations
- Some annotations which should not be nullpublic static JavaMethod createParameterizedMethod(JavaProvider provider, JavaMethod generic, JavaType[] typeArguments)
typeArguments
- Collection of JavaType's.java.lang.IllegalArgumentException
- if input type is not a generic
type.public static JavaType createWildcardType(byte bound, JavaType t, JavaProvider provider)
BOUND_NARROW: "T" T is returned, this is not a wildcard type. BOUND_EXTENDS: "? extends T" If T is null, then this will be treated just like BOUND_NONE. BOUND_SUPER: "? super T" If T is null, an exception is thrown. BOUND_NONE: "?" T is ignored.
bound
- Valid values are JavaConstants.BOUND_*.t
- The bounding type.provider
- A provider that can fetch java/lang/Object.java.lang.IllegalArgumentException
- for an invalid bound parameter
or an invalid type parameter.public static boolean isFunctionalInterface(JavaType javaType)
javaType
- A JavaTypepublic static boolean isMarkerInterface(JavaType javaType)
javaType
- A JavaTypepublic static JavaMethod getFunctionalInterfaceMethod(JavaType javaType)
javaType
- A JavaType which should not be nullpublic static java.util.Collection<JavaType> getTargetType(SourceExpression expression, java.util.Collection<JavaType> exceptions)
expression
- An expression which should not be nullexceptions
- A special case used in situations where the context is
a throw statement. If 'exceptions' is defined, the expected type of a
throw context will return 'exceptions'.public static SourceClass getEnclosingType(SourceElement sourceElement)
sourceElement
- A SourceElement which should not be nullpublic static SourceMethod getEnclosingMethod(SourceElement sourceElement)
sourceElement
- A SourceElement which should not be nullpublic static SourceMember getEnclosingMember(SourceElement sourceElement)
sourceElement
- A SourceElement which should not be nullpublic static boolean isTypeUseAnnotation(JavaAnnotation javaAnnotation, boolean strict)
javaAnnotation
- The annotationstrict
- If true, only annotations with a @Target(ElementType.TYPE_USE) meta annotation
are considred a type use annotation, if false annotations without a Target meta annotation
are also considered a type use annotation.public static boolean matchMethod(JavaMethod method, JavaType[] targetParameterTypes)
method
- A methodtargetParameterTypes
- The parameter types to matchprotected static boolean isInheritedAnnotation(JavaAnnotation annotation)
protected static boolean isInheritedAnnotation(JavaType annotationType)
public static boolean isParameterizedMethod(JavaMethod method)
method
- The incoming methodprotected static boolean classProcessed(java.util.Set processed, JavaType javaClass)
processed
- An initially empty set for use with this function
ONLY.protected static byte asg_op(int token)
token
- a token listed in JavaTokensprotected static byte rel_op(int token)
token
- a token listed in JavaTokensprotected static byte shift_op(int token)
token
- a token listed in JavaTokensprotected static byte infix_op(int token)
token
- a token listed in JavaTokensprotected static byte prefix_op(int token)
token
- a token listed in JavaTokensprotected static byte postfix_op(int token)
token
- a token listed in JavaTokenspublic static java.lang.String getDescriptor(JavaMethod input)
input
- A JavaMethod which should not be nullpublic static java.lang.String getTypeSignature(JavaMethod input)
input
- A JavaMethod which should not be nullpublic static java.lang.String getSignature(JavaMethod input)
input
- A JavaMethod which should not be nullpublic static java.lang.String getDescriptor(JavaField input)
input
- A JavaField which should not be nullpublic static java.lang.String getSignature(JavaField input)
input
- A JavaField which should not be nullpublic static java.lang.String getDescriptor(JavaClass input)
input
- A JavaClass which should not be nullpublic static java.lang.String getTypeSignature(JavaClass input)
input
- A JavaClass which should not be nullpublic static java.lang.String getSignature(JavaClass input)
input
- A JavaClass which should not be nullpublic static java.lang.String getDescriptor(JavaTypeVariable input)
input
- A JavaTypeVariable which should not be nullpublic static java.lang.String getTypeSignature(JavaTypeVariable input)
input
- A JavaTypeVariable which should not be nullpublic static java.lang.String getSignature(JavaTypeVariable input)
input
- A JavaTypeVariable which should not be nullpublic static java.lang.String getUniqueIdentifier(JavaPackage thing)
public static java.lang.String getUniqueIdentifier(JavaClass thing)
public static java.lang.String getUniqueIdentifier(JavaTypeVariable thing)
public static java.lang.String getUniqueIdentifier(JavaWildcardType thing)
public static java.lang.String getUniqueIdentifier(JavaField thing)
public static java.lang.String getUniqueIdentifier(JavaMethod thing)
thing
- A JavaMethod which should not be nullpublic static boolean equals(JavaPackage one, JavaPackage two)
public static boolean equals(JavaMember one, JavaMember two)
public static boolean isSameDeclaration(JavaType one, JavaType two)
one
- A JavaType which can be nulltwo
- A JavaType which can be nullpublic static boolean isSameDeclaration(JavaMethod one, JavaMethod two)
one
- A JavaMethod which can be nulltwo
- A JavaMethod which can be nullpublic static boolean isSameDeclaration(JavaField one, JavaField two)
one
- A JavaField which can be nulltwo
- A JavaField which can be nullpublic static int hashCode(JavaPackage thing)
public static int hashCode(JavaMember thing)
public static java.util.Collection getDeclaredMethods(JavaType target, java.lang.String name)
public static JavaMethod getDeclaredMethod(JavaType target, java.lang.String name, JavaType[] targetTypes)
target
- The type to searchname
- The name of the methodtargetTypes
- The parameter types of the methodpublic static JavaMethod getDeclaredConstructor(JavaType target, JavaType[] targetTypes)
target
- The type to searchtargetTypes
- The parameter types of the constructorpublic static JavaTypeVariable getTypeParameter(JavaIsGeneric target, java.lang.String name)
public static JavaAnnotation getDeclaredAnnotation(JavaHasAnnotations target, JavaType annotationType)
public static java.util.Collection<JavaMethod> getMethods(JavaType target)
target
- A JavaTypepublic static java.util.Collection<JavaMethod> getMethods(JavaType target, java.lang.String name)
target
- A Javatypename
- The name of the desired methodspublic static JavaMethod getMethod(JavaType target, java.lang.String name, JavaType[] parameterTypes)
target
- A Javatypename
- The name of the desired methodparameterTypes
- The parameters of the desired method, null means no parameterspublic static boolean methodThrowsMoreCheckedExceptions(JavaMethod subject, JavaMethod target)
subject
- The subject methodtarget
- The target methodpublic static boolean hasOverrideCompatibleVisibility(JavaMethod method, JavaMethod otherMethod)
method
- A methodotherMethod
- Another methodpublic static java.util.List<JavaType> getClassHierarchy(JavaType javaType)
javaType
- The type whose hierarchy is computedpublic static java.util.Collection<JavaAnnotation> getAnnotations(JavaType target)
public static JavaAnnotation getAnnotation(JavaType target, JavaType annotationType)
public static JavaType[] getParameterTypes(JavaMethod target)
target
- A JavaMethod which should not be nullpublic static JavaElement locateByUniqueIdentifier(java.lang.String uniqueIdentifier, JavaProvider provider)
public static SourceElement getSourceElement(JavaElement target, SourceFile searchSpace)
target
- Valid targets are root-level constructs (e.g. package,
import) and class constructs (e.g. methods).searchSpace
- The SourceFile to search through. The search will
only go as deep as member-depth.public static SourceClass getSourceElement(JavaClass target, SourceFile searchSpace)
public static SourceClass getSourceElement(JavaClass target, SourceClass searchSpace)
public static SourceMemberVariable getSourceElement(JavaField target, SourceClass searchSpace)
public static SourceMethod getSourceElement(JavaMethod target, SourceClass searchSpace)
public static SourceAnnotation getSourceElement(JavaAnnotation target, SourceHasModifiers searchSpace)
public static JavaMethod getDeclaredMethodFromUniqueId(JavaFile javaFile, java.lang.String uniqueIdentifier)
javaFile
- A JavaFile, which can also be a SourceFileuniqueIdentifier
- A String previously returned by getUniqueIdentifier(JavaMethod)public static JavaMethod getDeclaredMethodFromUniqueId(JavaClass javaClass, java.lang.String uniqueIdentifier)
javaClass
- A JavaClass, which can also be a SourceClassuniqueIdentifier
- A String previously returned by getUniqueIdentifier(JavaMethod)public static JavaField getDeclaredFieldFromUniqueId(JavaFile javaFile, java.lang.String uniqueIdentifier)
javaFile
- A JavaFile, which can also be a SourceFileuniqueIdentifier
- A String previously returned by getUniqueIdentifier(JavaField)public static JavaField getDeclaredFieldFromUniqueId(JavaClass javaClass, java.lang.String uniqueIdentifier)
javaClass
- A JavaClass, which can also be a SourceClassuniqueIdentifier
- A String previously returned by getUniqueIdentifier(JavaField)public static java.util.List<SourceClass> getSourceAnonymousClasses(SourceElement sourceElement)
sourceElement
- A source element which should not be nullpublic static java.util.List<SourceClass> getSourceLocalClasses(SourceElement sourceElement)
sourceElement
- A source member which should not be null@Deprecated public static boolean isKeyword(java.lang.String word, byte j2se)
word
- A wordj2se
- One of JavaTokens.J2SE_*public static boolean isKeyword(java.lang.String word, JdkVersion jdkVersion)
word
- A wordjdkVersion
- The JDK version of the keywordpublic static boolean isValidImportName(java.lang.String name)
public static boolean isValidQualifiedName(java.lang.String name)
public static boolean isValidSimpleName(java.lang.String name)
public static boolean containsClassThisSuper(java.lang.String qualifiedName)
qualifiedName
- Assumed to be a valid qualified name.public static JavaClass getTypeErasure(JavaTypeVariable thing)
public static boolean hasBoundsCircularity(JavaTypeVariable javaTypeVariable)
javaTypeVariable
- A JavaTypeVariablepublic static java.lang.String getInstantiatedTypeToString(JavaType type)
type
- A resolved type which should NOT be nullpublic static java.util.List immutableCopy(java.util.Collection src)
public static java.util.ArrayList mutableCopy(java.util.Collection src)
public static java.util.List<java.lang.Integer> getParameterCommaLocations(SourceMethod sourceMethod)
sourceMethod
- A SourceMethod which should not be null.public static java.util.List<java.lang.Integer> getArgumentCommaLocations(SourceInvokeExpression invokeExpression)
invokeExpression
- A SourceInvokeExpression which should not be null.public static JavaHasNameSet<JavaType> getHandledExceptions(SourceElement sourceElement)
sourceElement
- A SourceElement which should not be nullpublic static java.lang.String format(java.lang.String input, java.lang.String arg0)
public static java.lang.String format(java.lang.String input, java.lang.String arg0, java.lang.String arg1)
public static void panic(java.lang.String msg)
public static void panic()
public static void unsupported(java.lang.String msg)
public static void unsupported()
public static void notImplementedYet()