import static org.jruby.anno.FrameField.VISIBILITY;
import static org.jruby.runtime.Visibility.*;
import static org.jruby.CompatVersion.*;
private static final boolean DEBUG = false;
return RubyKernel.autoload(recv, arg0, arg1);
return RubyKernel.autoload_p(context, recv, arg0);
AutoloadMap must be accessed after checking ConstantMap. Checking UNDEF value in constantMap works as a guard.
For looking up constant, check constantMap first then try to get an Autoload object from autoloadMap.
For setting constant, update constantMap first and remove an Autoload object from autoloadMap.
oldIncludingHierarchies.add(hierarchy);
separate path for MetaClass construction
super(runtime, metaClass, objectSpace);
used by MODULE_ALLOCATOR and RubyClass constructors
standard path for Module construction
rb_module_new/rb_define_module_id/rb_name_class/rb_set_class_path
Getter for property superClass.
- Returns:
- Value of property superClass.
Is this module one that in an included one (e.g. an IncludedModuleWrapper).
Get the base name of this class, or null if it is an anonymous class.
- Returns:
- base name of the class
Set the base name of the class. If null, the class effectively becomes
anonymous (though constants elsewhere may reference it).
- Parameters:
name
the new base name of the class
Generate a fully-qualified class name or a #-style name for anonymous and singleton classes.
Ruby C equivalent = "classname"
- Returns:
- The generated class name
Get the "simple" name for the class, which is either the "base" name or
the "anonymous" class name.
- Returns:
- the "simple" name of the class
Recalculate the fully-qualified name of this class/module.
int totalLength = name.length() + parentCount * 2;
totalLength += pName.length();
for (String parentName : parentNames) {
Create a wrapper to use for including the specified module into this one.
Ruby C equivalent = "include_class_new"
- Returns:
- The module wrapper
Finds a class that is within the current module (or class).
- Parameters:
name
to be found in this module (or class)- Returns:
- the class or null if no such class
Include a new module in this module or class.
- Parameters:
arg
The module to include
boolean foundMethod = false;
for (Field field : declaredFields) {
if (jrubyConstant == null) return false;
for (Method method: declaredMethods) {
if (anno == null) continue;
methodDescs = methodsHash.get(name);
if (methodDescs == null) {
methodsHash.put(name, methodDescs);
if (methodDescs == null) {
if (DEBUG) LOG.debug("Could not find it, using default populator");
if (methods.size() == 1) {
define(this, desc, dynamicMethod);
if (jrubyMethod == null) return false;
define(this, desc, dynamicMethod);
if (jrubyMethod == null) return false;
define(this, desc, dynamicMethod);
Ruby runtime = context.runtime;
throw runtime.newNameError("Undefined method " + name + " for" + s0 + " '" + c.getName() + "'", name);
if (p.isSame(moduleToCompare)) {
This method is not intended for use by normal users; it is a fast-path
method that skips synchronization and hierarchy invalidation to speed
boot-time method definition.
- Parameters:
name
The name to which to bind the methodmethod
The method to bind
Ruby runtime = context.runtime;
Search through this module and supermodules for method definitions. Cache superclass definitions in this class.
- Parameters:
name
The name of the method to search for- Returns:
- The method, or UndefinedMethod if not found
Search through this module and supermodules for method definitions. Cache superclass definitions in this class.
- Parameters:
name
The name of the method to search for- Returns:
- The method, or UndefinedMethod if not found
if (entry != null) return entry;
if (cacheEntry != null) {
Test all WrapperCacheEntryFactory instances in the chain for assignability
from the given class.
- Parameters:
cacheEntryFactoryClass
the class from which to test assignability- Returns:
- whether the given class is assignable from any factory in the chain
A wrapper CacheEntryFactory, for delegating cache entry creation along a chain.
The CacheEntryFactory being wrapped.
Construct a new WrapperCacheEntryFactory using the given CacheEntryFactory as
the "previous" wrapped factory.
- Parameters:
previous
the wrapped factory
if (method != null) return method;