FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix metaclass dispatch missing meta-metaclass methods by sampokuokkanen · Pull Request #9446 · jruby/jruby · GitHub

/ jruby Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (1) .txt  (1) All 2 file types selected
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/RubyBasicObject.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Back | FazBrowse Home | New Git URL