Skip to content

Commit

Permalink
Merge pull request #4399 from kares/confusing-naming
Browse files Browse the repository at this point in the history
RubyHash's compare_by_identify Java method naming is confusing
  • Loading branch information
kares committed Jan 12, 2017
2 parents ff19740 + 8abd0f1 commit 9e28f88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyHash.java
Expand Up @@ -1865,14 +1865,14 @@ public IRubyObject flatten(ThreadContext context, IRubyObject level) {
}

@JRubyMethod(name = "compare_by_identity")
public IRubyObject getCompareByIdentity(ThreadContext context) {
public IRubyObject compare_by_identity(ThreadContext context) {
modify();
setComparedByIdentity(true);
return rehash();
}

@JRubyMethod(name = "compare_by_identity?")
public IRubyObject getCompareByIdentity_p(ThreadContext context) {
public IRubyObject compare_by_identity_p(ThreadContext context) {
return context.runtime.newBoolean(isComparedByIdentity());
}

Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/java/proxies/MapJavaProxy.java
Expand Up @@ -293,7 +293,7 @@ public RubyHash rehash() {
}

@Override
public RubyBoolean getCompareByIdentity_p(ThreadContext context) {
public RubyBoolean compare_by_identity_p(ThreadContext context) {
// NOTE: obviously little we can do to detect - but at least report Java built-in one :
return context.runtime.newBoolean( mapDelegate() instanceof java.util.IdentityHashMap );
}
Expand Down Expand Up @@ -770,13 +770,13 @@ public IRubyObject flatten(ThreadContext context, IRubyObject level) {
}

@JRubyMethod(name = "compare_by_identity")
public IRubyObject getCompareByIdentity(ThreadContext context) {
public IRubyObject compare_by_identity(ThreadContext context) {
return this; // has no effect - mostly for compatibility
}

@JRubyMethod(name = "compare_by_identity?")
public IRubyObject getCompareByIdentity_p(ThreadContext context) {
return getOrCreateRubyHashMap().getCompareByIdentity_p(context);
public IRubyObject compare_by_identity_p(ThreadContext context) {
return getOrCreateRubyHashMap().compare_by_identity_p(context);
}

@Override
Expand Down

0 comments on commit 9e28f88

Please sign in to comment.