Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.javatools.parser.java.v2.common
Class CommonUtilities

java.lang.Object
  extended by oracle.javatools.parser.util.ArrayListHeap
      extended by oracle.javatools.parser.java.v2.util.Conversions
          extended by oracle.javatools.parser.java.v2.common.CommonUtilities
All Implemented Interfaces:
JavaConstants, JavaErrors, JavaOperators, JavaPreferences, JavaTokens
Direct Known Subclasses:
BindingRegistry, CallerContext, oracle.javatools.parser.java.v2.internal.InternalUtilities

public class CommonUtilities
extends Conversions
implements JavaConstants

Various utilities shared by the parser internals and parser externals.


Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.javatools.parser.java.v2.util.Conversions
Conversions.ConversionType
 
Nested classes/interfaces inherited from interface oracle.javatools.parser.java.v2.JavaPreferences
JavaPreferences.MemberOrder
 
Field Summary
 
Fields inherited from interface oracle.javatools.parser.java.v2.JavaConstants
ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, 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_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_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_LIST, SRC_EXPR_LITERAL, SRC_EXPR_max, SRC_EXPR_METHOD_CALL, 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_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_TYPE_ARGUMENT, SRC_TYPE_PARAMETER, SRC_TYPE_REF, SRC_words, TY_ANNOTATE, TY_CLASS, TY_ENUM, TY_INTERFACE, TY_invalid, TY_max, TY_words
 
Fields inherited from interface oracle.javatools.parser.java.v2.JavaErrors
ERROR_ABSTRACT_CLASS, ERROR_AMBIGUOUS_IMPORT, ERROR_AMBIGUOUS_REF, ERROR_ASSERT_IDENTIFIER, ERROR_base, ERROR_BREAK_OUTSIDE_SWITCH_OR_LOOP, ERROR_CANCELLED, 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_DUPLICATE, ERROR_EMPTY_CHAR_LITERAL, ERROR_EMPTY_EXPRESSION, ERROR_EXPECTING_ONE, ERROR_EXPECTING_TWO, ERROR_EXPECTING_TYPE, ERROR_EXTENDS_NOT_ALLOWED, ERROR_EXTENDS_TOO_MANY, ERROR_FORWARD_REFERENCE, ERROR_ILLEGAL_ANNOTATION, ERROR_ILLEGAL_DEFAULT, ERROR_ILLEGAL_LABEL, ERROR_ILLEGAL_START_OF_EXPR, ERROR_ILLEGAL_TYPE_PARAMETERS, ERROR_ILLEGAL_VARARGS, ERROR_IMPLEMENTS_NOT_ALLOWED, ERROR_IMPORT_NOT_FOUND, ERROR_INTERNAL, 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_CASE_OR_DEFAULT_LABEL, ERROR_MISSING_CONDITION, ERROR_MISSING_METHOD_BODY, ERROR_MODIFIER_REPEATED, ERROR_MULTIPLE_COMPONENTS, ERROR_NAME_NOT_FOUND, ERROR_none, 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_OBJECT, ERROR_REQUIRE_OUTER_CLASS, ERROR_SCAN_base, ERROR_SCAN_GENERIC, ERROR_SCAN_max, ERROR_TYPE_ARGUMENT_MISMATCH, ERROR_TYPE_IS_NOT_AUTOCLOSEABLE, ERROR_TYPE_IS_NOT_DISJUNCTIVE, ERROR_TYPE_NOT_ALLOWED, ERROR_TYPE_NOT_FOUND, ERROR_UNEXPECTED, ERROR_UNKNOWN, ERROR_VOID_RETURN, ERROR_warnings, ERROR_words, SEVERITY_ERROR, SEVERITY_FATAL, SEVERITY_LINT, SEVERITY_WARNING, SEVERITY_ZERO, WARNING_AMBIGUOUS_DOC_REFERENCE, WARNING_ASSERT_IDENTIFIER, WARNING_DOC_REFERENCE_NOT_FOUND, WARNING_IMPORT_UNUSED, WARNING_INVALID_NAME, WARNING_METHOD_NAME
 
Fields inherited from interface oracle.javatools.parser.java.v2.JavaOperators
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_invalid, OPT_INVOKE, OPT_LE, OPT_LIST, OPT_LITERAL, OPT_LSH, OPT_LSHASG, OPT_LT, OPT_max, 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
 
Fields inherited from interface oracle.javatools.parser.java.v2.JavaTokens
DW_values, DW_words, J2SE_13, J2SE_14, J2SE_15, J2SE_16, J2SE_17, 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_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_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_RPAREN, OP_RSH, OP_RSH_ASG, OP_SEMI, OP_URSH, OP_URSH_ASG, OP_words, OP_XOR_ASG, 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
 
Fields inherited from interface oracle.javatools.parser.java.v2.JavaPreferences
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, 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, INTEGER_ALWAYS_WRAP, INTEGER_NEVER_WRAP, INTEGER_WRAP_IF_LONG, MEMBER_ORDER, NEWLINE_AFTER_SWITCH_CASE, NEWLINE_ARRAY_BRACES, NEWLINE_BLOCK_BRACES, NEWLINE_CATCH, NEWLINE_CLASS_BRACES, NEWLINE_ELSE, NEWLINE_EXTENDS, NEWLINE_FINALLY, NEWLINE_IMPLEMENTS, NEWLINE_METHOD_BRACES, NEWLINE_THROWS, NEWLINE_WHILE, ONE, PREFERENCES_base, PREFERENCES_defaults, 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_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_ARRAY_CONSTANT, WRAP_BINARY_OPERATOR, WRAP_DOT_CHAIN, WRAP_EXTENDS, WRAP_FOR_STATEMENT, WRAP_INVOKE_ARGUMENTS, WRAP_LINE_WIDTH, WRAP_MODIFIERS, WRAP_PARAMETER_LIST, WRAP_QUES_OPERATOR, WRAP_THROWS, ZERO
 
Constructor Summary
CommonUtilities()
           
 
Method Summary
protected static TextBuffer acquireTextBuffer()
           
protected static byte asg_op(int token)
           
protected static boolean classProcessed(java.util.ArrayList 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 createArrayType(JavaProvider provider, JavaType component, int dimensions)
           
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[] arguments)
           
static JavaType createParameterizedType(JavaProvider provider, JavaType generic, JavaType[] arguments)
           
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 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 JavaAnnotation getDeclaredAnnotation(JavaHasAnnotations target, JavaType annotationType)
           
static JavaClass getDeclaredClass(JavaType target, java.lang.String name)
           
static JavaMethod getDeclaredConstructor(JavaType target, JavaType[] targetTypes)
           
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)
           
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)
           
static java.lang.String getDescriptor(JavaField input)
           
static java.lang.String getDescriptor(JavaMethod input)
           
static java.lang.String getDescriptor(JavaTypeVariable input)
           
static JavaField getField(JavaType target, java.lang.String name)
           
static java.util.Collection getFields(JavaType target)
           
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[] targetTypes)
           
static java.util.Collection<JavaMethod> getMethods(JavaType target)
           
static java.util.Collection<JavaMethod> getMethods(JavaType target, java.lang.String name)
           
static JavaType[] getParameterTypes(JavaMethod target)
           
static PrimitiveType getPrimitiveType(java.lang.String name)
           
static java.lang.String getSignature(JavaClass input)
           
static java.lang.String getSignature(JavaField input)
           
static java.lang.String getSignature(JavaMethod input)
           
static java.lang.String getSignature(JavaTypeVariable input)
           
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 JavaClass getTypeErasure(JavaTypeVariable thing)
           
static JavaTypeVariable getTypeParameter(JavaIsGeneric target, java.lang.String name)
           
static java.lang.String getTypeSignature(JavaClass input)
           
static java.lang.String getTypeSignature(JavaMethod input)
           
