Class VoidAwareAssigner
- java.lang.Object
-
- net.bytebuddy.implementation.bytecode.assign.primitive.VoidAwareAssigner
-
- All Implemented Interfaces:
Assigner
@Enhance public class VoidAwareAssigner extends java.lang.Object implements Assigner
This assigner is able to handle thevoidtype. This means:- If a
voidtype is assigned to thevoidit will consider this a trivial operation. - If a
voidtype is assigned to a non-voidtype, it will pop the top value from the stack. - If a non-
voidtype is assigned to avoidtype, it will load the target type's default value only if this was configured at the assigner's construction. - If two non-
voidtypes are subject of the assignment, it will delegate the assignment to its chained assigner.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.assign.Assigner
Assigner.EqualTypesOnly, Assigner.Refusing, Assigner.Typing
-
-
Field Summary
Fields Modifier and Type Field Description private AssignerchainedAn assigner that is capable of handling assignments that do not involvevoidtypes.-
Fields inherited from interface net.bytebuddy.implementation.bytecode.assign.Assigner
DEFAULT, GENERICS_AWARE
-
-
Constructor Summary
Constructors Constructor Description VoidAwareAssigner(Assigner chained)Creates a new assigner that is capable of handling void types.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StackManipulationassign(TypeDescription.Generic source, TypeDescription.Generic target, Assigner.Typing typing)
-
-
-
Field Detail
-
chained
private final Assigner chained
An assigner that is capable of handling assignments that do not involvevoidtypes.
-
-
Constructor Detail
-
VoidAwareAssigner
public VoidAwareAssigner(Assigner chained)
Creates a new assigner that is capable of handling void types.- Parameters:
chained- A chained assigner which will be queried by this assigner to handle assignments that do not involve avoidtype.
-
-
Method Detail
-
assign
public StackManipulation assign(TypeDescription.Generic source, TypeDescription.Generic target, Assigner.Typing typing)
- Specified by:
assignin interfaceAssigner- Parameters:
source- The original type that is to be transformed into thetargetType.target- The target type into which thesourceTypeis to be converted.typing- A hint whether the assignment should consider the runtime type of the source type, i.e. if type down or cross castings are allowed. If this hint is set, this is also an indication thatvoidto non-voidassignments are permitted.- Returns:
- A stack manipulation that transforms the
sourceTypeinto thetargetTypeif this is possible. An illegal stack manipulation otherwise.
-
-