Skip to content

Instantly share code, notes, and snippets.

@headius

headius/x.diff Secret

Created December 1, 2021 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/75b8f3cc4f0efdf7aff7a5e09481be81 to your computer and use it in GitHub Desktop.
Save headius/75b8f3cc4f0efdf7aff7a5e09481be81 to your computer and use it in GitHub Desktop.
diff --git a/core/src/main/java/org/jruby/IncludedModuleWrapper.java b/core/src/main/java/org/jruby/IncludedModuleWrapper.java
index 56eff97bf3..41212545df 100644
--- a/core/src/main/java/org/jruby/IncludedModuleWrapper.java
+++ b/core/src/main/java/org/jruby/IncludedModuleWrapper.java
@@ -64,7 +64,7 @@ public class IncludedModuleWrapper extends IncludedModule {
public IncludedModuleWrapper(Ruby runtime, RubyClass superClass, RubyModule origin) {
super(runtime, superClass, origin);
origin.addIncludingHierarchy(this);
- methods = origin.getMethodLocation().getMethodsForWrite();
+ methods = origin.getMethodsForWrite();
}
/**
diff --git a/core/src/main/java/org/jruby/RubyModule.java b/core/src/main/java/org/jruby/RubyModule.java
index 689316e20d..492570ce03 100644
--- a/core/src/main/java/org/jruby/RubyModule.java
+++ b/core/src/main/java/org/jruby/RubyModule.java
@@ -3605,7 +3605,8 @@ public class RubyModule extends RubyObject {
// In the current logic, if we getService here we know that module is not an
// IncludedModuleWrapper, so there's no need to fish out the delegate. But just
// in case the logic should change later, let's do it anyway
- RubyClass wrapper = new IncludedModuleWrapper(getRuntime(), insertAbove.getSuperClass(), moduleToInclude);
+ RubyModule methodLocation = moduleToInclude.getMethodLocation();
+ RubyClass wrapper = new IncludedModuleWrapper(getRuntime(), insertAbove.getSuperClass(), methodLocation);
// if the insertion point is a class, update subclass lists
if (insertAbove instanceof RubyClass) {
@@ -3624,7 +3625,7 @@ public class RubyModule extends RubyObject {
insertAbove = insertAbove.getSuperClass();
if (isRefinement()) {
- moduleToInclude.getMethods().forEach((name, method) -> addRefinedMethodEntry(name, method));
+ methodLocation.getMethods().forEach((name, method) -> addRefinedMethodEntry(name, method));
wrapper.setFlag(INCLUDED_INTO_REFINEMENT, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment