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 thevoid
type. This means:- If a
void
type is assigned to thevoid
it will consider this a trivial operation. - If a
void
type is assigned to a non-void
type, it will pop the top value from the stack. - If a non-
void
type is assigned to avoid
type, it will load the target type's default value only if this was configured at the assigner's construction. - If two non-
void
types 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 Assigner
chained
An assigner that is capable of handling assignments that do not involvevoid
types.-
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 StackManipulation
assign(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 involvevoid
types.
-
-
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 avoid
type.
-
-
Method Detail
-
assign
public StackManipulation assign(TypeDescription.Generic source, TypeDescription.Generic target, Assigner.Typing typing)
- Specified by:
assign
in interfaceAssigner
- Parameters:
source
- The original type that is to be transformed into thetargetType
.target
- The target type into which thesourceType
is 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 thatvoid
to non-void
assignments are permitted.- Returns:
- A stack manipulation that transforms the
sourceType
into thetargetType
if this is possible. An illegal stack manipulation otherwise.
-
-