Package org.jruby
Class IncludedModuleWrapper
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyModule
org.jruby.RubyClass
org.jruby.IncludedModule
org.jruby.IncludedModuleWrapper
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IRubyObject>
,DelegatedModule
,InstanceVariables
,InternalVariables
,IRubyObject
,CoreObjectType
This class is used to provide an intermediate superclass for modules and classes that include
other modules. It inserts itself as the immediate superClass of the includer, but defers all
module methods to the actual superclass. Multiple of these intermediate superclasses can be
added for multiple included modules.
This allows the normal superclass-based searches (searchMethod, getConstant, etc) to traverse
the superclass ancestors as normal while the included modules do not actually show up in
direct inheritance traversal.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jruby.RubyClass
RubyClass.ConcreteJavaReifier, RubyClass.CS_NAMES
Nested classes/interfaces inherited from class org.jruby.RubyModule
RubyModule.Autoload, RubyModule.AutoloadMethod, RubyModule.CacheEntryFactory, RubyModule.ConstantEntry, RubyModule.InvalidatorList<T>, RubyModule.JavaClassKindOf, RubyModule.KindOf, RubyModule.MethodClumper, RubyModule.ModuleKernelMethods, RubyModule.ProfilingCacheEntryFactory, RubyModule.RefinementMethods, RubyModule.RespondToMissingMethod, RubyModule.SourceLocation, RubyModule.SynchronizedCacheEntryFactory, RubyModule.WrapperCacheEntryFactory
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer
-
Field Summary
Fields inherited from class org.jruby.IncludedModule
origin
Fields inherited from class org.jruby.RubyClass
CLASS_ALLOCATOR, CS_IDX_INITIALIZE, DEFAULT_OBJECT_MARSHAL, marshal, runtime
Fields inherited from class org.jruby.RubyModule
baseName, BUILTIN_CONSTANT, cachedMethods, CACHEPROXY_F, classIndex, generation, generationObject, id, INCLUDED_INTO_REFINEMENT, includingHierarchies, index, IS_OVERLAID_F, kindOf, methodInvalidator, methodLocation, methods, MODULE_ALLOCATOR, NEEDSIMPL_F, NormalCacheEntryFactory, OMOD_SHARED, parent, REFINED_MODULE_F, SCOPE_CAPTURING_METHODS, superClass, TEMPORARY_NAME
Fields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
Fields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, STAMP_OFFSET, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStamp
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
-
Constructor Summary
ConstructorsConstructorDescriptionIncludedModuleWrapper
(Ruby runtime, RubyClass superClass, RubyModule origin) IncludedModuleWrapper
(Ruby runtime, RubyClass superClass, RubyModule origin, RubyModule methodsHolder) -
Method Summary
Modifier and TypeMethodDescriptionprotected RubyModule.ConstantEntry
constantEntryFetch
(String name) protected IRubyObject
constantTableRemove
(String name) protected IRubyObject
constantTableStore
(String name, IRubyObject value) protected IRubyObject
constantTableStore
(String name, IRubyObject value, boolean hidden) protected IRubyObject
getAutoloadConstant
(ThreadContext context, String name, boolean forceLoad) protected Map
<String, RubyModule.Autoload> AutoloadMap must be accessed after checking ConstantMap.protected Map
<String, RubyModule.Autoload> boolean
Is this module one that in an included one (e.g.boolean
protected boolean
isSame
(RubyModule module) newIncludeClass
(RubyClass superClass) Deprecated.protected boolean
variableTableContains
(String name) Checks if the variable table contains a variable of the specified name.protected Object
variableTableFetch
(String name) Fetch an object from the variable table based on the name.protected Object
variableTableRemove
(String name) Removes the entry with the specified name from the variable table, and returning the removed value.protected Object
variableTableStore
(String name, Object value) Store a value in the variable store under the specific name.protected void
variableTableSync
(List<Variable<Object>> vars) Synchronize the variable table with the argument.Methods inherited from class org.jruby.IncludedModule
getClassVariables, getClassVariablesForRead, getName, getNonIncludedClass, getOrigin, id, isClass, isImmediate, isModule, setMetaClass
Methods inherited from class org.jruby.RubyClass
addClassAnnotation, addFieldAnnotation, addFieldSignature, addMethodAnnotation, addMethodSignature, addParameterAnnotation, addSubclass, allocate, allocate, allocator, attached_object, becomeSynchronized, checkInheritable, checkInheritable, checkMethodBasicDefinition, createBootstrapClass, finishClassClass, finishCreateClassClass, finvoke, finvoke, finvoke, finvoke, finvoke, finvoke, finvoke, finvoke, finvoke, finvoke, finvokeChecked, finvokeChecked, finvokeChecked, finvokeChecked, finvokeWithRefinements, finvokeWithRefinements, finvokeWithRefinements, finvokeWithRefinements, finvokeWithRefinements, getAllMethodSignatures, getAllocator, getBaseCallSite, getBaseCallSites, getClassAnnotations, getClassConfig, getClassRuntime, getExtraCallSites, getFFIHandleAccessorField, getFFIHandleAccessorForRead, getFFIHandleAccessorForWrite, getFieldAnnotations, getFieldSignatures, getIsReifiedExtendedJavaClass, getMarshal, getMethodAnnotations, getMethodSignatures, getNativeClassIndex, getObjectGroupAccessorField, getObjectGroupAccessorForRead, getObjectGroupAccessorForWrite, getObjectIdAccessorField, getParameterAnnotations, getPositionOrDefault, getRealClass, getRealModule, getReifiedClass, getReifiedJavaClass, getReifiedRubyClass, getSubclassesForRead, getVariableAccessorForRead, getVariableAccessorForWrite, getVariableAccessorsForRead, getVariableNames, getVariableTableCopy, getVariableTableManager, getVariableTableSize, getVariableTableSizeWithExtras, hasObjectID, inherit, inherited, initialize, initialize, initialize_copy, invalidateCacheDescendants, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeFrom, invokeInherited, invokePublic, isReifiable, isSingleton, marshal, marshal, marshalTo, marshalTo, marshalWith, nearestReifiedClass, newClass, newClass, newClass, newClass, newClass, newClass, newClass, newClass, newClassBootstrap, newInstance, newInstance, newInstance, newInstance, newInstance, newInstance, reifiedClass, reifiedClass, reify, reify, reify, reify, reifyWithAncestors, reifyWithAncestors, reifyWithAncestors, reifyWithAncestors, removeSubclass, replaceSubclass, setAllocator, setClassAllocator, setClassConfig, setMarshal, setReifiedClass, setRubyClassAllocator, setRubyStaticAllocator, smartDump, smartDump, smartLoadNewUser, smartLoadOldUser, subclasses, subclasses, subclasses, superclass, toJava, unmarshal, unmarshal, unmarshalFrom, unmarshalFrom
Methods inherited from class org.jruby.RubyModule
_module_function, _private, _protected, _public, addClassProvider, addIncludingHierarchy, addMethod, addMethod, addMethodInternal, addMethodInternal, addMethodSymbols, addMethodSymbols, addModuleFunction, addReadAttribute, addReadWriteAttribute, addToCache, addToCache, addWriteAttribute, alias_method, aliasMethod, ancestors, ancestors, append_features, append_features, attr, attr_accessor, attr_accessor, attr_reader, attr_reader, attr_writer, autoload, autoload_p, autoload_p, autoloadingValue, autoloadingValue, baseName, checkForCyclicPrepend, checkFrozen, checkValidBindTargetFrom, class_variable_defined_p, class_variable_get, class_variable_get, class_variable_get19, class_variable_set, class_variable_set, class_variable_set19, class_variables, class_variables, classIndex, cloneMethods, cloneMethods, const_added, const_defined_p, const_defined_p, const_get, const_get, const_get, const_get, const_get_1_9, const_get_2_0, const_missing, const_set, const_set, const_source_location, constants, constants, constantsCommon, constantsCommon, constantTableContains, constantTableFetch, constantTableStore, constantTableStore, constDefined, constDefined, constDefinedAt, constDefinedAt, constDefinedFrom, constDefinedFrom, define_method, define_method, define_method, defineAlias, defineAlias, defineAliases, defineAnnotatedConstant, defineAnnotatedConstants, defineAnnotatedMethod, defineAnnotatedMethod, defineAnnotatedMethod, defineAnnotatedMethod, defineAnnotatedMethod, defineAnnotatedMethods, defineAnnotatedMethodsIndividually, defineAutoload, defineAutoload, defineClassUnder, defineClassUnder, defineClassUnder, defineConstant, defineConstant, defineConstant, defineConstantBootstrap, defineConstants, defineConstantsFrom, defineMethodFromBlock, defineMethodFromCallable, defineMethods, defineModuleUnder, defineModuleUnder, defineOrGetClassUnder, defineOrGetClassUnder, defineOrGetClassUnder, defineOrGetClassUnder, defineOrGetModuleUnder, defineOrGetModuleUnder, defineOrGetModuleUnder, deleteClassVariable, deleteConstant, deleteConstant, deprecate_constant, deprecate_constant, deprecateConstant, deprecateConstant, discoverInstanceVariables, ensureClassVariablesSettable, ensureConstantsSettable, equals, exportMethod, extend_object, extend_object, extended, fastFetchClassVariable, fastFetchConstant, fastGetClass, fastGetClassVar, fastGetConstant, fastGetConstant, fastGetConstantAt, fastGetConstantFrom, fastGetConstantFromConstMissing, fastGetConstantFromNoConstMissing, fastHasClassVariable, fastHasConstant, fastIsClassVarDefined, fastIsConstantDefined, fastSetClassVar, fastSetConstant, fastStoreClassVariable, fastStoreConstant, fetchClassVariable, fetchConstant, fetchConstant, fetchConstant, fetchConstant, fetchConstantEntry, fetchConstantEntry, findImplementer, finishAutoload, finishAutoload, finishCreateModuleClass, finishModuleClass, finishRefinementClass, freeze, getAncestorList, getAutoloadConstant, getAutoloadConstant, getAutoloadConstant, getAutoloadFile, getBaseName, getCachedMethods, getCacheProxy, getCacheToken, getClass, getClass, getClassIndex, getClassVar, getClassVar, getClassVar, getClassVar, getClassVariableNameList, getClassVarQuiet, getConstant, getConstant, getConstant, getConstant, getConstant, getConstant, getConstantAt, getConstantAt, getConstantAt, getConstantAt, getConstantAtSpecial, getConstantAtSpecial, getConstantFrom, getConstantFrom, getConstantFromConstMissing, getConstantFromConstMissing, getConstantFromNoConstMissing, getConstantFromNoConstMissing, getConstantFromNoConstMissing, getConstantFromNoConstMissing, getConstantMap, getConstantMapForWrite, getConstantNames, getConstantNames, getConstantNoConstMissing, getConstantNoConstMissing, getConstantNoConstMissing, getConstantNoConstMissing, getConstantNoConstMissing, getConstantNoConstMissing, getConstantNoConstMissingSkipAutoload, getConstantNoConstMissingSkipAutoload, getConstantNoConstMissingSKipAutoload, getConstantSourceLocation, getConstantSourceLocation, getConstantWithAutoload, getConstantWithAutoload, getGeneration, getGenerationObject, getIdTest, getIncludingHierarchiesForWrite, getInvalidator, getJavaProxy, getMethodLocation, getMethods, getMethodsForWrite, getModule, getModule, getName, getParent, getRefinements, getRefinementsForWrite, getSimpleName, getSimpleName, getStoredConstantList, getStoredConstantNameList, getSuperClass, hasAncestor, hasAutoload, hasClassVariable, hasConstant, hash, hashCode, hasInternalModuleVariable, hasModuleInHierarchy, hasModuleInPrepends, hasPrepends, include, include, include, include, include_p, included, included_modules, includeModule, includeModule, initialize, instance_method, instance_method, instance_methods, instance_methods, instance_methods19, instanceMethods, instanceMethods, instanceMethods, invalidateCacheDescendants, invalidateConstantCache, invalidateConstantCache, invalidateConstantCaches, invalidateCoreClasses, isClassVarDefined, isConstantDefined, isConstantDefined, isConstantDefined, isIncludedIntoRefinement, isInstance, isKindOfModule, isMethodBound, isMethodBound, isMethodBuiltin, isRefinement, isSameOrigin, isSynchronized, isValidConstantName, isValidConstantPath, kindOf, loadPopulatorFor, marshalTo, marshalTo, method_added, method_defined_p, method_defined_p, method_removed, method_undefined, methodAdded, mix, mix, module_eval, module_eval, module_eval, module_eval, module_eval, module_exec, module_exec, module_function, name, name, needsImplementer, nesting, newActivatedRefinementsMap, newIdTest, newMethod, newMethod, newMethod, newMethod, newMethod, newMethod, newMethod, newModule, newModule, newModule, newModule, newModuleBootstrap, newRefinementsMap, newRefinementsMap, op_cmp, op_cmp, op_eqq, op_equal, op_ge, op_ge, op_gt, op_gt, op_le, op_le, op_lt, op_lt, prepend, prepend_features, prepend_features, prepended, prependModule, prependModule, prependModule, private_class_method, private_class_method, private_constant, private_constant, private_instance_methods, private_instance_methods, private_method_defined, private_method_defined, protected_instance_methods, protected_instance_methods, protected_method_defined, protected_method_defined, public_class_method, public_class_method, public_constant, public_constant, public_instance_method, public_instance_method, public_instance_methods, public_instance_methods, public_instance_methods19, public_method_defined, public_method_defined, publicConstDefinedFrom, publicConstDefinedFrom, putAlias, putAlias, putAlias, putAlias, putMethod, putMethod, rbPrivate, rbProtected, rbPublic, refine, refined_class, refinements, remove_class_variable, remove_class_variable19, remove_const, remove_method, removeClassProvider, removeClassVariable, removeClassVariable, removeMethod, resolveRefinedMethod, resolveUndefConstant, respondsToMethod, respondsToMethod, retrieveMethod, ruby2_keywords, rubyBaseName, rubyBaseName, rubyName, rubyName, searchAncestor, searchInternalModuleVariable, searchMethod, searchMethodCommon, searchMethodEntryInner, searchMethodInner, searchMethodLateral, searchWithCache, searchWithCache, searchWithRefinements, set_temporary_name, setBaseName, setCacheProxy, setClassVar, setClassVar, setConstant, setConstant, setConstant, setConstant, setConstant, setConstant, setConstantQuiet, setConstantQuiet, setConstantVisibility, setConstantVisibility, setInternalModuleVariable, setJavaProxy, setMethodLocation, setMethodVisibility, setMethodVisibility, setParent, setRefinements, setSuperClass, singleton_class_p, storeClassVariable, storeClassVariable, storeConstant, storeConstant, storeConstant, storeConstant, storeConstant, superClass, superClass, symbolName, symbolName, syncClassVariables, syncConstants, tap, target, testModuleMatch, to_s, to_s, undef, undef_method, undefined_instance_method, undefinedMethodMessage, undefineMethod, undefMethods, updateGeneration, used_modules, used_refinements, using, usingModule, usingTemporaryName, validateClassVariable, validateClassVariable, validateClassVariable, validateClassVariable, validateConstant, validateConstant, validateConstant
Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, dig, dig1, dig2, eqlInternal, equalInternal, finishObjectClass, inspect, puts, specificEval, toRubyString, toString
Methods inherited from class org.jruby.RubyBasicObject
addFinalizer, addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkStringType, cloneSetup, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, dup, dupFinalizer, dupSetup, ensureInstanceVariablesSettable, eql, eql_p, eql_p, equal_p, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, finishBasicObjectClass, forEachInstanceVariable, forEachInstanceVariableName, frozen_p, getCurrentContext, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMarshalVariableList, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hash, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, infectBy, initialize, initialize_copy, inspect, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isBuiltin, isFalse, isFrozen, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, makeMetaClass, makeMetaClassBootstrap, method, method, method, method_missing, methods, methods, nil_p, nonFixnumHashCode, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_match, op_not, op_not_equal, op_not_match, private_methods, protected_methods, public_methods, rbClone, rbClone, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method, singleton_method_added, singleton_method_removed, singleton_method_undefined, singleton_methods, singletonClass, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, trust, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableFastContains, variableTableFastFetch, variableTableFastStore, yieldUnder, yieldUnder
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, dup, marshalLiveVariables
-
Constructor Details
-
IncludedModuleWrapper
- Parameters:
runtime
- the runtimesuperClass
- the superclassorigin
- the actual module not a wrapper from a prepend or include.
-
IncludedModuleWrapper
public IncludedModuleWrapper(Ruby runtime, RubyClass superClass, RubyModule origin, RubyModule methodsHolder)
-
-
Method Details
-
newIncludeClass
Deprecated.Overridden newIncludeClass implementation to allow attaching future includes to the correct module (i.e. the one to which this is attached)- Overrides:
newIncludeClass
in classRubyModule
- Returns:
- The module wrapper
- See Also:
-
getDelegate
- Specified by:
getDelegate
in interfaceDelegatedModule
- Overrides:
getDelegate
in classRubyModule
-
isIncluded
public boolean isIncluded()Description copied from class:RubyModule
Is this module one that in an included one (e.g. anIncludedModuleWrapper
).- Overrides:
isIncluded
in classRubyModule
- See Also:
-
isPrepended
public boolean isPrepended()- Overrides:
isPrepended
in classRubyModule
-
isSame
- Overrides:
isSame
in classRubyModule
-
variableTableContains
Description copied from class:RubyBasicObject
Checks if the variable table contains a variable of the specified name.- Overrides:
variableTableContains
in classRubyBasicObject
- Parameters:
name
- to lookup- Returns:
- if contained in this object
-
variableTableFetch
Description copied from class:RubyBasicObject
Fetch an object from the variable table based on the name.- Overrides:
variableTableFetch
in classRubyBasicObject
- Parameters:
name
- to lookup- Returns:
- the object or null if not found
-
variableTableStore
Description copied from class:RubyBasicObject
Store a value in the variable store under the specific name.- Overrides:
variableTableStore
in classRubyBasicObject
- Parameters:
name
- to store invalue
- to store- Returns:
- value
-
variableTableRemove
Description copied from class:RubyBasicObject
Removes the entry with the specified name from the variable table, and returning the removed value.- Overrides:
variableTableRemove
in classRubyBasicObject
- Parameters:
name
- to remove- Returns:
- the value removed
-
variableTableSync
Description copied from class:RubyBasicObject
Synchronize the variable table with the argument. In real terms this means copy all entries into a newly allocated table.- Overrides:
variableTableSync
in classRubyBasicObject
- Parameters:
vars
- to to sync with
-
constantTableStore
- Overrides:
constantTableStore
in classRubyModule
-
constantTableStore
- Overrides:
constantTableStore
in classRubyModule
-
constantEntryFetch
- Overrides:
constantEntryFetch
in classRubyModule
-
constantTableRemove
- Overrides:
constantTableRemove
in classRubyModule
-
getAutoloadConstant
- Overrides:
getAutoloadConstant
in classRubyModule
-
getAutoloadMap
Description copied from class:RubyModule
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.- Overrides:
getAutoloadMap
in classRubyModule
-
getAutoloadMapForWrite
- Overrides:
getAutoloadMapForWrite
in classRubyModule
-