Class MethodVariableAccess.MethodLoading

    • Constructor Detail

      • MethodLoading

        protected MethodLoading​(MethodDescription methodDescription,
                                MethodVariableAccess.MethodLoading.TypeCastingHandler typeCastingHandler)
        Creates a new method loading stack manipulation.
        Parameters:
        methodDescription - The method for which all parameters are loaded onto the operand stack.
        typeCastingHandler - A type casting handler which is capable of transforming all method parameters.
    • Method Detail

      • isValid

        public boolean isValid()
        Determines if this stack manipulation is valid.
        Specified by:
        isValid in interface StackManipulation
        Returns:
        If false, this manipulation cannot be applied and should throw an exception.
      • apply

        public StackManipulation.Size apply​(org.objectweb.asm.MethodVisitor methodVisitor,
                                            Implementation.Context implementationContext)
        Applies the stack manipulation that is described by this instance.
        Specified by:
        apply in interface StackManipulation
        Parameters:
        methodVisitor - The method visitor used to write the method implementation to.
        implementationContext - The context of the current implementation.
        Returns:
        The changes to the size of the operand stack that are implied by this stack manipulation.
      • prependThisReference

        public StackManipulation prependThisReference()
        Prepends a reference to the this instance to the loaded parameters if the represented method is non-static.
        Returns:
        A stack manipulation that loads all method parameters onto the operand stack while additionally loading a reference to this if the represented is non-static. Any potential parameter transformation is preserved.
      • asBridgeOf

        public MethodVariableAccess.MethodLoading asBridgeOf​(MethodDescription bridgeTarget)
        Applies a transformation to all loaded arguments of the method being loaded to be casted to the corresponding parameter of the provided method. This way, the parameters can be used for invoking a bridge target method.
        Parameters:
        bridgeTarget - The method that is the target of the bridge method for which the parameters are being loaded.
        Returns:
        A stack manipulation that loads all parameters casted to the types of the supplied bridge target.