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: be2d492f0f1f
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f83c032e6bc1
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Jul 19, 2016

  1. Copy the full SHA
    3972ef1 View commit details
  2. Copy the full SHA
    fd8e7ac View commit details
  3. re-arranged imports + one liner

    kares committed Jul 19, 2016
    Copy the full SHA
    f83c032 View commit details
35 changes: 17 additions & 18 deletions core/src/main/java/org/jruby/RubyClass.java
Original file line number Diff line number Diff line change
@@ -506,10 +506,6 @@ public IRubyObject invoke(ThreadContext context, IRubyObject self, int methodInd
return invoke(context, self, name, args, callType, block);
}

public boolean notVisibleAndNotMethodMissing(DynamicMethod method, String name, IRubyObject caller, CallType callType) {
return !method.isCallableFrom(caller, callType) && !name.equals("method_missing");
}

public IRubyObject invoke(ThreadContext context, IRubyObject self, String name,
CallType callType, Block block) {
DynamicMethod method = searchMethod(name);
@@ -824,14 +820,19 @@ private void generateMethodAnnotations(Map<Class, Map<String, Object>> methodAnn
}
}

private boolean shouldCallMethodMissing(DynamicMethod method) {
private static boolean shouldCallMethodMissing(DynamicMethod method) {
return method.isUndefined();
}
private boolean shouldCallMethodMissing(DynamicMethod method, String name, IRubyObject caller, CallType callType) {

private static boolean shouldCallMethodMissing(DynamicMethod method, String name, IRubyObject caller, CallType callType) {
return method.isUndefined() || notVisibleAndNotMethodMissing(method, name, caller, callType);
}

public IRubyObject invokeInherited(ThreadContext context, IRubyObject self, IRubyObject subclass) {
private static boolean notVisibleAndNotMethodMissing(DynamicMethod method, String name, IRubyObject caller, CallType callType) {
return !method.isCallableFrom(caller, callType) && !name.equals("method_missing");
}

public final IRubyObject invokeInherited(ThreadContext context, IRubyObject self, IRubyObject subclass) {
DynamicMethod method = getMetaClass().searchMethod("inherited");

if (method.isUndefined()) {
@@ -952,20 +953,18 @@ protected void setModuleSuperClass(RubyClass superClass) {
setSuperClass(superClass);
}

public Collection<RubyClass> subclasses(boolean includeDescendants) {
Set<RubyClass> mySubclasses = subclasses;
if (mySubclasses != null) {
Collection<RubyClass> mine = new ArrayList<RubyClass>(mySubclasses);
public final Collection<RubyClass> subclasses(boolean includeDescendants) {
final Set<RubyClass> subclasses = this.subclasses;
if (subclasses != null) {
Collection<RubyClass> classes = new ArrayList<RubyClass>(subclasses);
if (includeDescendants) {
for (RubyClass i: mySubclasses) {
mine.addAll(i.subclasses(includeDescendants));
for ( RubyClass klass: subclasses ) {
classes.addAll(klass.subclasses(includeDescendants));
}
}

return mine;
} else {
return Collections.EMPTY_LIST;
return classes;
}
return Collections.EMPTY_LIST;
}

/**
@@ -1015,7 +1014,7 @@ public synchronized void replaceSubclass(RubyClass subclass, RubyClass newSubcla
}
}

public void becomeSynchronized() {
public final void becomeSynchronized() {
// make this class and all subclasses sync
synchronized (getRuntime().getHierarchyLock()) {
super.becomeSynchronized();
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/RubyGC.java
Original file line number Diff line number Diff line change
@@ -36,10 +36,11 @@
import org.jruby.anno.JRubyModule;
import org.jruby.common.IRubyWarnings.ID;
import org.jruby.runtime.ThreadContext;
import static org.jruby.runtime.Visibility.*;
import static org.jruby.CompatVersion.*;
import org.jruby.runtime.builtin.IRubyObject;

import static org.jruby.CompatVersion.*;
import static org.jruby.runtime.Visibility.*;

/**
* GC (Garbage Collection) Module
*
@@ -120,7 +121,6 @@ public static IRubyObject count(ThreadContext context, IRubyObject recv) {
}

private static void emptyImplementationWarning(Ruby runtime, ID id, String name) {
runtime.getWarnings().warnOnce(id,
name + " does nothing on JRuby");
runtime.getWarnings().warnOnce(id, name + " does nothing on JRuby");
}
}
9 changes: 3 additions & 6 deletions core/src/main/java/org/jruby/RubyRange.java
Original file line number Diff line number Diff line change
@@ -399,11 +399,9 @@ public IRubyObject to_a(ThreadContext context, final Block block) {
final Ruby runtime = context.runtime;

if (begin instanceof RubyFixnum && end instanceof RubyFixnum) {
long lim = ((RubyFixnum) end).getLongValue();
if (!isExclusive) lim++;

long base = ((RubyFixnum) begin).getLongValue();
long size = lim - base;
long size = ((RubyFixnum) end).getLongValue() - base;
if (!isExclusive) size++;
if (size > Integer.MAX_VALUE) {
throw runtime.newRangeError("Range size too large for to_a");
}
@@ -413,9 +411,8 @@ public IRubyObject to_a(ThreadContext context, final Block block) {
array[i] = RubyFixnum.newFixnum(runtime, base + i);
}
return RubyArray.newArrayNoCopy(runtime, array);
} else {
return RubyEnumerable.to_a(context, this);
}
return RubyEnumerable.to_a(context, this);
}

@JRubyMethod(compat = RUBY1_8)
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -4391,8 +4391,8 @@ final IRubyObject uptoCommon19(ThreadContext context, IRubyObject arg, boolean e
RubyArray argsArr = runtime.newArrayNoCopy(args);

if (b instanceof RubyFixnum && e instanceof RubyFixnum) {
int bi = RubyNumeric.fix2int(b);
int ei = RubyNumeric.fix2int(e);
long bi = RubyNumeric.fix2long(b);
long ei = RubyNumeric.fix2long(e);

while (bi <= ei) {
if (excl && bi == ei) break;