Class VoidAwareAssigner
java.lang.Object
net.bytebuddy.implementation.bytecode.assign.primitive.VoidAwareAssigner
- All Implemented Interfaces:
Assigner
This assigner is able to handle the
void
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
FieldsModifier and TypeFieldDescriptionprivate final Assigner
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
ConstructorsConstructorDescriptionVoidAwareAssigner
(Assigner chained) Creates a new assigner that is capable of handling void types. -
Method Summary
Modifier and TypeMethodDescriptionassign
(TypeDescription.Generic source, TypeDescription.Generic target, Assigner.Typing typing)
-
Field Details
-
chained
An assigner that is capable of handling assignments that do not involvevoid
types.
-
-
Constructor Details
-
VoidAwareAssigner
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 Details
-
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.
-