Skip to content

Commit

Permalink
Java's null != Ruby's nil.
Browse files Browse the repository at this point in the history
Fixes #26.
  • Loading branch information
thedarkone committed Oct 1, 2013
1 parent 60fe301 commit fd654dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ext/org/jruby/ext/thread_safe/JRubyCacheBackendLibrary.java
Expand Up @@ -142,7 +142,7 @@ public IRubyObject compute_if_present(final ThreadContext context, final IRubyOb
IRubyObject result = map.computeIfPresent(key, new ConcurrentHashMap.BiFun<IRubyObject, IRubyObject, IRubyObject>() {
@Override
public IRubyObject apply(IRubyObject key, IRubyObject oldValue) {
IRubyObject result = block.yieldSpecific(context, oldValue);
IRubyObject result = block.yieldSpecific(context, oldValue == null ? context.getRuntime().getNil() : oldValue);
return result.isNil() ? null : result;
}
});
Expand All @@ -154,7 +154,7 @@ public IRubyObject compute(final ThreadContext context, final IRubyObject key, f
IRubyObject result = map.compute(key, new ConcurrentHashMap.BiFun<IRubyObject, IRubyObject, IRubyObject>() {
@Override
public IRubyObject apply(IRubyObject key, IRubyObject oldValue) {
IRubyObject result = block.yieldSpecific(context, oldValue);
IRubyObject result = block.yieldSpecific(context, oldValue == null ? context.getRuntime().getNil() : oldValue);
return result.isNil() ? null : result;
}
});
Expand All @@ -166,7 +166,7 @@ public IRubyObject merge_pair(final ThreadContext context, final IRubyObject key
IRubyObject result = map.merge(key, value, new ConcurrentHashMap.BiFun<IRubyObject, IRubyObject, IRubyObject>() {
@Override
public IRubyObject apply(IRubyObject oldValue, IRubyObject newValue) {
IRubyObject result = block.yieldSpecific(context, oldValue);
IRubyObject result = block.yieldSpecific(context, oldValue == null ? context.getRuntime().getNil() : oldValue);
return result.isNil() ? null : result;
}
});
Expand Down

0 comments on commit fd654dc

Please sign in to comment.