Class ScriptBytecodeAdapter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertFailed(Object expression, Object message) Signals a failed assertion by callingInvokerHelper.assertFailed.static ObjectProvides a hook for type coercion of the given object to the required typestatic ObjectbitwiseNegate(Object value) Returns the bitwise negation ofvaluefromInvokerHelper.bitwiseNegate.static ObjectcastToType(Object object, Class type) Provides a hook for type casting of the given object to the required typestatic booleancompareEqual(Object left, Object right) Comparesleftandrightfor equality.static booleancompareGreaterThan(Object left, Object right) Reports whetherleftis greater thanright.static booleancompareGreaterThanEqual(Object left, Object right) Reports whetherleftis greater than or equal toright.static booleancompareIdentical(Object left, Object right) Reports whetherleftandrightare the same reference, usingleft == right.static booleancompareLessThan(Object left, Object right) Reports whetherleftis less thanright.static booleancompareLessThanEqual(Object left, Object right) Reports whetherleftis less than or equal toright.static booleancompareNotEqual(Object left, Object right) Returns the negation ofcompareEqual(Object, Object).static booleancompareNotIdentical(Object left, Object right) Reports whetherleftandrightare different references, usingleft != right.static IntegerComparesleftwithrightand returns a boxed-1,0, or1.static ObjectcompoundAssign(Object receiver, Object arg, String assignName, String baseName) GEP-15: dispatcher for compound-assignment operators in dynamic Groovy.static WrappercreateGroovyObjectWrapper(GroovyObject val, Class clazz) static ListcreateList(Object[] values) static Mapstatic WrappercreatePojoWrapper(Object val, Class clazz) Wraps a plain value in aPojoWrapperconstrained toclazz.static ListcreateRange(Object from, Object to, boolean inclusive) Builds a range fromfromtotowithfromincluded.static ListcreateRange(Object from, Object to, boolean exclusiveLeft, boolean exclusiveRight) Builds a range fromfromtoto, honoring exclusive ends.static TuplecreateTuple(Object[] array) Returns aTupleconstructed from the elements ofarray.static Object[]despreadList(Object[] args, Object[] spreads, int[] positions) Spreads selected argument values into one flat argument array.static Matcherstatic ObjectReads the field namedmessageNameby callingInvokerHelper.getAttribute.static ObjectgetFieldOnSuper(Class senderClass, Object receiver, String messageName) Reads the field namedmessageName, using the super-class attribute unlessreceiveris aClass.static ObjectgetFieldOnSuperSafe(Class senderClass, Object receiver, String messageName) Forwards togetFieldOnSuper(java.lang.Class, java.lang.Object, java.lang.String)with the same arguments.static ObjectgetFieldOnSuperSpreadSafe(Class senderClass, Object receiver, String messageName) Reads the field namedmessageNamefrom each element ofreceiver.static ObjectgetFieldSafe(Class senderClass, Object receiver, String messageName) Reads the field namedmessageName, returning null whenreceiveris null.static ObjectgetFieldSpreadSafe(Class senderClass, Object receiver, String messageName) Reads the field namedmessageNamefrom each element ofreceiver.static ObjectgetGroovyObjectField(Class senderClass, GroovyObject receiver, String messageName) Reads the field namedmessageNamefrom aGroovyObjectthrough its metaclass.static ObjectgetGroovyObjectFieldSafe(Class senderClass, GroovyObject receiver, String messageName) Reads the field namedmessageName, returning null whenreceiveris null.static ObjectgetGroovyObjectFieldSpreadSafe(Class senderClass, GroovyObject receiver, String messageName) Reads the field namedmessageNamefrom each element ofreceiver.static ObjectgetGroovyObjectProperty(Class senderClass, GroovyObject receiver, String messageName) ReadsmessageNamefrom aGroovyObject, falling back to the metaclass for a superclass sender.static ObjectgetGroovyObjectPropertySafe(Class senderClass, GroovyObject receiver, String messageName) ReadsmessageName, returning null whenreceiveris null.static ObjectgetGroovyObjectPropertySpreadSafe(Class senderClass, GroovyObject receiver, String messageName) Reads the property namedmessageNamefrom each element ofreceiver.static ClosuregetMethodPointer(Object object, String methodName) Returns a method closure for the given object and name.static ObjectgetProperty(Class senderClass, Object receiver, String messageName) Reads the property namedmessageNamefromreceiver.static ObjectgetPropertyOnSuper(Class senderClass, GroovyObject receiver, String messageName) Reads the property namedmessageNamefrom the super class of aGroovyObject.static ObjectgetPropertyOnSuperSafe(Class senderClass, GroovyObject receiver, String messageName) Forwards togetPropertyOnSuper(java.lang.Class, groovy.lang.GroovyObject, java.lang.String)with the same arguments.static ObjectgetPropertyOnSuperSpreadSafe(Class senderClass, GroovyObject receiver, String messageName) Reads the property namedmessageNamefrom each element ofreceiver.static ObjectgetPropertySafe(Class senderClass, Object receiver, String messageName) Reads the property namedmessageName, returning null whenreceiveris null.static ObjectgetPropertySpreadSafe(Class senderClass, Object receiver, String messageName) Reads the property namedmessageNamefrom each element ofreceiver.static MetaClassinitMetaClass(Object object) Returns theMetaClassregistered for the class ofobject.static ObjectinvokeClosure(Object closure, Object[] arguments) Invokescallonclosure.static ObjectinvokeMethod0(Class senderClass, Object receiver, String messageName) InvokesmessageNamewith no arguments.static ObjectinvokeMethod0Safe(Class senderClass, Object receiver, String messageName) InvokesmessageNamewith no arguments, returning null whenreceiveris null.static ObjectinvokeMethod0SpreadSafe(Class senderClass, Object receiver, String messageName) Spread-invokesmessageNamewith no arguments.static ObjectinvokeMethodN(Class senderClass, Object receiver, String messageName, Object[] messageArguments) InvokesmessageNameonreceiverby callingInvokerHelper.invokeMethod.static ObjectinvokeMethodNSafe(Class senderClass, Object receiver, String messageName, Object[] messageArguments) InvokesmessageNameonreceiver, returning null whenreceiveris null.static ObjectinvokeMethodNSpreadSafe(Class senderClass, Object receiver, String messageName, Object[] messageArguments) InvokesmessageNameon each element ofreceiverand returns the results.static ObjectinvokeMethodOnCurrent0(Class senderClass, GroovyObject receiver, String messageName) InvokesmessageNamewith no arguments.static ObjectinvokeMethodOnCurrent0Safe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) InvokesmessageNamewith no arguments.static ObjectinvokeMethodOnCurrent0SpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) Spread-invokesmessageNamewith no arguments.static ObjectinvokeMethodOnCurrentN(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) InvokesmessageNameon aGroovyObjectfrom inside the receiver.static ObjectinvokeMethodOnCurrentNSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) Forwards toinvokeMethodOnCurrentN(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[])with the same arguments.static ObjectinvokeMethodOnCurrentNSpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) InvokesmessageNameon each element ofreceiverand returns the results.static ObjectinvokeMethodOnSuper0(Class senderClass, GroovyObject receiver, String messageName) InvokesmessageNameon the super class with no arguments.static ObjectinvokeMethodOnSuper0Safe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) InvokesmessageNameon the super class with no arguments.static ObjectinvokeMethodOnSuper0SpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) Spread-invokesmessageNamewith no arguments.static ObjectinvokeMethodOnSuperN(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) InvokesmessageNameon the super class of aGroovyObject.static ObjectinvokeMethodOnSuperNSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) Forwards toinvokeMethodOnSuperN(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[])with the same arguments.static ObjectinvokeMethodOnSuperNSpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) InvokesmessageNameon each element ofreceiverand returns the results.static ObjectinvokeNew0(Class senderClass, Class receiver) Constructs an instance ofreceiverwith no arguments.static ObjectinvokeNewN(Class senderClass, Class receiver, Object arguments) Constructs an instance ofreceiverby callingInvokerHelper.invokeConstructorOf.static ObjectinvokeStaticMethod0(Class senderClass, Class receiver, String messageName) Invokes the static methodmessageNamewith no arguments.static ObjectinvokeStaticMethodN(Class senderClass, Class receiver, String messageName, Object[] messageArguments) Invokes the static methodmessageNameonreceiverby callingInvokerHelper.invokeStaticMethod.static booleanTests whethercaseExpressionmatchesswitchValueby callingisCase.static booleanTests whetherswitchValueis a member ofcaseExpression.static booleanReturns the negation ofisCase(Object, Object).static booleanReturns the negation ofisIn(Object, Object).static booleanmatchRegex(Object left, Object right) Reports whetherleftmatches the whole regular expressionright, by callingInvokerHelper.matchRegex.static Closure<?>packedClosure(Object owner, Object dispatchers, int id, String method, Object[] captured, Class[] paramTypes, boolean strict, boolean implicit, boolean vararg) GROOVY-12151: the bytecode-facing factory for the shared packed-closure adapter.static Closure<?>packedClosure(Object owner, Object dispatchers, int id, String method, Object[] captured, Class[] paramTypes, boolean strict, boolean implicit, boolean vararg, boolean usesReceiver) The packed-closure factory the compiler emits: aspackedClosure(Object, Object, int, String, Object[], Class[], boolean, boolean, boolean), which stays for class files compiled before it, plus whether the hoisted body uses its receiver, sorehydratehands the copy's body a new this object wherever a@CompileStaticclosure class would use it.static PatternregexPattern(Object regex) Compilesregexinto aPattern.static intselectConstructorAndTransformArguments(Object[] arguments, int numberOfConstructors, Class which) Selects a constructor ofwhichand transformsarguments.static voidWrites the field namedmessageNameby callingInvokerHelper.setAttribute.static voidsetFieldOnSuper(Object messageArgument, Class senderClass, Object receiver, String messageName) Writes the field namedmessageName, using the super-class attribute unlessreceiveris aClass.static voidsetFieldOnSuperSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) Forwards tosetFieldOnSuper(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String)with the same arguments.static voidsetFieldOnSuperSpreadSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) Writes the field namedmessageNameon each element ofreceiver.static voidsetFieldSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) Writes the field namedmessageName, doing nothing whenreceiveris null.static voidsetFieldSpreadSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) Writes the field namedmessageNameon each element ofreceiver.static voidsetGroovyObjectField(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) Writes the field namedmessageNameon aGroovyObjectthrough its metaclass.static voidsetGroovyObjectFieldSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) Writes the field namedmessageName, doing nothing whenreceiveris null.static voidsetGroovyObjectFieldSpreadSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) Writes the field namedmessageNameon each element ofreceiver.static voidsetGroovyObjectProperty(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) WritesmessageNameon aGroovyObject, using the object's own setter when the sender requires it.static voidsetGroovyObjectPropertySafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) WritesmessageNameonreceiver, doing nothing whenreceiveris null.static voidsetGroovyObjectPropertySpreadSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) Writes the property namedmessageNameon each element ofreceiver.static voidsetProperty(Object messageArgument, Class senderClass, Object receiver, String messageName) WritesmessageArgumentto the property namedmessageName.static voidsetPropertyOnSuper(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) Writes the property namedmessageNameon the super class of aGroovyObject.static voidsetPropertyOnSuperSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) Forwards tosetPropertyOnSuper(java.lang.Object, java.lang.Class, groovy.lang.GroovyObject, java.lang.String)with the same arguments.static voidsetPropertyOnSuperSpreadSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) Writes the property namedmessageNameon each element ofreceiver.static voidsetPropertySafe(Object messageArgument, Class senderClass, Object receiver, String messageName) Writes the property namedmessageName, doing nothing whenreceiveris null.static voidsetPropertySpreadSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) Writes the property namedmessageNameon each element ofreceiver.static ObjectSpreadsvalueas a map by callingInvokerHelper.spreadMap.static ObjectunaryMinus(Object value) Returns the negation ofvaluefromInvokerHelper.unaryMinus.static ObjectReturns the unary plus ofvaluefromInvokerHelper.unaryPlus.static ThrowableUnwraps a GroovyRuntimeException, extracting the actual cause if present.
-
Field Details
-
EMPTY_ARGS
An empty Object array constant.
-
-
Constructor Details
-
ScriptBytecodeAdapter
public ScriptBytecodeAdapter()
-
-
Method Details
-
unwrap
Unwraps a GroovyRuntimeException, extracting the actual cause if present. Converts GroovyRuntimeException instances that wrap actual exceptions to those exceptions.- Parameters:
gre- the GroovyRuntimeException to unwrap- Returns:
- the unwrapped Throwable
-
invokeMethodOnCurrentN
public static Object invokeMethodOnCurrentN(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable InvokesmessageNameon aGroovyObjectfrom inside the receiver.A
GroovyInterceptablereceiver is dispatched withGroovyObject.invokeMethod(String, Object). Any other receiver is dispatched through its metaclassMetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean), withisCallToSuperfalse andfromInsideClasstrue.A
MissingMethodExecutionFailedis rethrown as itsMissingMethodExceptioncause and then unwrapped. Any otherMissingMethodExceptionwhose type is the receiver's class and whose method name equalsmessageNamefalls back toGroovyObject.invokeMethod(String, Object)when the receiver is not intercepting. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- the arguments to pass- Returns:
- the value returned by the invocation
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnCurrentNSafe
public static Object invokeMethodOnCurrentNSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable Forwards toinvokeMethodOnCurrentN(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[])with the same arguments. A nullreceiveris passed through on that call.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- the arguments to pass- Returns:
- the value returned by
invokeMethodOnCurrentN(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnCurrentNSpreadSafe
public static Object invokeMethodOnCurrentNSpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable InvokesmessageNameon each element ofreceiverand returns the results.InvokerHelper.asIteratorwalksreceiverwith no null test. Each element is invoked withinvokeMethodNSafe(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[]), so a null element contributes null, and the results are collected into aList.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- the arguments to pass- Returns:
- a
Listof per-element results - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnCurrent0
public static Object invokeMethodOnCurrent0(Class senderClass, GroovyObject receiver, String messageName) throws Throwable InvokesmessageNamewith no arguments. The call isinvokeMethodOnCurrentN(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[])withEMPTY_ARGS.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method name- Returns:
- the value returned by
invokeMethodOnCurrentN(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnCurrent0Safe
public static Object invokeMethodOnCurrent0Safe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable InvokesmessageNamewith no arguments.messageArgumentsis ignored andEMPTY_ARGSis passed toinvokeMethodOnCurrentNSafe(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]).- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- ignored;EMPTY_ARGSis passed instead- Returns:
- the value returned by
invokeMethodOnCurrentNSafe(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnCurrent0SpreadSafe
public static Object invokeMethodOnCurrent0SpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable Spread-invokesmessageNamewith no arguments.messageArgumentsis ignored andEMPTY_ARGSis passed toinvokeMethodOnCurrentNSpreadSafe(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]).- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- ignored;EMPTY_ARGSis passed instead- Returns:
- the
Listreturned byinvokeMethodOnCurrentNSpreadSafe(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnSuperN
public static Object invokeMethodOnSuperN(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable InvokesmessageNameon the super class of aGroovyObject.The receiver's metaclass is called directly, with no
GroovyInterceptabledispatch and no missing-method fallback.MetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean)is passedisCallToSupertrue andfromInsideClasstrue. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- the arguments to pass- Returns:
- the value returned by the super call
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnSuperNSafe
public static Object invokeMethodOnSuperNSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable Forwards toinvokeMethodOnSuperN(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[])with the same arguments. A nullreceiveris passed through on that call.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- the arguments to pass- Returns:
- the value returned by
invokeMethodOnSuperN(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnSuperNSpreadSafe
public static Object invokeMethodOnSuperNSpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable InvokesmessageNameon each element ofreceiverand returns the results.InvokerHelper.asIteratorwalksreceiverwith no null test. Each element is invoked withinvokeMethodNSafe(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[]), so a null element contributes null, and the results are collected into aList.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- the arguments to pass- Returns:
- a
Listof per-element results - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnSuper0
public static Object invokeMethodOnSuper0(Class senderClass, GroovyObject receiver, String messageName) throws Throwable InvokesmessageNameon the super class with no arguments. The call isinvokeMethodOnSuperN(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[])withEMPTY_ARGS.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method name- Returns:
- the value returned by
invokeMethodOnSuperN(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnSuper0Safe
public static Object invokeMethodOnSuper0Safe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable InvokesmessageNameon the super class with no arguments.messageArgumentsis ignored andEMPTY_ARGSis passed toinvokeMethodOnSuperNSafe(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]).- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- ignored;EMPTY_ARGSis passed instead- Returns:
- the value returned by
invokeMethodOnSuperNSafe(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodOnSuper0SpreadSafe
public static Object invokeMethodOnSuper0SpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable Spread-invokesmessageNamewith no arguments.messageArgumentsis ignored andEMPTY_ARGSis passed toinvokeMethodOnSuperNSpreadSafe(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]).- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- ignored;EMPTY_ARGSis passed instead- Returns:
- the
Listreturned byinvokeMethodOnSuperNSpreadSafe(java.lang.Class, groovy.lang.GroovyObject, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodN
public static Object invokeMethodN(Class senderClass, Object receiver, String messageName, Object[] messageArguments) throws Throwable InvokesmessageNameonreceiverby callingInvokerHelper.invokeMethod. The helper replaces a null receiver withNullObject. A receiver that is aClassis dispatched as a static call. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- the arguments to pass- Returns:
- the value returned by
InvokerHelper.invokeMethod - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodNSafe
public static Object invokeMethodNSafe(Class senderClass, Object receiver, String messageName, Object[] messageArguments) throws Throwable InvokesmessageNameonreceiver, returning null whenreceiveris null. A non-null receiver is forwarded toinvokeMethodN(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[]).- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- the arguments to pass- Returns:
- null when
receiveris null; otherwise the result ofinvokeMethodN(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethodNSpreadSafe
public static Object invokeMethodNSpreadSafe(Class senderClass, Object receiver, String messageName, Object[] messageArguments) throws Throwable InvokesmessageNameon each element ofreceiverand returns the results. A null receiver returns null. OtherwiseInvokerHelper.asIteratorwalks the receiver, each element is invoked withinvokeMethodNSafe(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[]), and the results are collected into aList.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method namemessageArguments- the arguments to pass- Returns:
- null when
receiveris null; otherwise aListof per-element results - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethod0
public static Object invokeMethod0(Class senderClass, Object receiver, String messageName) throws Throwable InvokesmessageNamewith no arguments. The call isinvokeMethodN(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[])withEMPTY_ARGS.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method name- Returns:
- the value returned by
invokeMethodN(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethod0Safe
public static Object invokeMethod0Safe(Class senderClass, Object receiver, String messageName) throws Throwable InvokesmessageNamewith no arguments, returning null whenreceiveris null. A non-null receiver is forwarded toinvokeMethodNSafe(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[])withEMPTY_ARGS.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method name- Returns:
- null when
receiveris null; otherwise the result ofinvokeMethodNSafe(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeMethod0SpreadSafe
public static Object invokeMethod0SpreadSafe(Class senderClass, Object receiver, String messageName) throws Throwable Spread-invokesmessageNamewith no arguments. The call isinvokeMethodNSpreadSafe(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[])withEMPTY_ARGS.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the method name- Returns:
- the value returned by
invokeMethodNSpreadSafe(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeStaticMethodN
public static Object invokeStaticMethodN(Class senderClass, Class receiver, String messageName, Object[] messageArguments) throws Throwable Invokes the static methodmessageNameonreceiverby callingInvokerHelper.invokeStaticMethod. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the class that holds the static methodmessageName- the method namemessageArguments- the arguments to pass- Returns:
- the value returned by the static call
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeStaticMethod0
public static Object invokeStaticMethod0(Class senderClass, Class receiver, String messageName) throws Throwable Invokes the static methodmessageNamewith no arguments. The call isinvokeStaticMethodN(java.lang.Class, java.lang.Class, java.lang.String, java.lang.Object[])withEMPTY_ARGS.- Parameters:
senderClass- the class that originated the callreceiver- the class that holds the static methodmessageName- the method name- Returns:
- the value returned by
invokeStaticMethodN(java.lang.Class, java.lang.Class, java.lang.String, java.lang.Object[]) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeNewN
public static Object invokeNewN(Class senderClass, Class receiver, Object arguments) throws Throwable Constructs an instance ofreceiverby callingInvokerHelper.invokeConstructorOf. The helper treats a nullargumentsvalue as no arguments, passes an object array through, and wraps any other object as the sole argument. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the class to instantiatearguments- the constructor arguments, as interpreted byInvokerHelper.invokeConstructorOf- Returns:
- the new instance
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
invokeNew0
Constructs an instance ofreceiverwith no arguments. The call isinvokeNewN(java.lang.Class, java.lang.Class, java.lang.Object)withEMPTY_ARGS.- Parameters:
senderClass- the class that originated the callreceiver- the class to instantiate- Returns:
- the new instance
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
selectConstructorAndTransformArguments
public static int selectConstructorAndTransformArguments(Object[] arguments, int numberOfConstructors, Class which) throws Throwable Selects a constructor ofwhichand transformsarguments. The metaclass isInvokerHelper.getMetaClass(which), andMetaClass.selectConstructorAndTransformArguments(int, Object[])performs the selection. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
arguments- the constructor arguments transformed by the metaclassnumberOfConstructors- the constructor count supplied by the callerwhich- the class whose constructor is selected- Returns:
- the selection result returned by the metaclass
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getFieldOnSuper
public static Object getFieldOnSuper(Class senderClass, Object receiver, String messageName) throws Throwable Reads the field namedmessageName, using the super-class attribute unlessreceiveris aClass.When
receiveris aClass, the read isInvokerHelper.getAttribute. Any other receiver is cast toGroovyObjectand read withMetaClass.getAttribute(Class, Object, String, boolean)passinguseSupertrue. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Returns:
- the field value
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getFieldOnSuperSafe
public static Object getFieldOnSuperSafe(Class senderClass, Object receiver, String messageName) throws Throwable Forwards togetFieldOnSuper(java.lang.Class, java.lang.Object, java.lang.String)with the same arguments. A nullreceiveris passed through on that call.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Returns:
- the value returned by
getFieldOnSuper(java.lang.Class, java.lang.Object, java.lang.String) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getFieldOnSuperSpreadSafe
public static Object getFieldOnSuperSpreadSafe(Class senderClass, Object receiver, String messageName) throws Throwable Reads the field namedmessageNamefrom each element ofreceiver.InvokerHelper.asIteratorwalksreceiverwith no null test. Each element is read withgetFieldOnSuper(java.lang.Class, java.lang.Object, java.lang.String), and the values are collected into aList.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Returns:
- a
Listof per-element field values - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setFieldOnSuper
public static void setFieldOnSuper(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable Writes the field namedmessageName, using the super-class attribute unlessreceiveris aClass.When
receiveris aClass, the write isInvokerHelper.setAttribute. Any other receiver is cast toGroovyObjectand written withMetaClass.setAttribute(Class, Object, String, Object, boolean, boolean), passinguseSupertrue andfromInsideClasstrue. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setFieldOnSuperSafe
public static void setFieldOnSuperSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable Forwards tosetFieldOnSuper(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String)with the same arguments. A nullreceiveris passed through on that call.- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setFieldOnSuperSpreadSafe
public static void setFieldOnSuperSpreadSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable Writes the field namedmessageNameon each element ofreceiver.InvokerHelper.asIteratorwalksreceiverwith no null test, and each element is written withsetFieldOnSuper(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String).- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getField
public static Object getField(Class senderClass, Object receiver, String messageName) throws Throwable Reads the field namedmessageNameby callingInvokerHelper.getAttribute. The helper replaces a null receiver withNullObject. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Returns:
- the field value
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getFieldSafe
public static Object getFieldSafe(Class senderClass, Object receiver, String messageName) throws Throwable Reads the field namedmessageName, returning null whenreceiveris null. A non-null receiver is read withgetField(java.lang.Class, java.lang.Object, java.lang.String).- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Returns:
- null when
receiveris null; otherwise the field value - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getFieldSpreadSafe
public static Object getFieldSpreadSafe(Class senderClass, Object receiver, String messageName) throws Throwable Reads the field namedmessageNamefrom each element ofreceiver. A null receiver returns null. OtherwiseInvokerHelper.asIteratorwalks the receiver, each element is read withgetFieldSafe(java.lang.Class, java.lang.Object, java.lang.String), and the values are collected into aList.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Returns:
- null when
receiveris null; otherwise aListof field values - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setField
public static void setField(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable Writes the field namedmessageNameby callingInvokerHelper.setAttribute. The helper replaces a null receiver withNullObject. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setFieldSafe
public static void setFieldSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable Writes the field namedmessageName, doing nothing whenreceiveris null. A non-null receiver is written withsetField(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String).- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setFieldSpreadSafe
public static void setFieldSpreadSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable Writes the field namedmessageNameon each element ofreceiver. A null receiver returns without writing. OtherwiseInvokerHelper.asIteratorwalks the receiver and each element is written withsetFieldSafe(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String).- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getGroovyObjectField
public static Object getGroovyObjectField(Class senderClass, GroovyObject receiver, String messageName) throws Throwable Reads the field namedmessageNamefrom aGroovyObjectthrough its metaclass.MetaClass.getAttribute(Class, Object, String, boolean)is called withuseSuperfalse. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Returns:
- the field value
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getGroovyObjectFieldSafe
public static Object getGroovyObjectFieldSafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable Reads the field namedmessageName, returning null whenreceiveris null. A non-null receiver is read through its metaclassMetaClass.getAttribute(Class, Object, String, boolean)withuseSuperfalse. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Returns:
- null when
receiveris null; otherwise the field value - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getGroovyObjectFieldSpreadSafe
public static Object getGroovyObjectFieldSpreadSafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable Reads the field namedmessageNamefrom each element ofreceiver. A null receiver returns null. OtherwiseInvokerHelper.asIteratorwalks the receiver, each element is read withgetFieldSafe(java.lang.Class, java.lang.Object, java.lang.String), and the values are collected into aList.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Returns:
- null when
receiveris null; otherwise aListof field values - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setGroovyObjectField
public static void setGroovyObjectField(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable Writes the field namedmessageNameon aGroovyObjectthrough its metaclass.MetaClass.setAttribute(Class, Object, String, Object, boolean, boolean)is called withuseSuperfalse andfromInsideClassfalse. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setGroovyObjectFieldSafe
public static void setGroovyObjectFieldSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable Writes the field namedmessageName, doing nothing whenreceiveris null. A non-null receiver is written with the metaclass methodsetAttribute(Object, String, Object), passing the receiver, the field name, andmessageArgument. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setGroovyObjectFieldSpreadSafe
public static void setGroovyObjectFieldSpreadSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable Writes the field namedmessageNameon each element ofreceiver. A null receiver returns without writing. OtherwiseInvokerHelper.asIteratorwalks the receiver and each element is written withsetFieldSafe(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String).- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the field name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getPropertyOnSuper
public static Object getPropertyOnSuper(Class senderClass, GroovyObject receiver, String messageName) throws Throwable Reads the property namedmessageNamefrom the super class of aGroovyObject. The receiver's metaclassMetaClass.getProperty(Class, Object, String, boolean, boolean)is called withisCallToSupertrue andfromInsideClassfalse. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Returns:
- the property value
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getPropertyOnSuperSafe
public static Object getPropertyOnSuperSafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable Forwards togetPropertyOnSuper(java.lang.Class, groovy.lang.GroovyObject, java.lang.String)with the same arguments. A nullreceiveris passed through on that call.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Returns:
- the value returned by
getPropertyOnSuper(java.lang.Class, groovy.lang.GroovyObject, java.lang.String) - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getPropertyOnSuperSpreadSafe
public static Object getPropertyOnSuperSpreadSafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable Reads the property namedmessageNamefrom each element ofreceiver.InvokerHelper.asIteratorwalksreceiverwith no null test. Each element is read withgetPropertySafe(java.lang.Class, java.lang.Object, java.lang.String), and the values are collected into aList.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Returns:
- a
Listof per-element property values - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setPropertyOnSuper
public static void setPropertyOnSuper(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable Writes the property namedmessageNameon the super class of aGroovyObject. The receiver's metaclassMetaClass.setProperty(Class, Object, String, Object, boolean, boolean)is called withisCallToSupertrue andfromInsideClassfalse. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setPropertyOnSuperSafe
public static void setPropertyOnSuperSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable Forwards tosetPropertyOnSuper(java.lang.Object, java.lang.Class, groovy.lang.GroovyObject, java.lang.String)with the same arguments. A nullreceiveris passed through on that call.- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setPropertyOnSuperSpreadSafe
public static void setPropertyOnSuperSpreadSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable Writes the property namedmessageNameon each element ofreceiver.InvokerHelper.asIteratorwalksreceiverwith no null test, and each element is written withsetPropertySafe(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String).- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getProperty
public static Object getProperty(Class senderClass, Object receiver, String messageName) throws Throwable Reads the property namedmessageNamefromreceiver.A null receiver is read from
NullObject.getNullObject(). AGroovyObjectis read withGroovyObject.getProperty(String)whensenderClassis null orGroovyObjectOverrides.overridesGetProperty(Class)is true for the receiver's class. That test is true for agetPropertyother than theGroovyObjectdefault, including a synthetic or@Internalimplementation, and when the method cannot be inspected. Every other receiver is read through the metaclass fromInvokerHelper.getMetaClass, callingMetaClass.getProperty(Class, Object, String, boolean, boolean)withisCallToSuperfalse andfromInsideClassfalse. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Returns:
- the property value
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getPropertySafe
public static Object getPropertySafe(Class senderClass, Object receiver, String messageName) throws Throwable Reads the property namedmessageName, returning null whenreceiveris null. A non-null receiver is read withgetProperty(java.lang.Class, java.lang.Object, java.lang.String).- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Returns:
- null when
receiveris null; otherwise the property value - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getPropertySpreadSafe
public static Object getPropertySpreadSafe(Class senderClass, Object receiver, String messageName) throws Throwable Reads the property namedmessageNamefrom each element ofreceiver. A null receiver returns null. OtherwiseInvokerHelper.asIteratorwalks the receiver, each element is read withgetPropertySafe(java.lang.Class, java.lang.Object, java.lang.String), and the values are collected into aList.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Returns:
- null when
receiveris null; otherwise aListof property values - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setProperty
public static void setProperty(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable WritesmessageArgumentto the property namedmessageName.A null receiver is written through
NullObject.getNullObject(). AGroovyObjectis written withGroovyObject.setProperty(String, Object)whensenderClassis null orGroovyObjectOverrides.overridesSetProperty(Class)is true for the receiver's class, including when that method cannot be inspected. Every other receiver is written through the metaclass fromInvokerHelper.getMetaClass, callingMetaClass.setProperty(Class, Object, String, Object, boolean, boolean)withisCallToSuperfalse andfromInsideClassfalse.If that write throws
MissingPropertyException,receiveris aGroovyObject, andsenderClassis aGeneratedClosure, the sender is replaced by its enclosing class and that replacement repeats while the class is a generated closure. When the resulting class differs from the receiver's class and the receiver is an instance of it, the metaclass write is repeated with that class as the sender and withisCallToSuperandfromInsideClassboth false, and the method returns. Otherwise the originalGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown. An exception thrown by the retried write is not caught here.- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Throws:
Throwable- if the write fails. AGroovyRuntimeExceptionthat is not recovered by the generated-closure retry is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setPropertySafe
public static void setPropertySafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable Writes the property namedmessageName, doing nothing whenreceiveris null. A non-null receiver is written withsetProperty(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String).- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setPropertySpreadSafe
public static void setPropertySpreadSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable Writes the property namedmessageNameon each element ofreceiver. A null receiver returns without writing. OtherwiseInvokerHelper.asIteratorwalks the receiver and each element is written withsetPropertySafe(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String).- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getGroovyObjectProperty
public static Object getGroovyObjectProperty(Class senderClass, GroovyObject receiver, String messageName) throws Throwable ReadsmessageNamefrom aGroovyObject, falling back to the metaclass for a superclass sender.GroovyObject.getProperty(String)is called first. AMissingPropertyExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown whensenderClassis null, is the receiver's own class, or the receiver is not an instance ofsenderClass. Any otherGroovyRuntimeExceptionis unwrapped and rethrown. When the missing-property exception is not rethrown, the receiver's metaclassMetaClass.getProperty(Class, Object, String, boolean, boolean)is called withisCallToSuperfalse andfromInsideClassfalse.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Returns:
- the property value
- Throws:
Throwable- if the read fails. AMissingPropertyExceptionthat does not take the metaclass fallback, and any otherGroovyRuntimeException, is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getGroovyObjectPropertySafe
public static Object getGroovyObjectPropertySafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable ReadsmessageName, returning null whenreceiveris null. A non-null receiver is read withgetGroovyObjectProperty(java.lang.Class, groovy.lang.GroovyObject, java.lang.String).- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Returns:
- null when
receiveris null; otherwise the property value - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getGroovyObjectPropertySpreadSafe
public static Object getGroovyObjectPropertySpreadSafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable Reads the property namedmessageNamefrom each element ofreceiver. A null receiver returns null. OtherwiseInvokerHelper.asIteratorwalks the receiver, each element is read withgetPropertySafe(java.lang.Class, java.lang.Object, java.lang.String), and the values are collected into aList.- Parameters:
senderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Returns:
- null when
receiveris null; otherwise aListof property values - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setGroovyObjectProperty
public static void setGroovyObjectProperty(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable WritesmessageNameon aGroovyObject, using the object's own setter when the sender requires it.When
senderClassis null orGroovyObjectOverrides.overridesSetProperty(Class)is true,GroovyObject.setProperty(String, Object)is called and the method returns. AMissingPropertyExceptionfrom that call is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown whensenderClassis null, is the receiver's own class, or the receiver is not an instance ofsenderClass. Any otherGroovyRuntimeExceptionis unwrapped and rethrown. Otherwise the receiver's metaclassMetaClass.setProperty(Class, Object, String, Object, boolean, boolean)is called withisCallToSuperfalse andfromInsideClassfalse.- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Throws:
Throwable- if the write fails. AMissingPropertyExceptionthat does not take the metaclass fallback, and any otherGroovyRuntimeException, is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
setGroovyObjectPropertySafe
public static void setGroovyObjectPropertySafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable WritesmessageNameonreceiver, doing nothing whenreceiveris null. A non-null receiver is written withGroovyObject.setProperty(String, Object). The call is not passed to the metaclass and is not unwrapped.- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Throws:
Throwable
-
setGroovyObjectPropertySpreadSafe
public static void setGroovyObjectPropertySpreadSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable Writes the property namedmessageNameon each element ofreceiver. A null receiver returns without writing. OtherwiseInvokerHelper.asIteratorwalks the receiver and each element is written withsetPropertySafe(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String).- Parameters:
messageArgument- the value to writesenderClass- the class that originated the callreceiver- the receiver of the callmessageName- the property name- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
getMethodPointer
Returns a method closure for the given object and name.- Parameters:
object- the object or class providing the methodmethodName- the method(s) of interest- Returns:
- the resulting Closure
-
invokeClosure
Invokescallonclosure. The call isinvokeMethodN(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[])with the closure's runtime class as the sender and withargumentspassed through, so aGroovyRuntimeExceptionis unwrapped.- Parameters:
closure- the object whosecallmethod is invokedarguments- the arguments passed tocall- Returns:
- the value returned by
call - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
asType
Provides a hook for type coercion of the given object to the required type- Parameters:
type- of object to convert the given object toobject- the object to be converted- Returns:
- the original object or a new converted value
- Throws:
Throwable- if the coercion fails
-
castToType
Provides a hook for type casting of the given object to the required type- Parameters:
type- of object to convert the given object toobject- the object to be converted- Returns:
- the original object or a new converted value
- Throws:
Throwable- if the type casting fails
-
createTuple
Returns aTupleconstructed from the elements ofarray.- Parameters:
array- the elements passed to theTupleconstructor- Returns:
- the new tuple
-
createList
- Parameters:
values- the elements copied into the list- Returns:
- the new list
-
createPojoWrapper
Wraps a plain value in aPojoWrapperconstrained toclazz.- Parameters:
val- the wrapped valueclazz- the type the wrapper reports- Returns:
- the new wrapper
-
createGroovyObjectWrapper
- Parameters:
val- the wrappedGroovyObjectclazz- the type the wrapper reports- Returns:
- the new wrapper
-
createMap
Creates aMapfromvaluesby callingInvokerHelper.createMap. Entries are taken as alternating keys and values, in pair order. ASpreadMapfollowed by aMapcontributes that map's entries. A trailing value left without a pair is ignored.- Parameters:
values- alternating keys and values, with optional spread pairs- Returns:
- the new map
-
createRange
@GroovyABI(since="4.0.0") public static List createRange(Object from, Object to, boolean exclusiveLeft, boolean exclusiveRight) throws Throwable Builds a range fromfromtoto, honoring exclusive ends.When both ends are exclusive, an
EmptyRangeatfromis returned ifcompareEqual(java.lang.Object, java.lang.Object)considers the ends equal, or if stepping fromfromtowardtolands ontoand the ends have the same sign. The step isnextwhenfromis less thantoandpreviousotherwise, invoked throughinvokeMethod0(java.lang.Class, java.lang.Object, java.lang.String)with this class as the sender. Sign comes fromcompareTo(java.lang.Object, java.lang.Object)against0: both ends non-negative, or both negative. Zero counts as non-negative, so a fully exclusive range from zero to a negative number is not emptied by this rule. An equal pair with either end exclusive is also anEmptyRange.Otherwise, two
Integerendpoints produce anIntRangewhose inclusive flags are the negations ofexclusiveLeftandexclusiveRight. Two otherNumberendpoints produce aNumberRangewith those same inclusive flags. Every other pair produces anObjectRange. That type does not record inclusivity, so an exclusive right endpoint is replaced byto.next()whenfromis greater thantoand byto.previous()otherwise, and then an exclusive left endpoint is replaced byfrom.previous()whenfromis greater than the updatedtoand byfrom.next()otherwise. Those calls also go throughinvokeMethod0(java.lang.Class, java.lang.Object, java.lang.String)with this class as the sender.- Parameters:
from- the start of the rangeto- the end of the rangeexclusiveLeft- true whenfromis excludedexclusiveRight- true whentois excluded- Returns:
- the range, as a
List - Throws:
Throwable- if an endpointnextorpreviouscall fails; aGroovyRuntimeExceptionfrom that call is unwrapped
-
createRange
Builds a range fromfromtotowithfromincluded. The call iscreateRange(Object, Object, boolean, boolean)with the left end inclusive and the right end exclusive exactly wheninclusiveis false. Kept for compatibility with callers of this overload.- Parameters:
from- the start of the range; this end is includedto- the end of the rangeinclusive- true whentois included- Returns:
- the range returned by the four-argument method
- Throws:
Throwable- if the four-argument method fails
-
initMetaClass
Returns theMetaClassregistered for the class ofobject. The lookup isInvokerHelper.getMetaClass(object.getClass()).- Parameters:
object- the object whose class is looked up- Returns:
- the metaclass registered for
object.getClass()
-
assertFailed
Signals a failed assertion by callingInvokerHelper.assertFailed. A null or empty message produces aPowerAssertionErrorfromexpression.toString(). Any other message produces anAssertionErrorthat includes the message and the expression.- Parameters:
expression- the expression that failedmessage- the assertion message, or null or empty for a power assertion
-
isCase
Tests whethercaseExpressionmatchesswitchValueby callingisCase.A null case expression matches only a null switch value. Otherwise
invokeMethodN(java.lang.Class, java.lang.Object, java.lang.String, java.lang.Object[])callsisCaseon the case expression withswitchValueas its only argument, and the result is converted withDefaultTypeTransformation.castToBoolean(Object).- Parameters:
switchValue- the value being switched oncaseExpression- the case expression on whichisCaseis called, or null- Returns:
- true when the case matches
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
isNotCase
Returns the negation ofisCase(Object, Object).- Parameters:
switchValue- the value being switched oncaseExpression- the case passed toisCase(Object, Object)- Returns:
- true when
isCase(Object, Object)is false - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
isIn
Tests whetherswitchValueis a member ofcaseExpression.A null case expression matches only a null switch value. A
Mapmatches whenMap.containsKey(Object)returns true forswitchValue. When both operands are character sequences, the case expression's string form is tested withcontainsfor the switch value's string form. Every other case expression is tested withisCase(Object, Object).- Parameters:
switchValue- the candidate membercaseExpression- the collection, character sequence, or case expression being searched- Returns:
- true when
switchValueis a member ofcaseExpression - Throws:
Throwable- ifisCase(Object, Object)fails for a case expression that is not null, not aMap, and not a character sequence paired with one
-
isNotIn
Returns the negation ofisIn(Object, Object).- Parameters:
switchValue- the candidate membercaseExpression- the value passed toisIn(Object, Object)- Returns:
- true when
isIn(Object, Object)is false - Throws:
Throwable- ifisIn(Object, Object)fails
-
compareIdentical
Reports whetherleftandrightare the same reference, usingleft == right.- Parameters:
left- the left operandright- the right operand- Returns:
- true when the operands are the same reference, including both null
-
compareNotIdentical
Reports whetherleftandrightare different references, usingleft != right.- Parameters:
left- the left operandright- the right operand- Returns:
- true when the operands are not the same reference
-
compareEqual
Comparesleftandrightfor equality.The same reference is equal, including both null. When both values are non-null and have the same class,
Integer,Long,Double,Float,String, andGStringImpluseequals, andBigDecimalandBigIntegerare equal whencompareToreturns 0. Every other pair is compared withDefaultTypeTransformation.compareEqual(Object, Object).- Parameters:
left- the left operandright- the right operand- Returns:
- true when the operands are equal
-
compareNotEqual
Returns the negation ofcompareEqual(Object, Object).- Parameters:
left- the left operandright- the right operand- Returns:
- true when
compareEqual(Object, Object)is false
-
compareTo
Comparesleftwithrightand returns a boxed-1,0, or1. The comparison isDefaultTypeTransformation.compareTo(Object, Object). A zero result is returned as0, a positive result as1, and a negative result as-1.- Parameters:
left- the left operandright- the right operand- Returns:
-1whenleftis less thanright,0when they are equal, and1whenleftis greater
-
compareLessThan
Reports whetherleftis less thanright.When both values are non-null and have the same class,
Integer,Long,Double, andFloatuse the<operator, andBigDecimalandBigIntegerare less whencompareTois negative. Every other pair is less whencompareTo(Object, Object)returns-1.- Parameters:
left- the left operandright- the right operand- Returns:
- true when
leftis less thanright
-
compareLessThanEqual
Reports whetherleftis less than or equal toright.When both values are non-null and have the same class,
Integer,Long,Double, andFloatuse the<=operator, andBigDecimalandBigIntegerare less or equal whencompareTois not positive. Every other pair is less or equal whencompareTo(Object, Object)returns-1or0.- Parameters:
left- the left operandright- the right operand- Returns:
- true when
leftis less than or equal toright
-
compareGreaterThan
Reports whetherleftis greater thanright.When both values are non-null and have the same class,
Integer,Long,Double, andFloatuse the>operator, andBigDecimalandBigIntegerare greater whencompareTois positive. Every other pair is greater whencompareTo(Object, Object)returns1.- Parameters:
left- the left operandright- the right operand- Returns:
- true when
leftis greater thanright
-
compareGreaterThanEqual
Reports whetherleftis greater than or equal toright.When both values are non-null and have the same class,
Integer,Long,Double, andFloatuse the>=operator, andBigDecimalandBigIntegerare greater or equal whencompareTois not negative. Every other pair is greater or equal whencompareTo(Object, Object)returns1or0.- Parameters:
left- the left operandright- the right operand- Returns:
- true when
leftis greater than or equal toright
-
findRegex
Returns aMatcherofleftagainst the regular expressionright, by callingInvokerHelper.findRegex. AStringleft operand is used as that string; any other left operand is rendered to a string. APatternright operand is used as that pattern. AStringright operand is compiled, and every other right operand is compiled from its rendered text. -
matchRegex
Reports whetherleftmatches the whole regular expressionright, by callingInvokerHelper.matchRegex. A null operand yields false. APatternright operand is used as that pattern; any other right operand is compiled from its string form. The matcher is saved withRegexSupport.setLastMatcher, and the result isMatcher.matches().- Parameters:
left- the text to matchright- the regular expression, or null- Returns:
- true when
leftmatches the entire pattern
-
regexPattern
Compilesregexinto aPattern.regexis converted withtoString()and passed toStringGroovyMethods.bitwiseNegate. ThrowsPatternSyntaxExceptionifregexis not a valid regular expression.- Parameters:
regex- the expression to compile; itstoString()result is compiled- Returns:
- the compiled pattern
-
despreadList
Spreads selected argument values into one flat argument array.Each entry of
positionsis an index inargs. Arguments from the current index up to that position are copied, then the matchingspreadsvalue is expanded. After the last position, any remaining arguments are appended. A spread value is tested in this order: null is copied as null; aListis copied withaddAll; anIterablehas each element added; anIteratoris drained withforEachRemaining; aBaseStreamis drained through its iterator; an array is boxed withDefaultTypeTransformation.primitiveArrayBox(Object)when its component type is primitive, and otherwise copied as an object array. Any other value throwsIllegalArgumentException. The message names the runtime type and the value, and aMapappends ", did you mean to use the spread-map operator instead?".- Parameters:
args- the arguments that are not spreadspreads- the values to expand, one per entry ofpositionspositions- indexes inargsat which each spread value is inserted- Returns:
- the flattened arguments
-
spreadMap
Spreadsvalueas a map by callingInvokerHelper.spreadMap. AMapis flattened, in key-set order, into alternating keys and values. A non-null value that is not a map causesSpreadMapEvaluatingException. A null value fails withNullPointerExceptionwhile that exception message is built.- Parameters:
value- the map to spread- Returns:
- the spread map of
value's entries
-
unaryMinus
Returns the negation ofvaluefromInvokerHelper.unaryMinus.Integer,Long,Double,Float,Short, andByteare negated arithmetically, withShortandBytecast back to those types.BigIntegerandBigDecimalusenegate(). AnArrayListyields a new list of element-wise results. Any other value, including another kind ofList, is sent the no-argument messagenegative. AGroovyRuntimeExceptionraised by the helper propagates withoutunwrap(groovy.lang.GroovyRuntimeException).- Parameters:
value- the value to negate- Returns:
- the negated value
- Throws:
Throwable
-
unaryPlus
Returns the unary plus ofvaluefromInvokerHelper.unaryPlus.Integer,Long,BigInteger,BigDecimal,Double,Float,Short, andByteare returned unchanged. AnArrayListyields a new list of element-wise results. Any other value is sent the no-argument messagepositive. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
value- the value to which unary plus is applied- Returns:
- the value unchanged, or the element-wise or method result
- Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
bitwiseNegate
Returns the bitwise negation ofvaluefromInvokerHelper.bitwiseNegate.IntegerandLonguse the~operator, andBigIntegerusesnot(). AStringorGStringis compiled as a regular expression byStringGroovyMethods.bitwiseNegateonvalue.toString(). AnArrayListyields a new list of element-wise results. Any other value is sent the no-argument messagebitwiseNegate. AGroovyRuntimeExceptionis passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown.- Parameters:
value- the value to negate- Returns:
- the negated value, or the
Patterncompiled from a string - Throws:
Throwable- if the call fails with aGroovyRuntimeException, which is passed tounwrap(groovy.lang.GroovyRuntimeException)and rethrown
-
compoundAssign
@GroovyABI(since="6.0.0") public static Object compoundAssign(Object receiver, Object arg, String assignName, String baseName) throws Throwable GEP-15: dispatcher for compound-assignment operators in dynamic Groovy. Ifreceiverresponds toassignNamewith the supplied argument, invoke it and returnreceiver(so the caller's STORE assigns the same reference back, leaving the in-place mutation visible). Otherwise fall back tobaseNameand return its result for the caller to assign.- Throws:
Throwable- Since:
- 6.0.0
-
packedClosure
@GroovyABI(since="6.0.0") public static Closure<?> packedClosure(Object owner, Object dispatchers, int id, String method, Object[] captured, Class[] paramTypes, boolean strict, boolean implicit, boolean vararg) GROOVY-12151: the bytecode-facing factory for the shared packed-closure adapter. The compiler emits oneINVOKESTATICof this method per packed closure literal; hosting the factory here (with the dispatcher bundle travelling asObjectand the result asClosure) keepsPackedClosureoff the emitted-bytecode surface andGeneratedDispatcher.Bundleout of every creation site (only the hosting class's dispatcher factory names it). The cast is negligible against the object-creation cost.- Parameters:
owner- the enclosing instance (or the enclosingClassin a static context)dispatchers- the hosting class's linkedGeneratedDispatcher.Bundleid- the hoisted body's compile-time id in the class's dispatch tablesmethod- the hoisted method's name (diagnostics only)captured- captured values (References for written captures), ornullparamTypes- the literal's declared parameter typesstrict- whether the adapter installs the fail-fast delegate guard (dynamic trust path)implicit- whether the literal has an implicititparameter (fuzzy 0/1 arity)vararg- whether the literal's last parameter is a trailing array (varargs selection)- Returns:
- the packed closure adapter
- Since:
- 6.0.0
-
packedClosure
@GroovyABI(since="7.0.0") public static Closure<?> packedClosure(Object owner, Object dispatchers, int id, String method, Object[] captured, Class[] paramTypes, boolean strict, boolean implicit, boolean vararg, boolean usesReceiver) The packed-closure factory the compiler emits: aspackedClosure(Object, Object, int, String, Object[], Class[], boolean, boolean, boolean), which stays for class files compiled before it, plus whether the hoisted body uses its receiver, sorehydratehands the copy's body a new this object wherever a@CompileStaticclosure class would use it.- Parameters:
usesReceiver- whether the hoisted body uses its receiver- Returns:
- the packed closure adapter
- Since:
- 7.0.0
-