java.lang.Object
net.bytebuddy.implementation.bytecode.assign.primitive.VoidAwareAssigner
All Implemented Interfaces:
Assigner

@Enhance public class VoidAwareAssigner extends Object implements Assigner
This assigner is able to handle the void type. This means:
  1. If a void type is assigned to the void it will consider this a trivial operation.
  2. If a void type is assigned to a non-void type, it will pop the top value from the stack.
  3. If a non-void type is assigned to a void type, it will load the target type's default value only if this was configured at the assigner's construction.
  4. If two non-void types are subject of the assignment, it will delegate the assignment to its chained assigner.
  • Field Details

    • chained

      private final Assigner chained
      An assigner that is capable of handling assignments that do not involve void types.
  • Constructor Details

    • 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 a void type.
  • Method Details

    • assign

      Specified by:
      assign in interface Assigner
      Parameters:
      source - The original type that is to be transformed into the targetType.
      target - The target type into which the sourceType 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 that void to non-void assignments are permitted.
      Returns:
      A stack manipulation that transforms the sourceType into the targetType if this is possible. An illegal stack manipulation otherwise.