static java.lang.String getTypeSignature(JavaTypeVariable input)
           
static java.lang.String getUniqueIdentifier(JavaClass thing)
           
static java.lang.String getUniqueIdentifier(JavaField thing)
           
static java.lang.String getUniqueIdentifier(JavaMethod thing)
           
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: or
static int hashCode(JavaMember thing)
           
static int hashCode(JavaPackage thing)
           
static java.util.List immutableCopy(java.util.Collection src)
           
protected static byte infix_op(int token)
           
protected static boolean isInheritedAnnotation(JavaAnnotation annotation)
           
protected static boolean isInheritedAnnotation(JavaType annotationType)
           
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 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[] targetTypes)
           
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)
          Returns the JDK version of the provider by looking for certain class names in that provider.
protected static byte rel_op(int token)
           
protected static void releaseTextBuffer(TextBuffer textBuffer)
          The caller is responsible for ensuring that there are no more text buffer listeners attached to this buffer.
protected static byte shift_op(int token)
           
static void unsupported()
           
static void unsupported(java.lang.String msg)
           
 
Methods inherited from class oracle.javatools.parser.java.v2.util.Conversions
applyAssignmentConversion, applyAssignmentConversion, applyBinaryPromotion, applyBoxingConversion, applyCastingConversion, applyMethodConversion, applyNarrowingConversion, applyUnaryPromotion, applyUnboxingConversion, applyWideningConversion, hasSubsignatureOf, inheritsFrom, isSubtypeOf, isSubtypeOfImpl, isSubtypeOfImpl
 
Methods inherited from class oracle.javatools.parser.util.ArrayListHeap
allocArrayList, freeArrayList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonUtilities

public CommonUtilities()
Method Detail

provider2jdkVersion

public static byte provider2jdkVersion(JavaProvider provider)
Returns the JDK version of the provider by looking for certain class names in that provider.

Parameters:
provider - The provider to test the jdk version of.
Returns:
The detected JavaTokens.J2SE_* value.

acquireTextBuffer

protected static TextBuffer acquireTextBuffer()

releaseTextBuffer

protected static void releaseTextBuffer(TextBuffer textBuffer)
The caller is responsible for ensuring that there are no more text buffer listeners attached to this buffer.


getPrimitiveType

public static PrimitiveType getPrimitiveType(java.lang.String name)
Returns:
The canonical primitive type.

createArrayType

public static JavaType createArrayType(JavaProvider provider,
                                       JavaType component,
                                       int dimensions)
Returns:
A newly created array type.
Throws:
java.lang.IllegalArgumentException - if dimension is negative.

createTypeErasedClass

public static JavaType createTypeErasedClass(JavaProvider provider,
                                             JavaType type)

createParameterizedType

public static JavaType createParameterizedType(JavaProvider provider,
                                               JavaType generic,
                                               JavaType[] arguments)
Parameters:
arguments - Collection of JavaType's.
Throws:
java.lang.IllegalArgumentException - if input type is not a generic type, if the input type is already bound, or if the arguments are not legal arguments to this generic type.

createDiamondParameterizedType

public 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

Parameters:
provider - The java provider
type - The type to use for the parameterized type
Throws:
java.lang.IllegalArgumentException - if input type is not a generic type, meaning it doesn't have typeParameters.

createParameterizedMethod

public static JavaMethod createParameterizedMethod(JavaProvider provider,
                                                   JavaMethod generic,
                                                   JavaType[] arguments)
Parameters:
arguments - Collection of JavaType's.
Throws:
java.lang.IllegalArgumentException - if input type is not a generic type.

createWildcardType

public static JavaType createWildcardType(byte bound,
                                          JavaType t,
                                          JavaProvider provider)
Creates a wildcard type. Note: "? extends java.lang.Object" and "?" are NOT equivalent as far as the jdk is concerned. Moreover, "? super java.lang.Object" is legal (but foolish).

 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.
 

