Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ff19740fc3f5
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9e28f8800c9f
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Dec 19, 2016

  1. RubyHash's compare_by_identify Java method naming is confusing

    `Hash#compare_by_identity` is more of a writer (does call a setter)
    
    ... looks esp. weird since there's a java get/setCompareByIdentity
    kares committed Dec 19, 2016
    Copy the full SHA
    8abd0f1 View commit details

Commits on Jan 12, 2017

  1. Merge pull request #4399 from kares/confusing-naming

    RubyHash's compare_by_identify Java method naming is confusing
    kares authored Jan 12, 2017
    Copy the full SHA
    9e28f88 View commit details
Showing with 6 additions and 6 deletions.
  1. +2 −2 core/src/main/java/org/jruby/RubyHash.java
  2. +4 −4 core/src/main/java/org/jruby/java/proxies/MapJavaProxy.java
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyHash.java
Original file line number Diff line number Diff line change
@@ -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());
}

8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/java/proxies/MapJavaProxy.java
Original file line number Diff line number Diff line change
@@ -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 );
}
@@ -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