Class Implementation.SpecialMethodInvocation.Simple

    • Field Detail

      • methodDescription

        private final MethodDescription methodDescription
        The method description that is represented by this legal special method invocation.
      • typeDescription

        private final TypeDescription typeDescription
        The type description that is represented by this legal special method invocation.
      • stackManipulation

        private final StackManipulation stackManipulation
        A stack manipulation representing the method's invocation on the type description.
    • Constructor Detail

      • Simple

        protected Simple​(MethodDescription methodDescription,
                         TypeDescription typeDescription,
                         StackManipulation stackManipulation)
        Creates a new legal special method invocation.
        Parameters:
        methodDescription - The method that represents the special method invocation.
        typeDescription - The type on which the method should be invoked on by an INVOKESPECIAL invocation.
        stackManipulation - The stack manipulation that represents this special method invocation.
    • Method Detail

      • of

        public static Implementation.SpecialMethodInvocation of​(MethodDescription methodDescription,
                                                                TypeDescription typeDescription)
        Creates a special method invocation for a given invocation target.
        Parameters:
        methodDescription - The method that represents the special method invocation.
        typeDescription - The type on which the method should be invoked on by an INVOKESPECIAL invocation.
        Returns:
        A special method invocation representing a legal invocation if the method can be invoked specially on the target type or an illegal invocation if this is not possible.
      • getMethodDescription

        public MethodDescription getMethodDescription()
        Returns the method that represents this special method invocation. This method can be different even for equal special method invocations, dependant on the method that was used to request such an invocation by the means of a Implementation.Target.
        Returns:
        The method description that describes this instances invocation target.
      • getTypeDescription

        public TypeDescription getTypeDescription()
        Returns the target type the represented method is invoked on.
        Returns:
        The type the represented method is invoked on.
      • apply

        public StackManipulation.Size apply​(org.objectweb.asm.MethodVisitor methodVisitor,
                                            Implementation.Context implementationContext)
        Applies the stack manipulation that is described by this instance.
        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.
      • withCheckedCompatibilityTo

        public Implementation.SpecialMethodInvocation withCheckedCompatibilityTo​(MethodDescription.TypeToken token)
        Checks that this special method invocation is compatible with the supplied type representation.
        Parameters:
        token - The type token to check against.
        Returns:
        This special method invocation or an illegal invocation if the method invocation is not applicable.