Package org.apache.groovy.ast.tools
Class TypeUseUtils
java.lang.Object
org.apache.groovy.ast.tools.TypeUseUtils
Classification of a
ClassNode as a type use (JLS 4.5, 4.7,
4.8). Distinct from a generic class declaration, whose
ClassNode.getGenericsTypes() are the formals.- Since:
- 6.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringdescribeTypeUse(ClassNode type) Source-like display of a type use, including rare enclosing arguments (Outer<String>.Inner) and array brackets.static booleanTrue when a type argument oftypeor an enclosing rare type is a wildcard.static booleanTrue whentypecarries type arguments, including wildcards (Outer<?>).static booleanTrue whentypeis a parameterized usage (Cell<String>), as opposed to the generic type name (Cell) or the class declaration node (whoseClassNode.getGenericsTypes()are the formals).static booleanTrue whentypeor any enclosing rare type is a parameterized usage.static booleanisRawGenericType(ClassNode type) True whentypeis a raw use of a generic declaration (Outerforclass Outer<T>).static booleanisReifiable(ClassNode type) JLS 4.7: types available in full at run time.static booleanisStaticMemberType(ClassNode type) Nested interfaces and enums are implicitly static; otherwise theACC_STATICbit on the declaration is authoritative.
-
Method Details
-
isParameterizedTypeUsage
True whentypeis a parameterized usage (Cell<String>), as opposed to the generic type name (Cell) or the class declaration node (whoseClassNode.getGenericsTypes()are the formals). -
isParameterizedTypeUsageIncludingEnclosing
True whentypeor any enclosing rare type is a parameterized usage. Used for class literals (JLS 15.8.2):Outer<String>.Inner.class. Declaration formals onMapmust not makeMap.Entrya class-literal error. -
isParameterizedEnclosingType
True whentypecarries type arguments, including wildcards (Outer<?>). Raw names (Outer) are not parameterized. UnlikeisParameterizedTypeUsage(ClassNode), this does not require a redirect node: an enclosing type on a nested use may still be the parser's unresolved node. -
isRawGenericType
True whentypeis a raw use of a generic declaration (Outerforclass Outer<T>). -
isReifiable
JLS 4.7: types available in full at run time. Used for array creation (JLS 15.10.1) andinstanceof(JLS 15.20.2). -
isStaticMemberType
Nested interfaces and enums are implicitly static; otherwise theACC_STATICbit on the declaration is authoritative. -
hasWildcardTypeArgument
True when a type argument oftypeor an enclosing rare type is a wildcard. -
describeTypeUse
Source-like display of a type use, including rare enclosing arguments (Outer<String>.Inner) and array brackets.
-