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

Commits on Aug 18, 2017

  1. Copy the full SHA
    3bf9d77 View commit details
  2. Copy the full SHA
    f83a55f View commit details
29 changes: 16 additions & 13 deletions core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
@@ -1151,29 +1151,32 @@ public RubyArray transpose() {
/** rb_values_at (internal)
*
*/
private final IRubyObject values_at(long olen, IRubyObject[] args) {
private final IRubyObject values_at(final int olen, IRubyObject[] args) {
RubyArray result = newArray(getRuntime(), args.length);

for (int i = 0; i < args.length; i++) {
if (args[i] instanceof RubyFixnum) {
result.append(entry(((RubyFixnum)args[i]).getLongValue()));
final IRubyObject arg = args[i];
if ( arg instanceof RubyFixnum ) {
result.append( entry(((RubyFixnum) arg).getLongValue()) );
continue;
}

long beglen[];
if (!(args[i] instanceof RubyRange)) {
} else if ((beglen = ((RubyRange) args[i]).begLen(olen, 0)) == null) {
final int[] begLen;
if ( ! ( arg instanceof RubyRange ) ) {
// do result.append
}
else if ( ( begLen = ((RubyRange) arg).begLenInt(olen, 0) ) == null ) {
continue;
} else {
int beg = (int) beglen[0];
int len = (int) beglen[1];
int end = len;
for (int j = 0; j < end; j++) {
result.append(entry(j + beg));
}
else {
final int beg = begLen[0];
final int len = begLen[1];
for (int j = 0; j < len; j++) {
result.append( entry(j + beg) );
}
continue;
}
result.append(entry(RubyNumeric.num2long(args[i])));
result.append( entry(RubyNumeric.num2long(arg)) );
}

Helpers.fillNil(result.values, result.realLength, result.values.length, getRuntime());
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/runtime/ThreadContext.java
Original file line number Diff line number Diff line change
@@ -1122,7 +1122,7 @@ public void startProfiling() {
isProfiling = true;
// use new profiling data every time profiling is started, useful in
// case users keep a reference to previous data after profiling stop
profileCollection = getRuntime().getProfilingService().newProfileCollection( this );
profileCollection = runtime.getProfilingService().newProfileCollection( this );
}

public void stopProfiling() {
@@ -1273,7 +1273,7 @@ public void setFile(String file) {

@Deprecated
public org.jruby.util.RubyDateFormat getRubyDateFormat() {
if (dateFormat == null) dateFormat = new org.jruby.util.RubyDateFormat("-", Locale.US, true);
if (dateFormat == null) dateFormat = new org.jruby.util.RubyDateFormat("-", Locale.US);

return dateFormat;
}
12 changes: 7 additions & 5 deletions core/src/main/java/org/jruby/util/RubyDateFormat.java
Original file line number Diff line number Diff line change
@@ -51,8 +51,7 @@
public class RubyDateFormat extends DateFormat {
private static final long serialVersionUID = -250429218019023997L;

private boolean ruby_1_9;
private List<Token> compiledPattern;
private final List<Token> compiledPattern;

private final DateFormatSymbols formatSymbols;

@@ -169,15 +168,18 @@ public RubyDateFormat(String pattern, Locale aLocale) {
this(pattern, new DateFormatSymbols(aLocale));
}

/**
* @deprecated
*/
public RubyDateFormat(String pattern, Locale aLocale, boolean ruby_1_9) {
this(pattern, aLocale);
this.ruby_1_9 = ruby_1_9;
}

public RubyDateFormat(String pattern, DateFormatSymbols formatSymbols) {
super();

this.formatSymbols = formatSymbols;
this.compiledPattern = new LinkedList<>();
applyPattern(pattern);
}

@@ -190,7 +192,7 @@ public void applyPattern(String pattern, boolean dateLibrary) {
}

private void compilePattern(String pattern, boolean dateLibrary) {
compiledPattern = new LinkedList<Token>();
compiledPattern.clear();

int len = pattern.length();
boolean ignoredModifier = false;
@@ -637,7 +639,7 @@ public StringBuffer format(Date ignored, StringBuffer toAppendTo, FieldPosition
case FORMAT_MILLISEC:
case FORMAT_NANOSEC:
value = dt.getMillisOfSecond() * 1000000;
if (ruby_1_9) value += nsec;
value += nsec;
output = TimeOutputFormatter.formatNumber(value, 9, '0');

int defaultWidth = (format == FORMAT_NANOSEC) ? 9 : 3;