Class InvokerFactory
java.lang.Object
org.apache.groovy.internal.runtime.invoke.InvokerFactory
Factory for
DirectInvoker instances bound to one CachedMethod.
Not user API. CachedMethod.invoke is the only production caller.
Package-visible helpers exist so tests can drive generation without going
through the hit-count hook.
Define path (one order):
- InvokerFactory nestmate +
INVOKE*when the member is publicly invocable from this class and every type is resolvable here (String.startsWith). - Declaring-class nestmate +
INVOKE*whenprivateLookupInis worth attempting and the host can resolveDirectInvoker. - InvokerFactory nestmate + classData
MethodHandlewhen this loader can resolve the erasedinvokeExacttypes. ClassLoaderForClassArtifactsvisible class, only when that loader can resolveDirectInvoker— never for bootstrap hosts.
null; they must not propagate to
CachedMethod.invoke.- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longDefault forPROPERTY_THRESHOLD.static final StringKill switch.static final StringHits before generation. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanPackage-visible predicate.static DirectInvokertryCreate(CachedMethod method) Attempts to bind a trampoline formethod.
-
Field Details
-
PROPERTY_THRESHOLD
Hits before generation. DefaultDEFAULT_THRESHOLD— the same order asgroovy.indy.optimize.threshold, so a method that stays ondoMethodInvokelong enough to look hot also qualifies for a trampoline.- See Also:
-
DEFAULT_THRESHOLD
public static final long DEFAULT_THRESHOLDDefault forPROPERTY_THRESHOLD.- See Also:
-
PROPERTY_DISABLE
Kill switch. Defaultfalse.- See Also:
-
-
Method Details
-
tryCreate
Attempts to bind a trampoline formethod. Returnsnullon any failure (sticky-fail). Public soCachedMethodin another package can call it; not user API (Internal,internalpackage). Tests in this package also drive generation through this method without going through the hit-count hook.- Parameters:
method- the cached method to bind- Returns:
- a trampoline, or
null
-
generationAllowed
public static boolean generationAllowed()Package-visible predicate. Android cannot be flipped with a property (AndroidSupport.isRunningAndroid()isClass.forName( "android.app.Activity")captured at class-init). Native image isHiddenClassDefiner.isEnabled()— do not also gate onAotDispatch.isAotLinkRequested(), which is true on HotSpot when-Dgroovy.indy.aot.link=trueand would silently disable generation in AOT-dispatch unit tests.- Returns:
truewhen generation may be attempted
-