| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Set new singleton's metaClass to its parent's eigenclass instead of the parent's regular metaclass. Matches MRI's ENSURE_EIGENCLASS in class.c make_metaclass.
|
|
||
| klass.setMetaClass(superClass.getRealClass().metaClass); | ||
| // MRI: SET_METACLASS_OF(metaclass, ENSURE_EIGENCLASS(tmp)) | ||
| RubyClass effectiveSuper = superClass.isIncluded() ? superClass.getRealClass() : superClass; |
There was a problem hiding this comment.
not sure I follow, is the included check really needed?
Sorry, something went wrong.
There was a problem hiding this comment.
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?
Sorry, something went wrong.
There was a problem hiding this comment.
Without it on boot:
java.lang.UnsupportedOperationException: An included class is only a wrapper for a module
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
The sample code from #287 still errors on JRuby master:
This is because currently in master the code is stripping away singleton classes and not creating a singleton class in case one is missing.
So skip the wrapper with isIncluded() and use singletonClass(context) to get the correct eigenclass.
This lets us drop spec/tags/ruby/language/metaclass_tags.txt, but the MRI tests are still failing since they go one step further (meta-meta-meta tier, blows up on line 160), and with meta-meta classes there is still an issue there with how they are handled (see MetaClass.java:109, can't just fix it as it leads to a stack overflow with the same shape of fix as I did on line 542)