Top Description Fields Constructors Methods
org.jruby.internal.runtime.methods

public Class InvokeDynamicMethodFactory

extends InvocationMethodFactory
Class Inheritance
Imports
com.headius.invokebinder.Binder, .Signature, .SmartBinder, .SmartHandle, org.jruby.RubyModule, .Ruby, org.jruby.runtime.Block, .RubyEvent, .ThreadContext, org.jruby.runtime.builtin.IRubyObject, java.lang.invoke.MethodHandle, .MethodHandles, java.lang.reflect.Modifier, java.util.Collections, .HashMap, .List, .Map, java.util.function.Supplier, org.jruby.anno.JavaMethodDescriptor, org.jruby.runtime.invokedynamic.InvocationLinker, org.jruby.util.cli.Options, org.jruby.util.log.Logger, .LoggerFactory

This invoker uses MethodHandle for all bindings to Java code, rather than generating stubs or using reflection.
See Also
org.jruby.runtime.MethodFactory, HandleMethod

Field Summary

Modifier and TypeField and Description
private static final Map<String, SmartBinder>
private static final Logger
private static final MethodHandles.Lookup
public static final Signature[]
private static final SmartBinder[]
public static final Signature
Inherited from org.jruby.internal.runtime.methods.InvocationMethodFactory:
ARGS_INDEXBLOCK_INDEXCLASS_INDEXclassLoaderNAME_INDEXRECEIVER_INDEXsyncObjectTHIS_INDEXTHREADCONTEXT_INDEX

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Supplier<MethodHandle>
adaptHandle(final MethodHandle method, final Ruby runtime, final int actualRequired, final int required, final int optional, final boolean rest, final String rubyName, final Class<T> declaringClass, final boolean isStatic, final boolean hasContext, final boolean hasBlock, final boolean frame, final RubyModule implementationClass)

private Supplier<MethodHandle>[]
public static MethodHandle
finishAdapting(final SmartBinder binder, final RubyModule implementationClass, String rubyName, final MethodHandle method, final Class<T> declaringClass, final Ruby runtime, boolean isStatic, boolean frame)

public DynamicMethod
getAnnotatedMethod(final RubyModule
The target class or module on which the method will be bound.
implementationClass
,
final List<JavaMethodDescriptor> descs, String name)

Overrides org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethod.

Use code generation to provide a method handle based on an annotated Java method.

public DynamicMethod
getAnnotatedMethod(RubyModule
The target class or module on which the method will be bound.
implementationClass
,
JavaMethodDescriptor
A JavaMethodDescriptor describing the target method
desc
,
String name)

Overrides org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethod.

Use code generation to provide a method handle based on an annotated Java method.

public static SmartBinder
getBinder(int specific, final boolean b1, final boolean b2, final boolean b3)

public static SmartBinder
preAdaptHandle(int specificArity, final boolean isStatic, final boolean hasContext, final boolean hasBlock)

Inherited from org.jruby.internal.runtime.methods.InvocationMethodFactory:
constructJavaMethodendClassgetAnnotatedMethodClassgetPostMethod

Field Detail

BINDERSback to summary
private static final Map<String, SmartBinder> BINDERS
LOGback to summary
private static final Logger LOG

Hides org.jruby.internal.runtime.methods.InvocationMethodFactory.LOG.

LOOKUPback to summary
private static final MethodHandles.Lookup LOOKUP
SPECIFIC_ARITY_SIGNATURESback to summary
public static final Signature[] SPECIFIC_ARITY_SIGNATURES
SPREAD_BINDERSback to summary
private static final SmartBinder[] SPREAD_BINDERS
VARIABLE_ARITY_SIGNATUREback to summary
public static final Signature VARIABLE_ARITY_SIGNATURE

Constructor Detail

InvokeDynamicMethodFactoryback to summary
public InvokeDynamicMethodFactory(ClassLoader classLoader)

Method Detail

adaptHandleback to summary
public static Supplier<MethodHandle> adaptHandle(final MethodHandle method, final Ruby runtime, final int actualRequired, final int required, final int optional, final boolean rest, final String rubyName, final Class<T> declaringClass, final boolean isStatic, final boolean hasContext, final boolean hasBlock, final boolean frame, final RubyModule implementationClass)
buildAnnotatedMethodHandlesback to summary
private Supplier<MethodHandle>[] buildAnnotatedMethodHandles(Ruby runtime, List<JavaMethodDescriptor> descs, RubyModule implementationClass)
finishAdaptingback to summary
public static MethodHandle finishAdapting(final SmartBinder binder, final RubyModule implementationClass, String rubyName, final MethodHandle method, final Class<T> declaringClass, final Ruby runtime, boolean isStatic, boolean frame)
getAnnotatedMethodback to summary
public DynamicMethod getAnnotatedMethod(final RubyModule implementationClass, final List<JavaMethodDescriptor> descs, String name)

Overrides org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethod.

Doc from org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethod.

Use code generation to provide a method handle based on an annotated Java method.

Parameters
implementationClass:RubyModule

Doc from org.jruby.runtime.MethodFactory.getAnnotatedMethod.

The target class or module on which the method will be bound.

Returns:DynamicMethod

Doc from org.jruby.runtime.MethodFactory.getAnnotatedMethod.

A method handle for the target object.

Annotations
@Override
getAnnotatedMethodback to summary
public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, JavaMethodDescriptor desc, String name)

Overrides org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethod.

Use code generation to provide a method handle based on an annotated Java method.

Parameters
implementationClass:RubyModule

Doc from org.jruby.runtime.MethodFactory.getAnnotatedMethod.

The target class or module on which the method will be bound.

desc:JavaMethodDescriptor

Doc from org.jruby.runtime.MethodFactory.getAnnotatedMethod.

A JavaMethodDescriptor describing the target method

Returns:DynamicMethod

Doc from org.jruby.runtime.MethodFactory.getAnnotatedMethod.

A method handle for the target object.

Annotations
@Override
See Also
org.jruby.runtime.MethodFactory#getAnnotatedMethod
getBinderback to summary
public static SmartBinder getBinder(int specific, final boolean b1, final boolean b2, final boolean b3)
preAdaptHandleback to summary
public static SmartBinder preAdaptHandle(int specificArity, final boolean isStatic, final boolean hasContext, final boolean hasBlock)