Parameters:
bound - Valid values are JavaConstants.BOUND_*.
t - The bounding type.
provider - A provider that can fetch java/lang/Object.
Returns:
The newly created WildcardType, except for BOUND_NARROW. If BOUND_NARROW is specified, then T is returned as is.
Throws:
java.lang.IllegalArgumentException - for an invalid bound parameter or an invalid type parameter.

matchMethod

public static boolean matchMethod(JavaMethod method,
                                  JavaType[] targetTypes)

isInheritedAnnotation

protected static boolean isInheritedAnnotation(JavaAnnotation annotation)
Returns:
True if the input annotation is an inherited annotation.

isInheritedAnnotation

protected static boolean isInheritedAnnotation(JavaType annotationType)
Returns:
True if the input annotationType is an inherited annotation.

isParameterizedMethod

public 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.

Parameters:
method - The incoming method
Returns:
True if the incoming has bound type arguments

classProcessed

protected static boolean classProcessed(java.util.ArrayList processed,
                                        JavaType javaClass)
After this function, the input class will be added to the processed list. How the processed list is represented is up to the discretion of the implementer and the caller should not depend on knowing how the processed list works.

Parameters:
processed - An initially empty list for use with this function ONLY.
Returns:
True if the input class has already been iterated over.

asg_op

protected static byte asg_op(int token)
Parameters:
token - a token listed in JavaTokens
Returns:
The OPT_* value. OPT_invalid if not an assignment op.

rel_op

protected static byte rel_op(int token)
Parameters:
token - a token listed in JavaTokens
Returns:
The OPT_* value. OPT_invalid if not a relational op.

shift_op

protected static byte shift_op(int token)
Parameters:
token - a token listed in JavaTokens
Returns:
The OPT_* value. OPT_invalid if not a shift op.

infix_op

protected static byte infix_op(int token)
Parameters:
token - a token listed in JavaTokens
Returns:
The OPT_* value. OPT_invalid if not a infix op.

prefix_op

protected static byte prefix_op(int token)
Parameters:
token - a token listed in JavaTokens
Returns:
The OPT_* value. OPT_invalid if not a prefix op.

postfix_op

protected static byte postfix_op(int token)
Parameters:
token - a token listed in JavaTokens
Returns:
The OPT_* value. OPT_invalid if not a postfix op.

getDescriptor

public static java.lang.String getDescriptor(JavaMethod input)

getTypeSignature

public static java.lang.String getTypeSignature(JavaMethod input)

getSignature

public static java.lang.String getSignature(JavaMethod input)

getDescriptor

public static java.lang.String getDescriptor(JavaField input)

getSignature

public static java.lang.String getSignature(JavaField input)

getDescriptor

public static java.lang.String getDescriptor(JavaClass input)

getTypeSignature

public static java.lang.String getTypeSignature(JavaClass input)

getSignature

public static java.lang.String getSignature(JavaClass input)

getDescriptor

public static java.lang.String getDescriptor(JavaTypeVariable input)

getTypeSignature

public static java.lang.String getTypeSignature(JavaTypeVariable input)

getSignature

public static java.lang.String getSignature(JavaTypeVariable input)

getUniqueIdentifier

public static java.lang.String getUniqueIdentifier(JavaPackage thing)

getUniqueIdentifier

public static java.lang.String getUniqueIdentifier(JavaClass thing)

getUniqueIdentifier

public static java.lang.String getUniqueIdentifier(JavaTypeVariable thing)

getUniqueIdentifier

public static java.lang.String getUniqueIdentifier(JavaWildcardType thing)

getUniqueIdentifier

public static java.lang.String getUniqueIdentifier(JavaField thing)

getUniqueIdentifier

public static java.lang.String getUniqueIdentifier(JavaMethod thing)

equals

public static boolean equals(JavaPackage one,
                             JavaPackage two)

equals

public static boolean equals(JavaMember one,
                             JavaMember two)

isSameDeclaration

