Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,9 @@ public RubyClass makeMetaClass(ThreadContext context, RubyClass superClass) {
MetaClass klass = new MetaClass(context.runtime, superClass, this); // rb_class_boot
setMetaClass(klass);

klass.setMetaClass(superClass.getRealClass().metaClass);
// MRI: SET_METACLASS_OF(metaclass, ENSURE_EIGENCLASS(tmp))
RubyClass effectiveSuper = superClass.isIncluded() ? superClass.getRealClass() : superClass;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I follow, is the included check really needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While writing this I first thought we wouldn't need the check, but the code didn't work without it. Turns out we can get a BlankSlateWrapper here instead of the actual module (from JavaPackage.createJavaPackageClass).

Should I add // unwrap IncludedModuleWrapper (e.g. BlankSlateWrapper from JavaPackage) as an inline comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without it on boot:
java.lang.UnsupportedOperationException: An included class is only a wrapper for a module

klass.setMetaClass(effectiveSuper.singletonClass(context));

return klass;
}
Expand Down
1 change: 0 additions & 1 deletion spec/tags/ruby/language/metaclass_tags.txt

This file was deleted.

Loading