Class ReferenceAdapters
java.lang.Object
io.micronaut.sourcegen.bytecode.core.ReferenceAdapters
The method references a metafactory cannot link to their method directly, which are written as a lambda calling it.
- Since:
- 2.3
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancapturesReceiverValue(MethodReferenceExpression reference) Whether the receiver of a reference is read where the adapter is invoked unless the writer reads it first: a field, which a bound reference reads once, where it is created.static @Nullable ExpressionDef.LambdavarargsAdapter(MethodReferenceExpression reference) A reference to a method of variable arity that the functional method passes the values of the array to - aFunction<String, String>of a<T> String component(T...)- as the lambda javac writes for it, packing them into an array of the type they are passed with.static @Nullable ExpressionDef.LambdavarargsAdapter(MethodReferenceExpression reference, @Nullable ExpressionDef instance) The adapter ofvarargsAdapter(MethodReferenceExpression), invoking the method on the receiver given: the local a writer holds the value of a field receiver in.
-
Method Details
-
varargsAdapter
A reference to a method of variable arity that the functional method passes the values of the array to - aFunction<String, String>of a<T> String component(T...)- as the lambda javac writes for it, packing them into an array of the type they are passed with.- Parameters:
reference- The reference- Returns:
- The lambda, or
nullwhere the method takes the arguments as they are passed
-
capturesReceiverValue
Whether the receiver of a reference is read where the adapter is invoked unless the writer reads it first: a field, which a bound reference reads once, where it is created. The writer reads it, checks it is not null, holds it in a local and passes the local tovarargsAdapter(MethodReferenceExpression, ExpressionDef).- Parameters:
reference- The reference- Returns:
- Whether the receiver is read into a local before the adapter is written
-
varargsAdapter
public static @Nullable ExpressionDef.Lambda varargsAdapter(MethodReferenceExpression reference, @Nullable ExpressionDef instance) The adapter ofvarargsAdapter(MethodReferenceExpression), invoking the method on the receiver given: the local a writer holds the value of a field receiver in.- Parameters:
reference- The referenceinstance- The receiver, ornullfor a static method- Returns:
- The lambda, or
nullwhere the method takes the arguments as they are passed
-