Class IndyInterface


  • public class IndyInterface
    extends java.lang.Object
    Bytecode level interface for bootstrap methods used by invokedynamic. This class provides a logging ability by using the boolean system property groovy.indy.logging. Other than that this class contains the interfacing methods with bytecode for invokedynamic as well as some helper methods and classes.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  IndyInterface.CALL_TYPES
      Enum for easy differentiation between call types
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int GROOVY_OBJECT
      flags for method and property calls
      static int IMPLICIT_THIS
      flags for method and property calls
      protected static java.util.logging.Logger LOG
      Logger
      protected static boolean LOG_ENABLED
      boolean to indicate if logging for indy is enabled
      static java.lang.invoke.MethodHandles.Lookup LOOKUP
      LOOKUP constant used for for example unreflect calls
      static int SAFE_NAVIGATION
      flags for method and property calls
      static int SPREAD_CALL
      flags for method and property calls
      protected static java.lang.invoke.SwitchPoint switchPoint  
      static int THIS_CALL
      flags for method and property calls
      static int UNCACHED_CALL
      flags for method and property calls
    • Constructor Summary

      Constructors 
      Constructor Description
      IndyInterface()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.invoke.CallSite bootstrap​(java.lang.invoke.MethodHandles.Lookup caller, java.lang.String name, java.lang.invoke.MethodType type)
      Deprecated.
      since Groovy 2.1.0
      static java.lang.invoke.CallSite bootstrap​(java.lang.invoke.MethodHandles.Lookup caller, java.lang.String callType, java.lang.invoke.MethodType type, java.lang.String name, int flags)
      bootstrap method for method calls from Groovy compiled code with indy enabled.
      static java.lang.invoke.CallSite bootstrapCurrent​(java.lang.invoke.MethodHandles.Lookup caller, java.lang.String name, java.lang.invoke.MethodType type)
      Deprecated.
      since Groovy 2.1.0
      static java.lang.invoke.CallSite bootstrapCurrentSafe​(java.lang.invoke.MethodHandles.Lookup caller, java.lang.String name, java.lang.invoke.MethodType type)
      Deprecated.
      since Groovy 2.1.0
      static java.lang.invoke.CallSite bootstrapSafe​(java.lang.invoke.MethodHandles.Lookup caller, java.lang.String name, java.lang.invoke.MethodType type)
      Deprecated.
      since Groovy 2.1.0
      protected static void invalidateSwitchPoints()
      Callback for constant meta class update change
      protected static java.lang.invoke.MethodHandle makeFallBack​(java.lang.invoke.MutableCallSite mc, java.lang.Class<?> sender, java.lang.String name, int callID, java.lang.invoke.MethodType type, boolean safeNavigation, boolean thisCall, boolean spreadCall)
      Makes a fallback method for an invalidated method selection
      static java.lang.Object selectMethod​(java.lang.invoke.MutableCallSite callSite, java.lang.Class sender, java.lang.String methodName, int callID, java.lang.Boolean safeNavigation, java.lang.Boolean thisCall, java.lang.Boolean spreadCall, java.lang.Object dummyReceiver, java.lang.Object[] arguments)
      Core method for indy method selection using runtime types.
      static java.lang.invoke.CallSite staticArrayAccess​(java.lang.invoke.MethodHandles.Lookup lookup, java.lang.String name, java.lang.invoke.MethodType type)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SAFE_NAVIGATION

        public static final int SAFE_NAVIGATION
        flags for method and property calls
        See Also:
        Constant Field Values
      • THIS_CALL

        public static final int THIS_CALL
        flags for method and property calls
        See Also:
        Constant Field Values
      • GROOVY_OBJECT

        public static final int GROOVY_OBJECT
        flags for method and property calls
        See Also:
        Constant Field Values
      • IMPLICIT_THIS

        public static final int IMPLICIT_THIS
        flags for method and property calls
        See Also:
        Constant Field Values
      • SPREAD_CALL

        public static final int SPREAD_CALL
        flags for method and property calls
        See Also:
        Constant Field Values
      • UNCACHED_CALL

        public static final int UNCACHED_CALL
        flags for method and property calls
        See Also:
        Constant Field Values
      • LOG

        protected static final java.util.logging.Logger LOG
        Logger
      • LOG_ENABLED

        protected static final boolean LOG_ENABLED
        boolean to indicate if logging for indy is enabled
      • LOOKUP

        public static final java.lang.invoke.MethodHandles.Lookup LOOKUP
        LOOKUP constant used for for example unreflect calls
      • switchPoint

        protected static java.lang.invoke.SwitchPoint switchPoint
    • Constructor Detail

      • IndyInterface

        public IndyInterface()
    • Method Detail

      • invalidateSwitchPoints

        protected static void invalidateSwitchPoints()
        Callback for constant meta class update change
      • bootstrap

        public static java.lang.invoke.CallSite bootstrap​(java.lang.invoke.MethodHandles.Lookup caller,
                                                          java.lang.String callType,
                                                          java.lang.invoke.MethodType type,
                                                          java.lang.String name,
                                                          int flags)
        bootstrap method for method calls from Groovy compiled code with indy enabled. This method gets a flags parameter which uses the following encoding:
        Parameters:
        caller - - the caller
        callType - - the type of the call
        type - - the call site type
        name - - the real method name
        flags - - call flags
        Returns:
        the produced CallSite
        Since:
        Groovy 2.1.0
      • bootstrapCurrent

        @Deprecated
        public static java.lang.invoke.CallSite bootstrapCurrent​(java.lang.invoke.MethodHandles.Lookup caller,
                                                                 java.lang.String name,
                                                                 java.lang.invoke.MethodType type)
        Deprecated.
        since Groovy 2.1.0
        bootstrap method for method calls with "this" as receiver
      • bootstrapCurrentSafe

        @Deprecated
        public static java.lang.invoke.CallSite bootstrapCurrentSafe​(java.lang.invoke.MethodHandles.Lookup caller,
                                                                     java.lang.String name,
                                                                     java.lang.invoke.MethodType type)
        Deprecated.
        since Groovy 2.1.0
        bootstrap method for method calls with "this" as receiver safe
      • bootstrap

        @Deprecated
        public static java.lang.invoke.CallSite bootstrap​(java.lang.invoke.MethodHandles.Lookup caller,
                                                          java.lang.String name,
                                                          java.lang.invoke.MethodType type)
        Deprecated.
        since Groovy 2.1.0
        bootstrap method for standard method calls
      • bootstrapSafe

        @Deprecated
        public static java.lang.invoke.CallSite bootstrapSafe​(java.lang.invoke.MethodHandles.Lookup caller,
                                                              java.lang.String name,
                                                              java.lang.invoke.MethodType type)
        Deprecated.
        since Groovy 2.1.0
        bootstrap method for null safe standard method calls
      • makeFallBack

        protected static java.lang.invoke.MethodHandle makeFallBack​(java.lang.invoke.MutableCallSite mc,
                                                                    java.lang.Class<?> sender,
                                                                    java.lang.String name,
                                                                    int callID,
                                                                    java.lang.invoke.MethodType type,
                                                                    boolean safeNavigation,
                                                                    boolean thisCall,
                                                                    boolean spreadCall)
        Makes a fallback method for an invalidated method selection
      • selectMethod

        public static java.lang.Object selectMethod​(java.lang.invoke.MutableCallSite callSite,
                                                    java.lang.Class sender,
                                                    java.lang.String methodName,
                                                    int callID,
                                                    java.lang.Boolean safeNavigation,
                                                    java.lang.Boolean thisCall,
                                                    java.lang.Boolean spreadCall,
                                                    java.lang.Object dummyReceiver,
                                                    java.lang.Object[] arguments)
                                             throws java.lang.Throwable
        Core method for indy method selection using runtime types.
        Throws:
        java.lang.Throwable
      • staticArrayAccess

        public static java.lang.invoke.CallSite staticArrayAccess​(java.lang.invoke.MethodHandles.Lookup lookup,
                                                                  java.lang.String name,
                                                                  java.lang.invoke.MethodType type)
        Since:
        2.5.0