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

public Class AliasMethod

extends DynamicMethod
Class Inheritance
Imports
org.jruby.RubyModule, org.jruby.internal.runtime.AbstractIRMethod, org.jruby.runtime.ArgumentDescriptor, .Arity, .Block, .Helpers, .Signature, .ThreadContext, .Visibility, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.callsite.CacheEntry, java.util.ArrayList, .Arrays, .Collection, .List

Represents a method which has been aliased. Aliased methods pass as frame class the implementationClass they were created with, which should reflect the level in the related class hierarchy where the alias appears. This allows aliased methods that super to do so from the appropriate starting level.

Field Summary

Modifier and TypeField and Description
private static List<String>
private final String
private final CacheEntry
private final boolean
private final String
Inherited from org.jruby.internal.runtime.methods.DynamicMethod:
aliasCountdefinedClassflagshandleimplementationClassnameprotectedClassserialNumber

Constructor Summary

AccessConstructor and Description
public
AliasMethod(RubyModule implementationClass, CacheEntry entry, String newName, String oldName)

For some java native methods it is convenient to pass in a String instead of a ByteList.

Method Summary

Modifier and TypeMethod and Description
private RubyModule
calculateSourceModule(IRubyObject self, RubyModule incomingSourceModule)

public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
call(ThreadContext
The thread context for the currently executing thread
context
,
IRubyObject
The 'self' or 'receiver' object to use for this call
self
,
RubyModule
The Ruby class against which this method is binding
klazz
,
String
The incoming name used to invoke this method
unused
,
IRubyObject[]
The first argument to this invocation
args
)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

A default implementation of n-arity, non-block 'call' method, which simply calls the n-arity, block-receiving version with the arg list and Block.NULL_BLOCK.

public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
call(ThreadContext
The thread context for the currently executing thread
context
,
IRubyObject
The 'self' or 'receiver' object to use for this call
self
,
RubyModule
The Ruby class against which this method is binding
klazz
,
String
The incoming name used to invoke this method
unused
,
IRubyObject[]
The argument list to this invocation
args
,
Block
The block passed to this invocation
block
)

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.call.

The minimum 'call' method required for a dynamic method handle.

private static Visibility
determineVisibility(String newName, Visibility visibility)

public DynamicMethod
dup()

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.dup.

Duplicate this method, returning DynamicMethod referencing the same code and with the same attributes.

public Arity
getArity()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.getArity.

Deprecated

Retrieve the arity of this method, used for reporting arity to Ruby code.

public String
public DynamicMethod
getRealMethod()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.getRealMethod.

Get the "real" method contained within this method.

public long
getSerialNumber()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.getSerialNumber.

Get the global serial number for this method object

public Signature
getSignature()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.getSignature.

Retrieve the signature of this method.

public boolean
isNative()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.isNative.

Returns true if this method is backed by native (i.e. Java) code.

public void
setRuby2Keywords()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.setRuby2Keywords.

Indicates the method will behave like a ruby2 keywords accepting method.

Inherited from org.jruby.internal.runtime.methods.DynamicMethod:
adjustAliasCountcalculateProtectedClasscallRespondTogetAliasCountgetCallConfiggetDefinedClassgetHandlegetImplementationClassgetInstanceVariableNamesgetMethodDatagetNamegetProtectedClassgetVisibilityinitinitisBuiltinisCallableFromisImplementedByisNotImplementedisNullisRefinedisUndefinedsetCallConfigsetDefinedClasssetHandlesetImplementationClasssetIsBuiltinsetNotImplementedsetVisibility

Field Detail

ALWAYS_PRIVATE_NAMESback to summary
private static List<String> ALWAYS_PRIVATE_NAMES
compoundNameback to summary
private final String compoundName
entryback to summary
private final CacheEntry entry
findImplementerback to summary
private final boolean findImplementer
newNameback to summary
private final String newName

Constructor Detail

AliasMethodback to summary
public AliasMethod(RubyModule implementationClass, CacheEntry entry, String newName, String oldName)

For some java native methods it is convenient to pass in a String instead of a ByteList.

Method Detail

calculateSourceModuleback to summary
private RubyModule calculateSourceModule(IRubyObject self, RubyModule incomingSourceModule)
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg1, IRubyObject arg2)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject[] args)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.call.

A default implementation of n-arity, non-block 'call' method, which simply calls the n-arity, block-receiving version with the arg list and Block.NULL_BLOCK.

Parameters
context:ThreadContext

The thread context for the currently executing thread

self:IRubyObject

The 'self' or 'receiver' object to use for this call

klazz:RubyModule

The Ruby class against which this method is binding

unused:String

The incoming name used to invoke this method

args:IRubyObject[]

The first argument to this invocation

Returns:IRubyObject

The result of the call

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, Block block)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg1, Block block)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg1, IRubyObject arg2, Block block)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject[] args, Block block)

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.call.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.call.

The minimum 'call' method required for a dynamic method handle. Subclasses must implement this method, but may implement the other signatures to provide faster, non-boxing call paths. Typically subclasses will implement this method to check variable arity calls, then performing a specific-arity invocation to the appropriate method or performing variable-arity logic in-line.

Parameters
context:ThreadContext

The thread context for the currently executing thread

self:IRubyObject

The 'self' or 'receiver' object to use for this call

klazz:RubyModule

The Ruby class against which this method is binding

unused:String

The incoming name used to invoke this method

args:IRubyObject[]

The argument list to this invocation

block:Block

The block passed to this invocation

Returns:IRubyObject

The result of the call

Annotations
@Override
determineVisibilityback to summary
private static Visibility determineVisibility(String newName, Visibility visibility)
dupback to summary
public DynamicMethod dup()

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.dup.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.dup.

Duplicate this method, returning DynamicMethod referencing the same code and with the same attributes. It is not required that this method produce a new object if the semantics of the DynamicMethod subtype do not require such.

Returns:DynamicMethod

An identical DynamicMethod object to the target.

getArityback to summary
public Arity getArity()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.getArity.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.getArity.

Deprecated

Retrieve the arity of this method, used for reporting arity to Ruby code. This arity may or may not reflect the actual specific or variable arities of the referenced method.

Returns:Arity

The arity of the method, as reported to Ruby consumers.

Annotations
@Deprecated
@Override
getOldNameback to summary
public String getOldName()
getRealMethodback to summary
public DynamicMethod getRealMethod()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.getRealMethod.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.getRealMethod.

Get the "real" method contained within this method. This simply returns self except in cases where a method is wrapped to give it a new name or new implementation class (AliasMethod, PartialDelegatingMethod, ...).

Returns:DynamicMethod

The "real" method associated with this one

Annotations
@Override
getSerialNumberback to summary
public long getSerialNumber()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.getSerialNumber.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.getSerialNumber.

Get the global serial number for this method object

Returns:long

This method object's serial number

Annotations
@Override
getSignatureback to summary
public Signature getSignature()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.getSignature.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.getSignature.

Retrieve the signature of this method.

Returns:Signature

the signature

Annotations
@Override
isNativeback to summary
public boolean isNative()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.isNative.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.isNative.

Returns true if this method is backed by native (i.e. Java) code.

Returns:boolean

true If backed by Java code or JVM bytecode; false otherwise

Annotations
@Override
setRuby2Keywordsback to summary
public void setRuby2Keywords()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.setRuby2Keywords.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.setRuby2Keywords.

Indicates the method will behave like a ruby2 keywords accepting method. This must be a Ruby implementation to work. See Module#ruby2_keywords for information on the semantics of a method which is marked this way.

Annotations
@Override