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

Commits on Jan 25, 2016

  1. Copy the full SHA
    9fc39a4 View commit details
  2. Copy the full SHA
    5f7551d View commit details
  3. Copy the full SHA
    fcc07a4 View commit details
  4. Copy the full SHA
    d13f91e View commit details
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/parser/ParserSupport.java
Original file line number Diff line number Diff line change
@@ -1121,7 +1121,7 @@ public ArgumentNode arg_var(String name) {
if (name == "_") {
int count = 0;
while (current.exists(name) >= 0) {
name = "_$" + count++;
name = ("_$" + count++).intern();
}
}

Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
import org.jruby.RubyFile;
import org.jruby.RubyHash;
import org.jruby.RubyString;
import org.jruby.ast.executable.Script;
import org.jruby.ir.IRScope;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.load.LoadService.SuffixType;
@@ -297,8 +296,9 @@ public void load(Ruby runtime, boolean wrap) {
}
}
runtime.getJRubyClassLoader().addURL(url);
} catch (MalformedURLException badUrl) {
runtime.newIOErrorFromException(badUrl);
}
catch (MalformedURLException badUrl) {
throw runtime.newIOErrorFromException(badUrl);
}

// If an associated Service library exists, load it as well
33 changes: 19 additions & 14 deletions core/src/main/java/org/jruby/runtime/load/LoadService.java
Original file line number Diff line number Diff line change
@@ -207,7 +207,7 @@ public LoadService(Ruby runtime) {
*
* @param prependDirectories
*/
public void init(List prependDirectories) {
public void init(List<String> prependDirectories) {
loadPath = RubyArray.newArray(runtime);

String jrubyHome = runtime.getJRubyHome();
@@ -305,7 +305,7 @@ protected void addFeatureToIndex(String shortName, String name) {
protected void addPath(String path) {
// Empty paths do not need to be added
if (path == null || path.length() == 0) return;

final RubyArray loadPath = this.loadPath;
synchronized(loadPath) {
loadPath.append(runtime.newString(path.replace('\\', '/')));
}
@@ -335,7 +335,7 @@ public void load(String file, boolean wrap) {
try {
library.load(runtime, wrap);
} catch (IOException e) {
if (runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr());
debugLoadException(runtime, e);
throw newLoadErrorFromThrowable(runtime, file, e);
}
} finally {
@@ -361,7 +361,7 @@ public void loadFromClassLoader(ClassLoader classLoader, String file, boolean wr
try {
library.load(runtime, wrap);
} catch (IOException e) {
if (runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr());
debugLoadException(runtime, e);
throw newLoadErrorFromThrowable(runtime, file, e);
}
} finally {
@@ -426,7 +426,7 @@ private RequireState requireCommon(String file, boolean circularRequireWarning)
return smartLoadInternal(file, circularRequireWarning);
}

protected final RequireLocks requireLocks = new RequireLocks();
private final RequireLocks requireLocks = new RequireLocks();

private static final class RequireLocks {
private final ConcurrentHashMap<String, ReentrantLock> pool;
@@ -610,11 +610,15 @@ public static void reflectedLoad(Ruby runtime, String libraryName, String classN
} catch (RaiseException re) {
throw re;
} catch (Throwable e) {
if (runtime.getDebug().isTrue()) e.printStackTrace();
debugLoadException(runtime, e);
throw runtime.newLoadError("library `" + libraryName + "' could not be loaded: " + e, libraryName);
}
}

private static void debugLoadException(final Ruby runtime, final Throwable ex) {
if (runtime.isDebug()) ex.printStackTrace(runtime.getErr());
}

public IRubyObject getLoadPath() {
return loadPath;
}
@@ -899,12 +903,12 @@ protected boolean tryLoadingLibraryOrScript(Ruby runtime, SearchState state) {
// allow MainExitException to propagate out for exec and friends
throw mee;
} catch (Throwable e) {
if(isJarfileLibrary(state, state.searchFile)) {
if (isJarfileLibrary(state, state.searchFile)) {
return true;
}
reraiseRaiseExceptions(e);

if(runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr());
debugLoadException(runtime, e);

RaiseException re = newLoadErrorFromThrowable(runtime, state.searchFile, e);
re.initCause(e);
@@ -933,15 +937,16 @@ private static RaiseException newLoadErrorFromThrowable(Ruby runtime, String fil
protected String buildClassName(String className) {
// Remove any relative prefix, e.g. "./foo/bar" becomes "foo/bar".
className = className.replaceFirst("^\\.\\/", "");
if (className.lastIndexOf(".") != -1) {
className = className.substring(0, className.lastIndexOf("."));
final int lastDot = className.lastIndexOf('.');
if (lastDot != -1) {
className = className.substring(0, lastDot);
}
className = className.replace("-", "_minus_").replace('.', '_');
return className;
}

protected void checkEmptyLoad(String file) throws RaiseException {
if (file.equals("")) {
if (file.isEmpty()) {
throw runtime.newLoadError("no such file to load -- " + file, file);
}
}
@@ -1355,19 +1360,19 @@ private String[] splitJarUrl(String loadPathEntry) {
// Fall back to using the original string
}

int idx = unescaped.indexOf("!");
int idx = unescaped.indexOf('!');
if (idx == -1) {
return new String[]{unescaped, ""};
}

String filename = unescaped.substring(0, idx);
String entry = idx + 2 < unescaped.length() ? unescaped.substring(idx + 2) : "";

if(filename.startsWith("jar:")) {
if (filename.startsWith("jar:")) {
filename = filename.substring(4);
}

if(filename.startsWith("file:")) {
if (filename.startsWith("file:")) {
filename = filename.substring(5);
}