public final class ImmutableTypes
extends Object
The types and marker annotations Groovy treats as immutable, shared by the
@Immutable family of transforms and by the runtime (GROOVY-12390).
Lives outside the AST packages on purpose: GStringImpl consults it
for every GString with a non-trivial value, and reaching it through the
transform utilities would initialise the compiler's ClassHelper,
with its reflective model of the JDK types, in an application that never
compiles anything. Internal to the runtime, not a public API.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static boolean |
builtinOrMarkedImmutableClass(Class<?> clazz)Whether a class is built in as immutable or carries an immutable marker annotation. |
|
public static boolean |
hasImmutableAnnotation(Class<?> clazz)Whether a class carries a recognised immutable marker annotation. |
|
public static boolean |
isBuiltinImmutable(String typeName)Whether a type name is one of the JDK types Groovy treats as immutable. |
|
public static boolean |
isImmutableMarker(String annotationName)Whether an annotation name marks its target as immutable. |
Whether a class is built in as immutable or carries an immutable marker annotation.
clazz - the class to inspecttrue when the class is considered immutableWhether a class carries a recognised immutable marker annotation.
clazz - the class to inspecttrue when a marker is presentWhether a type name is one of the JDK types Groovy treats as immutable.
typeName - the fully qualified type nametrue for a built-in immutable typeWhether an annotation name marks its target as immutable.
annotationName - the fully qualified annotation type nametrue for a recognised immutable marker