| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| public static final GenericsType[] | |
| public static final String | |
| private static final EvictableCache | |
| private static final boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static Map | |
| public static GenericsType[] | Returns: aligned type argumentsthe type arguments or the redirect class node redirectGenericTypes, final GenericsType[] the actual type arguments used on this class node parameterizedTypes, final GenericsType[] the generic type arguments to which we want to align to alignmentTarget)
Deprecated
You shouldn't call this method because it is inherently unreliable
Given a parameterized type and a generic type information, aligns actual type parameters.
|
| public static GenericsType[] | Returns: the new generics typesthe generics context information spec genericsSpec, GenericsType[] the old placeholders oldPlaceHolders)Transforms generics types from an old context to a new context using the given spec. |
| public static GenericsType | buildWildcardType(final ClassNode... upperBounds)
Generates a wildcard generic type in order to be used for checks against class nodes. |
| private static boolean | |
| public static void | |
| public static MethodNode | |
| public static ClassNode | |
| public static ClassNode | |
| public static ClassNode | |
| public static ClassNode[] | |
| public static ClassNode | |
| private static Map | correlateTypeParametersAndTypeArguments(final ClassNode declaringClass, final ClassNode actualReceiver, final boolean tryToFindExactType)
|
| public static Map | |
| public static Map | |
| private static GenericsType | |
| public static Map | extractPlaceholders(final ClassNode
the class node to check type)Returns the type parameter/argument relationships of the specified type. |
| public static void | extractPlaceholders(final ClassNode
the class node to check type, final Map<GenericsType.the generics type information collector placeholdersPopulates the supplied map with the type parameter/argument relationships of the specified type. |
| public static void | |
| private static void | extractSuperClassGenerics(final GenericsType[] usage, final GenericsType[] declaration, final Map<String, ClassNode> spec)
|
| private static void | |
| public static ClassNode | findActualTypeByGenericsPlaceholderName(final String
the placeholder name (i.e. "T", "E", etc.) placeholderName, final Map<GenericsType, GenericsType> genericsPlaceholderAndTypeMap)Gets the actual type according to the placeholder name. |
| public static ClassNode | findParameterizedType(final ClassNode genericsClass, final ClassNode actualType)
Convenience method for |
| public static ClassNode | findParameterizedType(final ClassNode genericsClass, final ClassNode actualType, final boolean tryToFindExactType)
Gets the parameterized type by searching the whole class hierarchy according to generics class and actual receiver. |
| public static ClassNode | findParameterizedTypeFromCache(final ClassNode genericsClass, final ClassNode actualType)
Convenience method for |
| public static ClassNode | findParameterizedTypeFromCache(final ClassNode genericsClass, final ClassNode actualType, boolean tryToFindExactType)
Try to get the parameterized type from the cache. |
| public static ClassNode | |
| public static boolean | hasNonPlaceHolders(final ClassNode type)
Checks if the type has any non-placeholder (aka resolved) generics. |
| public static boolean | hasPlaceHolders(final ClassNode type)
Checks if the type has any placeholder (aka unresolved) generics. |
| public static boolean | |
| public static ClassNode | |
| public static ClassNode | |
| public static ClassNode | |
| public static ClassNode | |
| public static Map | makeDeclaringAndActualGenericsTypeMap(final ClassNode declaringClass, final ClassNode actualReceiver)
map declaring generics type to actual generics type, e.g. GROOVY-7204: declaring generics types: T, S extends Serializable actual generics types : String, Long the result map is [ T: String, S: Long ] The resolved types can not help us to choose methods correctly if the argument is a string: T: Object, S: Serializable so we need actual types: T: String, S: Long |
| public static Map | Returns: the placeholder-to-actualtype mappingthe generics class node declaring the generics types declaringClass, final ClassNode the subclass class node actualReceiver)The method is similar with |
| public static ClassNode | |
| public static ClassNode | |
| public static ClassNode | Returns: a parameterized interface class nodethe class node where generics types are parameterized hint, final ClassNode the interface we want to parameterize generics types target)
Deprecated
Use #parameterizeType instead
Interface class nodes retrieved from org.
or org. are returned with generic type
arguments.
|
| public static Tuple2 | parameterizeSAM(final ClassNode
the class node which contains only one abstract method samType)Gets the parameter and return types of the abstract method of SAM. |
| public static ClassNode | Returns: a parameterized interface ClassNodethe ClassNode where generics types are parameterized hint, final ClassNode the interface we want to parameterize generics types target)Interface class nodes retrieved from |
| public static ClassNode[] | parseClassNodesFromString(final String option, final SourceUnit sourceUnit, final CompilationUnit compilationUnit, final MethodNode mn, final ASTNode usage)
|
| private static ClassNode | resolveClassNode(final SourceUnit sourceUnit, final CompilationUnit compilationUnit, final MethodNode mn, final ASTNode usage, final ClassNode parsedNode)
|
| public static String |
| EMPTY_GENERICS_ARRAY | back to summary |
|---|---|
| public static final GenericsType[] EMPTY_GENERICS_ARRAY | |
| JAVA_LANG_OBJECT | back to summary |
|---|---|
| public static final String JAVA_LANG_OBJECT | |
| PARAMETERIZED_TYPE_CACHE | back to summary |
|---|---|
| private static final EvictableCache<GenericsUtils. | |
| PARAMETERIZED_TYPE_CACHE_ENABLED | back to summary |
|---|---|
| private static final boolean PARAMETERIZED_TYPE_CACHE_ENABLED | |
| GenericsUtils | back to summary |
|---|---|
| public GenericsUtils() | |
| addMethodGenerics | back to summary |
|---|---|
| public static Map | |
| alignGenericTypes | back to summary |
|---|---|
| public static GenericsType[] alignGenericTypes(final GenericsType[] redirectGenericTypes, final GenericsType[] parameterizedTypes, final GenericsType[] alignmentTarget)
Deprecated You shouldn't call this method because it is inherently unreliable Given a parameterized type and a generic type information, aligns actual type parameters. For example, if a class uses generic type <T,U,V>(redirectGenericTypes), is used with actual type parameters <java.lang.String, U,V>, then a class or interface using generic types <T,V>will be aligned to <java.lang.String,V>
| |
| applyGenericsContextToPlaceHolders | back to summary |
|---|---|
| public static GenericsType[] applyGenericsContextToPlaceHolders(Map<String, ClassNode> genericsSpec, GenericsType[] oldPlaceHolders) Transforms generics types from an old context to a new context using the given spec. This method assumes all generics types will be placeholders. Warning The resulting generics types may or may not be placeholders after the transformation.
| |
| buildWildcardType | back to summary |
|---|---|
| public static GenericsType buildWildcardType(final ClassNode... upperBounds) Generates a wildcard generic type in order to be used for checks against
class nodes. See | |
| checkPlaceHolders | back to summary |
|---|---|
| private static boolean checkPlaceHolders(final ClassNode type, final Predicate<GenericsType> p) | |
| clearParameterizedTypeCache | back to summary |
|---|---|
| public static void clearParameterizedTypeCache() Clears the parameterized type cache. It is useful to IDE as the type being compiled are continuously being edited/altered, see GROOVY-8675 | |
| correctToGenericsSpec | back to summary |
|---|---|
| public static MethodNode correctToGenericsSpec(Map<String, ClassNode> genericsSpec, MethodNode mn) | |
| correctToGenericsSpec | back to summary |
|---|---|
| public static ClassNode correctToGenericsSpec(Map<String, ClassNode> genericsSpec, GenericsType type) | |
| correctToGenericsSpec | back to summary |
|---|---|
| public static ClassNode correctToGenericsSpec(Map<String, ClassNode> genericsSpec, ClassNode type) | |
| correctToGenericsSpecRecurse | back to summary |
|---|---|
| public static ClassNode correctToGenericsSpecRecurse(Map<String, ClassNode> genericsSpec, ClassNode type) | |
| correctToGenericsSpecRecurse | back to summary |
|---|---|
public static ClassNode[] correctToGenericsSpecRecurse(Map<String, ClassNode> genericsSpec, ClassNode[] types)
| |
| correctToGenericsSpecRecurse | back to summary |
|---|---|
| public static ClassNode correctToGenericsSpecRecurse(Map<String, ClassNode> genericsSpec, ClassNode type, List<String> exclusions) | |
| correlateTypeParametersAndTypeArguments | back to summary |
|---|---|
| private static Map | |
| createGenericsSpec | back to summary |
|---|---|
| public static Map | |
| createGenericsSpec | back to summary |
|---|---|
| public static Map | |
| erasure | back to summary |
|---|---|
| private static GenericsType erasure(GenericsType gt) | |
| extractPlaceholders | back to summary |
|---|---|
| public static Map Returns the type parameter/argument relationships of the specified type.
| |
| extractPlaceholders | back to summary |
|---|---|
| public static void extractPlaceholders(final ClassNode type, final Map<GenericsType. Populates the supplied map with the type parameter/argument relationships of the specified type.
| |
| extractSuperClassGenerics | back to summary |
|---|---|
| public static void extractSuperClassGenerics(final ClassNode type, final ClassNode target, final Map<String, ClassNode> spec) | |
| extractSuperClassGenerics | back to summary |
|---|---|
| private static void extractSuperClassGenerics(final GenericsType[] usage, final GenericsType[] declaration, final Map<String, ClassNode> spec) | |
| extractSuperClassGenerics | back to summary |
|---|---|
| private static void extractSuperClassGenerics(ClassNode[] usage, ClassNode[] declaration, Map<String, ClassNode> spec) | |
| findActualTypeByGenericsPlaceholderName | back to summary |
|---|---|
| public static ClassNode findActualTypeByGenericsPlaceholderName(final String placeholderName, final Map<GenericsType, GenericsType> genericsPlaceholderAndTypeMap) Gets the actual type according to the placeholder name.
| |
| findParameterizedType | back to summary |
|---|---|
| public static ClassNode findParameterizedType(final ClassNode genericsClass, final ClassNode actualType) Convenience method for | |
| findParameterizedType | back to summary |
|---|---|
| public static ClassNode findParameterizedType(final ClassNode genericsClass, final ClassNode actualType, final boolean tryToFindExactType) Gets the parameterized type by searching the whole class hierarchy according to generics class and actual receiver.
| |
| findParameterizedTypeFromCache | back to summary |
|---|---|
| public static ClassNode findParameterizedTypeFromCache(final ClassNode genericsClass, final ClassNode actualType) Convenience method for | |
| findParameterizedTypeFromCache | back to summary |
|---|---|
| public static ClassNode findParameterizedTypeFromCache(final ClassNode genericsClass, final ClassNode actualType, boolean tryToFindExactType) Try to get the parameterized type from the cache.
If no cached item found, cache and return the result of | |
| getSuperClass | back to summary |
|---|---|
| public static ClassNode getSuperClass(final ClassNode type, final ClassNode target) | |
| hasNonPlaceHolders | back to summary |
|---|---|
| public static boolean hasNonPlaceHolders(final ClassNode type) Checks if the type has any non-placeholder (aka resolved) generics.
| |
| hasPlaceHolders | back to summary |
|---|---|
| public static boolean hasPlaceHolders(final ClassNode type) Checks if the type has any placeholder (aka unresolved) generics.
| |
| hasUnresolvedGenerics | back to summary |
|---|---|
| public static boolean hasUnresolvedGenerics(final ClassNode type) Checks for any placeholder (aka unresolved) generics. | |
| makeClassSafe | back to summary |
|---|---|
| public static ClassNode makeClassSafe(Class<T> klass) | |
| makeClassSafe0 | back to summary |
|---|---|
| public static ClassNode makeClassSafe0(ClassNode type, GenericsType... genericTypes) | |
| makeClassSafeWithGenerics | back to summary |
|---|---|
| public static ClassNode makeClassSafeWithGenerics(Class<T> klass, ClassNode genericsType) | |
| makeClassSafeWithGenerics | back to summary |
|---|---|
| public static ClassNode makeClassSafeWithGenerics(ClassNode type, GenericsType... genericTypes) | |
| makeDeclaringAndActualGenericsTypeMap | back to summary |
|---|---|
| public static Map map declaring generics type to actual generics type, e.g. GROOVY-7204: declaring generics types: T, S extends Serializable actual generics types : String, Long the result map is [ T: String, S: Long ] The resolved types can not help us to choose methods correctly if the argument is a string: T: Object, S: Serializable so we need actual types: T: String, S: Long | |
| makeDeclaringAndActualGenericsTypeMapOfExactType | back to summary |
|---|---|
| public static Map The method is similar with
| |
| newClass | back to summary |
|---|---|
| public static ClassNode newClass(ClassNode type) | |
| nonGeneric | back to summary |
|---|---|
| public static ClassNode nonGeneric(final ClassNode type) | |
| parameterizeInterfaceGenerics | back to summary |
|---|---|
| public static ClassNode parameterizeInterfaceGenerics(final ClassNode hint, final ClassNode target)
Deprecated Use #parameterizeType instead Interface class nodes retrieved from
| |
| parameterizeSAM | back to summary |
|---|---|
| public static Tuple2 Gets the parameter and return types of the abstract method of SAM.
If the abstract method is not parameterized, we will get generics placeholders, e.g. T, U
For example, the abstract method of
R apply(T t);
We parameterize the above interface as Function<String, Integer>, then the abstract method will be
Integer apply(String t);
When we call parameterizeSAM on the ClassNode Function<String, Integer>,
we can get parameter types and return type of the above abstract method,
i.e. ClassNode ClassHelper.STRING_TYPE and ClassHelper.Integer_TYPE
| |
| parameterizeType | back to summary |
|---|---|
| public static ClassNode parameterizeType(ClassNode hint, final ClassNode target) Interface class nodes retrieved from | |
| parseClassNodesFromString | back to summary |
|---|---|
| public static ClassNode[] parseClassNodesFromString(final String option, final SourceUnit sourceUnit, final CompilationUnit compilationUnit, final MethodNode mn, final ASTNode usage) | |
| resolveClassNode | back to summary |
|---|---|
| private static ClassNode resolveClassNode(final SourceUnit sourceUnit, final CompilationUnit compilationUnit, final MethodNode mn, final ASTNode usage, final ClassNode parsedNode) | |
| toGenericTypesString | back to summary |
|---|---|
| public static String toGenericTypesString(GenericsType[] genericsTypes) | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| public ClassNode | |
| public ClassNode | |
| public int | |
| public void | |
| public void |
| actualType | back to summary |
|---|---|
| private ClassNode actualType | |
| genericsClass | back to summary |
|---|---|
| private ClassNode genericsClass | |
| ParameterizedTypeCacheKey | back to summary |
|---|---|
| public ParameterizedTypeCacheKey(ClassNode genericsClass, ClassNode actualType) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getActualType | back to summary |
|---|---|
| public ClassNode getActualType() | |
| getGenericsClass | back to summary |
|---|---|
| public ClassNode getGenericsClass() | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| setActualType | back to summary |
|---|---|
public void setActualType(ClassNode actualType)
| |
| setGenericsClass | back to summary |
|---|---|
public void setGenericsClass(ClassNode genericsClass)
| |