Skip to content

Commit

Permalink
* Closes jruby#1184 undefined method `__ruby_object' for interface im…
Browse files Browse the repository at this point in the history
…plementation

* Use #equals instead of == to compare the method name String objects since == will return false if the String objects have the same content, but are different instances.
  • Loading branch information
donv committed Dec 30, 2013
1 parent 9042852 commit 3cb3621
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/javasupport/Java.java
Original file line number Diff line number Diff line change
Expand Up @@ -1204,11 +1204,11 @@ public Object invoke(Object proxy, Method method, Object[] nargs) throws Throwab
int length = nargs == null ? 0 : nargs.length;

// FIXME: wtf is this? Why would these use the class?
if (methodName == "toString" && length == 0) {
if (methodName.equals("toString") && length == 0) {
return proxy.getClass().getName();
} else if (methodName == "hashCode" && length == 0) {
} else if (methodName.equals("hashCode") && length == 0) {
return Integer.valueOf(proxy.getClass().hashCode());
} else if (methodName == "equals" && length == 1) {
} else if (methodName.equals("equals") && length == 1) {
Class[] parameterTypes = (Class[]) parameterTypeCache.get(method);
if (parameterTypes == null) {
parameterTypes = method.getParameterTypes();
Expand Down

0 comments on commit 3cb3621

Please sign in to comment.