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

Commits on Nov 21, 2016

  1. Copy the full SHA
    d47207b View commit details
  2. More tweaks for Fixnum/Bignum deletion.

    * Remove Bignum class.
    * Deprecate Fixnum and Bignum constants.
    headius committed Nov 21, 2016
    Copy the full SHA
    f39eb3e View commit details

Commits on Nov 22, 2016

  1. Copy the full SHA
    b3b5d11 View commit details
10 changes: 3 additions & 7 deletions core/src/main/java/org/jruby/RubyBignum.java
Original file line number Diff line number Diff line change
@@ -54,15 +54,11 @@
@JRubyClass(name="Bignum", parent="Integer")
public class RubyBignum extends RubyInteger {
public static RubyClass createBignumClass(Ruby runtime) {
RubyClass bignum = runtime.defineClass("Bignum", runtime.getInteger(),
ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
RubyClass bignum = runtime.getInteger();
runtime.getObject().setConstant("Bignum", bignum);
runtime.getObject().deprecateConstant(runtime, "Bignum");
runtime.setBignum(bignum);

bignum.setClassIndex(ClassIndex.BIGNUM);
bignum.setReifiedClass(RubyBignum.class);

bignum.defineAnnotatedMethods(RubyBignum.class);

return bignum;
}

1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/RubyFixnum.java
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@ public class RubyFixnum extends RubyInteger implements Constantizable {
public static RubyClass createFixnumClass(Ruby runtime) {
RubyClass fixnum = runtime.getInteger();
runtime.getObject().setConstant("Fixnum", fixnum);
runtime.getObject().deprecateConstant(runtime, "Fixnum");
runtime.setFixnum(fixnum);

for (int i = 0; i < runtime.fixnumCache.length; i++) {
Original file line number Diff line number Diff line change
@@ -184,7 +184,10 @@ private List<Variable<Object>> getVariables(IRubyObject value) throws IOExceptio
break;
}

if (nativeClassIndex != value.getMetaClass().getClassIndex() && nativeClassIndex != ClassIndex.STRUCT) {
if (nativeClassIndex != value.getMetaClass().getClassIndex() &&
nativeClassIndex != ClassIndex.STRUCT &&
nativeClassIndex != ClassIndex.FIXNUM &&
nativeClassIndex != ClassIndex.BIGNUM) {
// object is a custom class that extended one of the native types other than Object
writeUserClass(value, type);
}
28 changes: 16 additions & 12 deletions core/src/main/java/org/jruby/util/Sprintf.java
Original file line number Diff line number Diff line change
@@ -672,21 +672,25 @@ else if ((flags & FLAG_MINUS) != 0) {
// we'll use Java's numeric formatting code (and our own).
boolean zero;
if (type == ClassIndex.INTEGER) {
negative = ((RubyFixnum)arg).getLongValue() < 0;
zero = ((RubyFixnum)arg).getLongValue() == 0;
if (negative && fchar == 'u') {
bytes = getUnsignedNegativeBytes((RubyFixnum)arg);
if (arg instanceof RubyFixnum) {
negative = ((RubyFixnum) arg).getLongValue() < 0;
zero = ((RubyFixnum) arg).getLongValue() == 0;
if (negative && fchar == 'u') {
bytes = getUnsignedNegativeBytes((RubyFixnum) arg);
} else {
bytes = getFixnumBytes((RubyFixnum) arg, base, sign, fchar == 'X');
}
} else {
bytes = getFixnumBytes((RubyFixnum)arg,base,sign,fchar=='X');
negative = ((RubyBignum) arg).getValue().signum() < 0;
zero = ((RubyBignum) arg).getValue().equals(BigInteger.ZERO);
if (negative && fchar == 'u' && usePrefixForZero) {
bytes = getUnsignedNegativeBytes((RubyBignum) arg);
} else {
bytes = getBignumBytes((RubyBignum) arg, base, sign, fchar == 'X');
}
}
} else {
negative = ((RubyBignum)arg).getValue().signum() < 0;
zero = ((RubyBignum)arg).getValue().equals(BigInteger.ZERO);
if (negative && fchar == 'u' && usePrefixForZero) {
bytes = getUnsignedNegativeBytes((RubyBignum)arg);
} else {
bytes = getBignumBytes((RubyBignum)arg,base,sign,fchar=='X');
}
throw runtime.newTypeError(arg, runtime.getInteger());
}
if ((flags & FLAG_SHARP) != 0) {
if (!zero || usePrefixForZero) {