Skip to content

Instantly share code, notes, and snippets.

@cheald
Created November 10, 2014 19:42
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 cheald/fcfdca12a0452925e933 to your computer and use it in GitHub Desktop.
Save cheald/fcfdca12a0452925e933 to your computer and use it in GitHub Desktop.
--- a/core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
+++ b/core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
@@ -1153,7 +1153,7 @@ public class IRRuntimeHelpers {
throw context.runtime.newTypeError("can't define singleton method \"" + method.getName() + "\" for " + obj.getMetaClass().getBaseName());
}
- if (obj.isFrozen()) throw context.runtime.newFrozenError("object");
+ if (obj.isFrozen() && (obj.getSingletonClass() != obj.getMetaClass())) throw context.runtime.newFrozenError("object");
return obj.getSingletonClass();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment