Skip to content

Commit

Permalink
Merge branch 'jruby-9.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Mar 20, 2018
2 parents cb9d8ea + 64a2452 commit b5835ad
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
10 changes: 9 additions & 1 deletion bin/jruby.bash
Expand Up @@ -20,6 +20,14 @@ case "`uname`" in
MINGW*) jruby.exe "$@"; exit $?;;
esac

# ----- Determine how to call expr (jruby/jruby#5091) -------------------------
# On Alpine linux, expr takes no -- arguments, and 'expr --' echoes '--'.
_expr_dashed=$(expr -- 2>/dev/null)
if [ "$_expr_dashed" != '--' ] ; then
alias expr="expr --"
fi
unset _expr_dashed

# ----- Verify and Set Required Environment Variables -------------------------
if [ -z "$JAVA_VM" ]; then
JAVA_VM=-client
Expand Down Expand Up @@ -244,7 +252,7 @@ do
# Match -Xa.b.c=d to translate to -Da.b.c=d as a java option
-X*)
val=${1:2}
if expr -- "$val" : '.*[.]' > /dev/null; then
if expr "$val" : '.*[.]' > /dev/null; then
java_args=("${java_args[@]}" "-Djruby.${val}")
else
ruby_args=("${ruby_args[@]}" "-X${val}")
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyFile.java
Expand Up @@ -443,7 +443,7 @@ public IRubyObject lstat(ThreadContext context) {
@JRubyMethod
public IRubyObject mtime(ThreadContext context) {
checkClosed(context);
return context.runtime.newFileStat(getPath(), false).mtime();
return ((RubyFileStat) stat(context)).mtime();
}

@JRubyMethod(meta = true)
Expand Down
14 changes: 13 additions & 1 deletion core/src/main/java/org/jruby/java/dispatch/CallableSelector.java
Expand Up @@ -22,6 +22,7 @@
import org.jruby.javasupport.JavaUtil;
import org.jruby.javasupport.ParameterTypes;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.cli.Options;
import org.jruby.util.collections.IntHashMap;
import static org.jruby.util.CodegenUtils.getBoxType;
import static org.jruby.util.CodegenUtils.prettyParams;
Expand Down Expand Up @@ -279,7 +280,18 @@ else if ( procArity < 0 && methodArity >= -(procArity + 1) ) { // *splat that fi
method = mostSpecific;

if ( ambiguous ) {
runtime.getWarnings().warn("ambiguous Java methods found, using " + ((Member) ((JavaCallable) method).accessibleObject()).getName() + prettyParams(msTypes));
if (Options.JI_AMBIGUOUS_CALLS_DEBUG.load()) {
runtime.newRuntimeError(
"multiple Java methods found, dumping backtrace and choosing "
+ ((Member) ((JavaCallable) method).accessibleObject()).getName()
+ prettyParams(msTypes)
).printStackTrace(runtime.getErr());
} else {
runtime.getWarnings().warn(
"multiple Java methods found, use -X" + Options.JI_AMBIGUOUS_CALLS_DEBUG.propertyName() + " for backtrace. Choosing "
+ ((Member) ((JavaCallable) method).accessibleObject()).getName()
+ prettyParams(msTypes));
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/util/cli/Options.java
Expand Up @@ -199,6 +199,7 @@ public class Options {
public static final Option<Boolean> JI_NEWSTYLEEXTENSION = bool(JAVA_INTEGRATION, "ji.newStyleExtension", false, "Extend Java classes without using a proxy object.");
public static final Option<Boolean> JI_OBJECTPROXYCACHE = bool(JAVA_INTEGRATION, "ji.objectProxyCache", false, "Cache Java object wrappers between calls.");
public static final Option<String> JI_PROXYCLASSFACTORY = string(JAVA_INTEGRATION, "ji.proxyClassFactory", "Allow external envs to replace JI proxy class factory");
public static final Option<Boolean> JI_AMBIGUOUS_CALLS_DEBUG = bool(JAVA_INTEGRATION, "ji.ambiguous.calls.debug", false, "Toggle verbose reporting of all ambiguous calls to Java objects");
public static final Option<Boolean> AOT_LOADCLASSES = bool(JAVA_INTEGRATION, "aot.loadClasses", false, "Look for .class before .rb to load AOT-compiled code");

public static final Option<Integer> PROFILE_MAX_METHODS = integer(PROFILING, "profile.max.methods", 100000, "Maximum number of methods to consider for profiling.");
Expand Down

0 comments on commit b5835ad

Please sign in to comment.