Package org.codehaus.groovy.runtime
Class IntersectionCastSupport
java.lang.Object
org.codehaus.groovy.runtime.IntersectionCastSupport
Runtime support for intersection-type cast and
as coercion
(GROOVY-11998). Compiler-generated bytecode for (A & B) value and
value as (A & B) routes through these helpers when the target is
an intersection type and the source is not a native lambda or method
reference (those cases are handled at compile time via
LambdaMetafactory.altMetafactory markers).- Since:
- 6.0.0
-
Method Details
-
castTo
Strict cast: every component must already be assignment-compatible with the source's runtime class. ThrowsGroovyCastExceptionotherwise. -
asType
Coercion: produce an object that satisfies every component. ForClosureandMapsources, a multi-interface proxy is built viaProxyGenerator. For other sources, falls back tocastTo(java.lang.Object, java.lang.Class<?>[])so the behaviour is at least as strict as a cast.
-