Permalink
Browse files

Don't blindly cast to JavaObject in == comparison.

  • Loading branch information...
headius committed Apr 11, 2012
1 parent 78816f0 commit 936fab6222a6fff8d92f480cc4c7d1a2cf15d8b7
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/org/jruby/javasupport/JavaObject.java
@@ -223,6 +223,8 @@ public IRubyObject same(IRubyObject other) {
return getRuntime().getTrue();
}
+ if (!(other instanceof JavaObject)) return runtime.getFalse();
+
boolean isSame = getValue() == ((JavaObject) other).getValue();
return isSame ? getRuntime().getTrue() : getRuntime().getFalse();
}

0 comments on commit 936fab6

Please sign in to comment.