public static boolean isSameDeclaration(JavaType one,
                                        JavaType two)
Determine if two JavaTypes have the same declaration

Parameters:
one - A JavaType which can be null
two - A JavaType which can be null
Returns:
True if the two JavaTypes have the same declaration

isSameDeclaration

public static boolean isSameDeclaration(JavaMethod one,
                                        JavaMethod two)
Determine if two JavaMethods have the same declaration

Parameters:
one - A JavaMethod which can be null
two - A JavaMethod which can be null
Returns:
True if the two JavaMethods have the same declaration

isSameDeclaration

public static boolean isSameDeclaration(JavaField one,
                                        JavaField two)
Determine if two JavaFields have the same declaration

Parameters:
one - A JavaField which can be null
two - A JavaField which can be null
Returns:
True if the two JavaFields have the same declaration

hashCode

public static int hashCode(JavaPackage thing)

hashCode

public static int hashCode(JavaMember thing)

getDeclaredField

public static JavaField getDeclaredField(JavaType target,
                                         java.lang.String name)

getDeclaredMethods

public static java.util.Collection getDeclaredMethods(JavaType target,
                                                      java.lang.String name)

getDeclaredMethod

public static JavaMethod getDeclaredMethod(JavaType target,
                                           java.lang.String name,
                                           JavaType[] targetTypes)

getDeclaredConstructor

public static JavaMethod getDeclaredConstructor(JavaType target,
                                                JavaType[] targetTypes)

getDeclaredClass

public static JavaClass getDeclaredClass(JavaType target,
                                         java.lang.String name)

getTypeParameter

public static JavaTypeVariable getTypeParameter(JavaIsGeneric target,
                                                java.lang.String name)

getDeclaredAnnotation

public static JavaAnnotation getDeclaredAnnotation(JavaHasAnnotations target,
                                                   JavaType annotationType)

getFields

public static java.util.Collection getFields(JavaType target)

getField

public static JavaField getField(JavaType target,
                                 java.lang.String name)

getMethods

public static java.util.Collection<JavaMethod> getMethods(JavaType target)

getMethods

public static java.util.Collection<JavaMethod> getMethods(JavaType target,
                                                          java.lang.String name)

getMethod

public static JavaMethod getMethod(JavaType target,
                                   java.lang.String name,
                                   JavaType[] targetTypes)

getClasses

public static java.util.Collection<JavaClass> getClasses(JavaType target)

getClass

public static JavaClass getClass(JavaType target,
                                 java.lang.String name)

getClass

public static JavaClass getClass(JavaFile target,
                                 java.lang.String name)

getAnnotations

public static java.util.Collection<JavaAnnotation> getAnnotations(JavaType target)

getAnnotation

public static JavaAnnotation getAnnotation(JavaType target,
                                           JavaType annotationType)

getParameterTypes

public static JavaType[] getParameterTypes(JavaMethod target)

locateByUniqueIdentifier

public static JavaElement locateByUniqueIdentifier(java.lang.String uniqueIdentifier,
                                                   JavaProvider provider)
This will work for packages, classes, methods, and fields.


getSourceElement

public static SourceElement getSourceElement(JavaElement target,
                                             SourceFile searchSpace)
Parameters:
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.

getSourceElement

public static SourceClass getSourceElement(JavaClass target,
                                           SourceFile searchSpace)
Searches for the target type as a member of the search class.


getSourceElement

public static SourceClass getSourceElement(JavaClass target,
                                           SourceClass searchSpace)
Searches for the target type as a member of the search class.


getSourceElement

public static SourceMemberVariable getSourceElement(JavaField target,
                                                    SourceClass searchSpace)
Searches for the target field as a member of the search class.


getSourceElement

public static SourceMethod getSourceElement(JavaMethod target,
                                            SourceClass searchSpace)
Searches for the target method as a member of the search class.


getSourceElement

public static SourceAnnotation getSourceElement(JavaAnnotation target,
                                                SourceHasModifiers searchSpace)

getDeclaredMethodFromUniqueId

public 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. This method also works for SourceFiles ( which ARE JavaFiles), in which case the caller should use JavaMethod.getSourceElement() on the returned value to retrieve the SourceMethod.

Parameters:
javaFile - A JavaFile, which can also be a SourceFile
uniqueIdentifier - A String previously returned by getUniqueIdentifier(JavaMethod)
Returns:
The JavaMethod that has the uniqueIdentifier, or null if that JavaMethod could not be found.

getDeclaredMethodFromUniqueId

public 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. This method also works for SourceClasses (which ARE JavaClasses), in which case the caller should use JavaMethod.getSourceElement() on the returned value to retrieve the SourceMethod.

Parameters:
javaClass - A JavaClass, which can also be a SourceClass
uniqueIdentifier - A String previously returned by getUniqueIdentifier(JavaMethod)
Returns:
The JavaMethod that has the uniqueIdentifier, or null if that JavaMethod could not be found.

getDeclaredFieldFromUniqueId

public 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. This method also works for SourceFiles ( which ARE JavaFiles ), in which case the caller should use JavaField.getSourceElement() on the returned value to retrieve the SourceField.

Parameters:
javaFile - A JavaFile, which can also be a SourceFile
uniqueIdentifier - A String previously returned by getUniqueIdentifier(JavaField)
Returns:
The JavaField that has the uniqueIdentifier, or null if that JavaField could not be found.

getDeclaredFieldFromUniqueId

public 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. This method also works for SourceClasses (which ARE JavaClasses), in which case the caller should use JavaField.getSourceElement() on the returned value to retrieve the SourceField.

Parameters:
javaClass - A JavaClass, which can also be a SourceClass
uniqueIdentifier - A String previously returned by getUniqueIdentifier(JavaField)
Returns:
The JavaField that has the uniqueIdentifier, or null if that JavaField could not be found.

isValidImportName

public static boolean isValidImportName(java.lang.String name)
Identifiers and keywords are allowed.

Returns:
True if this is a qualified name optionally ending in ".*".

isValidQualifiedName

public static boolean isValidQualifiedName(java.lang.String name)
Identifiers and keywords are allowed.

Returns:
True if this is a valid qualified name.

isValidSimpleName

public static boolean isValidSimpleName(java.lang.String name)
Identifiers and keywords are allowed.

Returns:
True if this is a valid simple name.

containsClassThisSuper

public static boolean containsClassThisSuper(java.lang.String qualifiedName)
Parameters:
qualifiedName - Assumed to be a valid qualified name.

getTypeErasure

public static JavaClass getTypeErasure(JavaTypeVariable thing)

hasBoundsCircularity

public static boolean hasBoundsCircularity(JavaTypeVariable javaTypeVariable)
Detect circular references in the bounds of a JavaTypeVariable, such as: or

Parameters:
javaTypeVariable - A JavaTypeVariable
Returns:
True if there is a circular reference

getInstantiatedTypeToString

public static java.lang.String getInstantiatedTypeToString(JavaType type)
Create a printable String representation of an instantiated type. Any type arguments and array dimensions will be included in the final output.

Parameters:
type - A resolved type which should NOT be null
Returns:
The String representation of the incoming type which is guaranteed to be a valid String

immutableCopy

public static java.util.List immutableCopy(java.util.Collection src)

mutableCopy

public static java.util.ArrayList mutableCopy(java.util.Collection src)

format

public static java.lang.String format(java.lang.String input,
                                      java.lang.String arg0)

format

public static java.lang.String format(java.lang.String input,
                                      java.lang.String arg0,
                                      java.lang.String arg1)

panic

public static void panic(java.lang.String msg)

panic

public static void panic()

unsupported

public static void unsupported(java.lang.String msg)

unsupported

public static void unsupported()

notImplementedYet

public static void notImplementedYet()

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

Copyright © 1997, 2011, Oracle. All rights reserved.