Record Class InvocationPlan
java.lang.Object
java.lang.Record
io.micronaut.sourcegen.bytecode.core.InvocationPlan
- Record Components:
kind- The instructionownerDescriptor- The descriptor of the type the instruction namesname- The name of the methoddescriptor- The descriptor of the method, returning what its declaration doesownerInterface- Whether the owner is an interface, as the constant pool entry of the method saysreceiver- What happens to the receiver once it is writtenreceiverCast- The descriptor of the type the receiver is cast to, forInvocationPlan.Receiver.CASTmethod- The invoked method, in the scope of the class declaring itvalues- The arguments, converted to the parameters of the methodresult- The conversion of the result to the type the call requests, if any
@Internal
public record InvocationPlan(InvocationPlan.Kind kind, String ownerDescriptor, String name, String descriptor, boolean ownerInterface, InvocationPlan.Receiver receiver, @Nullable String receiverCast, MethodDef method, List<? extends ExpressionDef> values, @Nullable InvocationPlan.ResultConversion result)
extends Record
An invocation as both bytecode writers emit it, planned once: the instruction and what it names - the owner, the
descriptor with the return type the method declares, whether the owner is an interface - what happens to the
receiver, the parameters the arguments are converted to, and the conversion of the result to the type the call
requests. A writer only writes the receiver and the arguments, and emits the plan.
- Since:
- 2.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn invocation instruction.static enumWhat happens to the receiver of an invocation once it is written.static final recordThe conversion of what a declaration returns to the type the call requests. -
Constructor Summary
ConstructorsConstructorDescriptionInvocationPlan(InvocationPlan.Kind kind, String ownerDescriptor, String name, String descriptor, boolean ownerInterface, InvocationPlan.Receiver receiver, @Nullable String receiverCast, MethodDef method, List<? extends ExpressionDef> values, @Nullable InvocationPlan.ResultConversion result) Creates an instance of aInvocationPlanrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedescriptorrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.kind()Returns the value of thekindrecord component.method()Returns the value of themethodrecord component.name()Returns the value of thenamerecord component.static InvocationPlanofInstance(ExpressionDef instance, MethodDef method, List<? extends ExpressionDef> values, @Nullable ObjectDef current, @Nullable MethodDef enclosing) The call of a method on a value.static InvocationPlanofInstance(ExpressionDef instance, MethodDef method, List<? extends ExpressionDef> values, @Nullable ObjectDef current, @Nullable MethodDef enclosing, EnclosingScope enclosingScope) The call of a method on a value, asofInstance(ExpressionDef, MethodDef, List, ObjectDef, MethodDef)plans it, in the enclosing scope of the class being written.static InvocationPlanofNewInstance(ExpressionDef.NewInstance newInstance, @Nullable ObjectDef current, @Nullable MethodDef enclosing) The constructornewinvokes, erased in the scope of the class declaring it; one the class does not declare, of a variable named alone, or onenewdoes not access from the class being written is resolved where the call is written.static InvocationPlanofNewInstance(ExpressionDef.NewInstance newInstance, @Nullable ObjectDef current, @Nullable MethodDef enclosing, EnclosingScope enclosingScope) The constructornewinvokes, asofNewInstance(ExpressionDef.NewInstance, ObjectDef, MethodDef)plans it, in the enclosing scope of the class being written.static InvocationPlanofStatic(ClassTypeDef owner, MethodDef method, List<? extends ExpressionDef> values, @Nullable ObjectDef current, @Nullable MethodDef enclosing) The call of a static method of a class: resolved, erased and converted as acall on a valueis, with no receiver.static InvocationPlanofStatic(ClassTypeDef owner, MethodDef method, List<? extends ExpressionDef> values, @Nullable ObjectDef current, @Nullable MethodDef enclosing, EnclosingScope enclosingScope) The call of a static method of a class, asofStatic(ClassTypeDef, MethodDef, List, ObjectDef, MethodDef)plans it, in the enclosing scope of the class being written.static InvocationPlanofSuperConstructor(StatementDef.InvokeSuperConstructor invocation, @Nullable ObjectDef current, @Nullable MethodDef enclosing, EnclosingScope enclosingScope) The superclass constructor an explicitsuper(...)invokes, erased in the scope of the superclass; one the class being written does not access bysuper(...)- a package-private one of another package - is resolved where the call is written.Returns the value of theownerDescriptorrecord component.booleanReturns the value of theownerInterfacerecord component.receiver()Returns the value of thereceiverrecord component.@Nullable StringReturns the value of thereceiverCastrecord component.@Nullable InvocationPlan.ResultConversionresult()Returns the value of theresultrecord component.static ClassTypeDefsuperTypeOf(VariableDef.Super aSuper, @Nullable ObjectDef current) The supertype asuperreference resolves against: the one it names, or the definition's own supertype where it is the placeholderTypeDef.SUPER-Enumof an enum,Recordof a record, the superclass of a class andObjectotherwise.final StringtoString()Returns a string representation of this record class.List<? extends ExpressionDef> values()Returns the value of thevaluesrecord component.
-
Constructor Details
-
InvocationPlan
public InvocationPlan(InvocationPlan.Kind kind, String ownerDescriptor, String name, String descriptor, boolean ownerInterface, InvocationPlan.Receiver receiver, @Nullable String receiverCast, MethodDef method, List<? extends ExpressionDef> values, @Nullable InvocationPlan.ResultConversion result) Creates an instance of aInvocationPlanrecord class.- Parameters:
kind- the value for thekindrecord componentownerDescriptor- the value for theownerDescriptorrecord componentname- the value for thenamerecord componentdescriptor- the value for thedescriptorrecord componentownerInterface- the value for theownerInterfacerecord componentreceiver- the value for thereceiverrecord componentreceiverCast- the value for thereceiverCastrecord componentmethod- the value for themethodrecord componentvalues- the value for thevaluesrecord componentresult- the value for theresultrecord component
-
-
Method Details
-
ofInstance
public static InvocationPlan ofInstance(ExpressionDef instance, MethodDef method, List<? extends ExpressionDef> values, @Nullable ObjectDef current, @Nullable MethodDef enclosing) The call of a method on a value.- A method the receiver does not declare - on
thisorsuper, of a variable named alone - or one the class being written does not access is resolved where the call is written. - A receiver of a type variable is the bound declaring the method, cast to where it is not the erasure.
- The method is erased in the scope of the class declaring it, whose variables the caller's can shadow.
- A static method called through a value is invoked statically, the value evaluated and discarded, as javac does.
- A call on
superis dispatched non-virtually against the supertype, which names an interface method forInterface.super.name(); a call on an interface isinvokeinterface, even of a default method. - A call requesting another type than its method declares invokes the declaration, and converts what it returns, as javac does: a primitive requested of a generic return unboxes the wrapper the call returns.
- Parameters:
instance- The receivermethod- The methodvalues- The argumentscurrent- The definition being written, if anyenclosing- The method being written, if any- Returns:
- The plan
- A method the receiver does not declare - on
-
ofInstance
public static InvocationPlan ofInstance(ExpressionDef instance, MethodDef method, List<? extends ExpressionDef> values, @Nullable ObjectDef current, @Nullable MethodDef enclosing, EnclosingScope enclosingScope) The call of a method on a value, asofInstance(ExpressionDef, MethodDef, List, ObjectDef, MethodDef)plans it, in the enclosing scope of the class being written.- Parameters:
instance- The receivermethod- The methodvalues- The argumentscurrent- The definition being written, if anyenclosing- The method being written, if anyenclosingScope- The enclosing scope of the class being written- Returns:
- The plan
- Since:
- 2.3
-
ofStatic
public static InvocationPlan ofStatic(ClassTypeDef owner, MethodDef method, List<? extends ExpressionDef> values, @Nullable ObjectDef current, @Nullable MethodDef enclosing) The call of a static method of a class: resolved, erased and converted as acall on a valueis, with no receiver.- Parameters:
owner- The class declaring the methodmethod- The methodvalues- The argumentscurrent- The definition being written, if anyenclosing- The method being written, if any- Returns:
- The plan
-
ofStatic
public static InvocationPlan ofStatic(ClassTypeDef owner, MethodDef method, List<? extends ExpressionDef> values, @Nullable ObjectDef current, @Nullable MethodDef enclosing, EnclosingScope enclosingScope) The call of a static method of a class, asofStatic(ClassTypeDef, MethodDef, List, ObjectDef, MethodDef)plans it, in the enclosing scope of the class being written.- Parameters:
owner- The class declaring the methodmethod- The methodvalues- The argumentscurrent- The definition being written, if anyenclosing- The method being written, if anyenclosingScope- The enclosing scope of the class being written- Returns:
- The plan
- Since:
- 2.3
-
ofNewInstance
public static InvocationPlan ofNewInstance(ExpressionDef.NewInstance newInstance, @Nullable ObjectDef current, @Nullable MethodDef enclosing) The constructornewinvokes, erased in the scope of the class declaring it; one the class does not declare, of a variable named alone, or onenewdoes not access from the class being written is resolved where the call is written. The writer writes thenewanddupthe constructor is invoked on.- Parameters:
newInstance- The instantiationcurrent- The definition being written, if anyenclosing- The method being written, if any- Returns:
- The plan
-
ofNewInstance
public static InvocationPlan ofNewInstance(ExpressionDef.NewInstance newInstance, @Nullable ObjectDef current, @Nullable MethodDef enclosing, EnclosingScope enclosingScope) The constructornewinvokes, asofNewInstance(ExpressionDef.NewInstance, ObjectDef, MethodDef)plans it, in the enclosing scope of the class being written.- Parameters:
newInstance- The instantiationcurrent- The definition being written, if anyenclosing- The method being written, if anyenclosingScope- The enclosing scope of the class being written- Returns:
- The plan
- Since:
- 2.3
-
ofSuperConstructor
public static InvocationPlan ofSuperConstructor(StatementDef.InvokeSuperConstructor invocation, @Nullable ObjectDef current, @Nullable MethodDef enclosing, EnclosingScope enclosingScope) The superclass constructor an explicitsuper(...)invokes, erased in the scope of the superclass; one the class being written does not access bysuper(...)- a package-private one of another package - is resolved where the call is written. The writer writes the receiver the constructor is invoked on.- Parameters:
invocation- The invocationcurrent- The definition being written, if anyenclosing- The method being written, if anyenclosingScope- The enclosing scope of the class being written- Returns:
- The plan
-
superTypeOf
The supertype asuperreference resolves against: the one it names, or the definition's own supertype where it is the placeholderTypeDef.SUPER-Enumof an enum,Recordof a record, the superclass of a class andObjectotherwise.- Parameters:
aSuper- The referencecurrent- The definition being written, if any- Returns:
- The supertype
-
parameterTypes
-
ownerInternalName
- Returns:
- The internal name of the owner, which is the descriptor of an array type
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
kind
-
ownerDescriptor
Returns the value of theownerDescriptorrecord component.- Returns:
- the value of the
ownerDescriptorrecord component
-
name
-
descriptor
Returns the value of thedescriptorrecord component.- Returns:
- the value of the
descriptorrecord component
-
ownerInterface
public boolean ownerInterface()Returns the value of theownerInterfacerecord component.- Returns:
- the value of the
ownerInterfacerecord component
-
receiver
-
receiverCast
Returns the value of thereceiverCastrecord component.- Returns:
- the value of the
receiverCastrecord component
-
method
-
values
-
result
-