Annotation Interface Variadic
Annotation indicating a parameter that takes zero or more values. If the final parameter of an
operation is annotated with
@Variadic
, those values will be collected into an
Object[]
as the last argument.
This annotation can also be applied to an Operation
class to mark its return type as
variadic. Such return values are flattened into the variadic array when used as one or more
operands to a Variadic
parameter. All specializations of a variadic-return operation must
always return a non-null Object
value.
- Since:
- 24.2
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionint
Specifies the number of values reserved in the variadic object array.
-
Element Details
-
startOffset
int startOffsetSpecifies the number of values reserved in the variadic object array. The array is sized accordingly, which can be useful when passing variadic arguments to acall
without reallocating the array.@Operation static final class FunctionCall { @Specialization public static Object variadic(CallTarget target, Object function, @Variadic(startOffset = 1) Object[] args, @Cached IndirectCallNode callNode) { args[0] = function; // use index 0 for the function instance return callNode.call(target, args); } }
- Since:
- 25.0
- Default:
0
-