Skip to content

Commit

Permalink
Fix compilation issues under OpenJDK 7 after b142 with primitive + va…
Browse files Browse the repository at this point in the history
…rargs now resolving as ambiguous.
  • Loading branch information
headius committed Jun 9, 2011
1 parent 4380189 commit 7588393
Show file tree
Hide file tree
Showing 24 changed files with 147 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ public RubyClass defineClassUnder(String name, RubyClass superClass, ObjectAlloc

if (superClass == null) {
String className = parentIsObject ? name : parent.getName() + "::" + name;
warnings.warn(ID.NO_SUPER_CLASS, "no super class for `" + className + "', Object assumed", className);
warnings.warn(ID.NO_SUPER_CLASS, "no super class for `" + className + "', Object assumed");

superClass = objectClass;
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -2252,7 +2252,7 @@ public IRubyObject rindex(ThreadContext context, Block block) {
*/
@JRubyMethod(name = {"indexes", "indices"}, required = 1, rest = true)
public IRubyObject indexes(IRubyObject[] args) {
getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "Array#indexes is deprecated; use Array#values_at", "Array#indexes", "Array#values_at");
getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "Array#indexes is deprecated; use Array#values_at");

RubyArray ary = new RubyArray(getRuntime(), args.length);

Expand Down
6 changes: 3 additions & 3 deletions src/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,7 @@ public IRubyObject respond_to_p19(IRubyObject mname, IRubyObject includePrivate)
* Old id version. This one is bound to the "id" name and will emit a deprecation warning.
*/
public IRubyObject id_deprecated() {
getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "Object#id will be deprecated; use Object#object_id", "Object#id", "Object#object_id");
getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "Object#id will be deprecated; use Object#object_id");
return id();
}

Expand Down Expand Up @@ -2119,7 +2119,7 @@ public RubyClass type() {
* warning.
*/
public RubyClass type_deprecated() {
getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "Object#type is deprecated; use Object#class", "Object#type", "Object#class");
getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "Object#type is deprecated; use Object#class");
return type();
}

Expand Down Expand Up @@ -2594,7 +2594,7 @@ public IRubyObject to_s() {
* The default to_a method is deprecated.
*/
public RubyArray to_a() {
getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "default 'to_a' will be obsolete", "to_a");
getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "default 'to_a' will be obsolete");
return getRuntime().newArray(this);
}

Expand Down
8 changes: 4 additions & 4 deletions src/org/jruby/RubyBignum.java
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public IRubyObject op_pow(ThreadContext context, IRubyObject other) {
return op_pow(context, fixValue);
} else if (other instanceof RubyBignum) {
d = ((RubyBignum) other).getDoubleValue();
getRuntime().getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big", d);
getRuntime().getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big");
} else if (other instanceof RubyFloat) {
d = ((RubyFloat) other).getDoubleValue();
} else {
Expand All @@ -591,7 +591,7 @@ public IRubyObject op_pow(ThreadContext context, IRubyObject other) {
public IRubyObject op_pow(ThreadContext context, long other) {
// MRI issuses warning here on (RBIGNUM(x)->len * SIZEOF_BDIGITS * yy > 1024*1024)
if (((value.bitLength() + 7) / 8) * 4 * Math.abs(other) > 1024 * 1024) {
getRuntime().getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big", other);
getRuntime().getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big");
}
if (other >= 0) {
return bignorm(getRuntime(), value.pow((int) other)); // num2int is also implemented
Expand All @@ -617,7 +617,7 @@ public IRubyObject op_pow19(ThreadContext context, IRubyObject other) {
}
// MRI issuses warning here on (RBIGNUM(x)->len * SIZEOF_BDIGITS * yy > 1024*1024)
if (((value.bitLength() + 7) / 8) * 4 * Math.abs(fixValue) > 1024 * 1024) {
getRuntime().getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big", fixValue);
getRuntime().getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big");
}
if (fixValue >= 0) {
return bignorm(runtime, value.pow((int) fixValue)); // num2int is also implemented
Expand All @@ -626,7 +626,7 @@ public IRubyObject op_pow19(ThreadContext context, IRubyObject other) {
}
} else if (other instanceof RubyBignum) {
d = ((RubyBignum) other).getDoubleValue();
getRuntime().getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big", d);
getRuntime().getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big");
} else if (other instanceof RubyFloat) {
d = ((RubyFloat) other).getDoubleValue();
if (this.compareTo(RubyFixnum.zero(runtime)) == -1
Expand Down
24 changes: 12 additions & 12 deletions src/org/jruby/RubyEtc.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static IRubyObject getpwuid(IRubyObject recv, IRubyObject[] args) {
throw re;
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getpwuid is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getpwuid is not supported by JRuby on this platform");
}
return runtime.getNil();
}
Expand All @@ -138,7 +138,7 @@ public static IRubyObject getpwnam(IRubyObject recv, IRubyObject name) {
return setupPasswd(recv.getRuntime(), pwd);
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getpwnam is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getpwnam is not supported by JRuby on this platform");
}
return runtime.getNil();
}
Expand Down Expand Up @@ -169,7 +169,7 @@ public static IRubyObject passwd(IRubyObject recv, Block block) {
}
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.passwd is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.passwd is not supported by JRuby on this platform");
}
return runtime.getNil();
}
Expand Down Expand Up @@ -204,7 +204,7 @@ public static IRubyObject endpwent(IRubyObject recv) {
runtime.getPosix().endpwent();
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.endpwent is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.endpwent is not supported by JRuby on this platform");
}
}
return runtime.getNil();
Expand All @@ -217,7 +217,7 @@ public static IRubyObject setpwent(IRubyObject recv) {
runtime.getPosix().setpwent();
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.setpwent is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.setpwent is not supported by JRuby on this platform");
}
}
return runtime.getNil();
Expand All @@ -235,7 +235,7 @@ public static IRubyObject getpwent(IRubyObject recv) {
}
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getpwent is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getpwent is not supported by JRuby on this platform");
}
return runtime.getNil();
}
Expand All @@ -256,7 +256,7 @@ public static IRubyObject getgrnam(IRubyObject recv, IRubyObject name) {
return setupGroup(runtime, grp);
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getgrnam is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getgrnam is not supported by JRuby on this platform");
}
return runtime.getNil();
}
Expand All @@ -281,7 +281,7 @@ public static IRubyObject getgrgid(IRubyObject recv, IRubyObject[] args) {
throw re;
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getgrgid is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getgrgid is not supported by JRuby on this platform");
}
return runtime.getNil();
}
Expand All @@ -294,7 +294,7 @@ public static IRubyObject endgrent(IRubyObject recv) {
runtime.getPosix().endgrent();
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.engrent is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.engrent is not supported by JRuby on this platform");
}
}
return runtime.getNil();
Expand All @@ -307,7 +307,7 @@ public static IRubyObject setgrent(IRubyObject recv) {
runtime.getPosix().setgrent();
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.setgrent is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.setgrent is not supported by JRuby on this platform");
}
}
return runtime.getNil();
Expand Down Expand Up @@ -338,7 +338,7 @@ public static IRubyObject group(IRubyObject recv, Block block) {
}
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.group is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.group is not supported by JRuby on this platform");
}
return runtime.getNil();
}
Expand All @@ -356,7 +356,7 @@ public static IRubyObject getgrent(IRubyObject recv) {
}
} catch (Exception e) {
if (runtime.getDebug().isTrue()) {
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getgrent is not supported by JRuby on this platform", e);
runtime.getWarnings().warn(ID.NOT_IMPLEMENTED, "Etc.getgrent is not supported by JRuby on this platform");
}
return runtime.getNil();
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/jruby/RubyGC.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ public static IRubyObject count(ThreadContext context, IRubyObject recv) {

private static void emptyImplementationWarning(Ruby runtime, String name) {
runtime.getWarnings().warn(ID.EMPTY_IMPLEMENTATION,
name + " does nothing on JRuby", name);
name + " does nothing on JRuby");
}
}
4 changes: 2 additions & 2 deletions src/org/jruby/RubyGlobal.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,13 @@ public NonEffectiveGlobalVariable(Ruby runtime, String name, IRubyObject value)

@Override
public IRubyObject set(IRubyObject value) {
runtime.getWarnings().warn(ID.INEFFECTIVE_GLOBAL, "warning: variable " + name + " is no longer effective; ignored", name);
runtime.getWarnings().warn(ID.INEFFECTIVE_GLOBAL, "warning: variable " + name + " is no longer effective; ignored");
return value;
}

@Override
public IRubyObject get() {
runtime.getWarnings().warn(ID.INEFFECTIVE_GLOBAL, "warning: variable " + name + " is no longer effective", name);
runtime.getWarnings().warn(ID.INEFFECTIVE_GLOBAL, "warning: variable " + name + " is no longer effective");
return runtime.getFalse();
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -859,8 +859,7 @@ public static IRubyObject newInstance(ThreadContext context, IRubyObject recv, I
String className = klass.getName();
context.getRuntime().getWarnings().warn(
ID.BLOCK_NOT_ACCEPTED,
className + "::new() does not take block; use " + className + "::open() instead",
className + "::open()");
className + "::new() does not take block; use " + className + "::open() instead");
}

return klass.newInstance(context, args, block);
Expand Down
2 changes: 1 addition & 1 deletion src/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyO

@JRubyMethod(name = "getc", module = true, visibility = PRIVATE)
public static IRubyObject getc(ThreadContext context, IRubyObject recv) {
context.getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "getc is obsolete; use STDIN.getc instead", "getc", "STDIN.getc");
context.getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "getc is obsolete; use STDIN.getc instead");
IRubyObject defin = context.getRuntime().getGlobalVariables().get("$stdin");
return defin.callMethod(context, "getc");
}
Expand Down
4 changes: 2 additions & 2 deletions src/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -2847,7 +2847,7 @@ public IRubyObject fastGetConstantFromNoConstMissing(String internedName) {
if (p == objectClass && this != objectClass) {
String badCName = getName() + "::" + internedName;
runtime.getWarnings().warn(ID.CONSTANT_BAD_REFERENCE, "toplevel constant " +
internedName + " referenced by " + badCName, badCName);
internedName + " referenced by " + badCName);
}

return value;
Expand Down Expand Up @@ -2912,7 +2912,7 @@ private IRubyObject setConstantCommon(String name, IRubyObject value, boolean wa
runtime.getLoadService().removeAutoLoadFor(getName() + "::" + name);
} else {
if (warn) {
runtime.getWarnings().warn(ID.CONSTANT_ALREADY_INITIALIZED, "already initialized constant " + name, name);
runtime.getWarnings().warn(ID.CONSTANT_ALREADY_INITIALIZED, "already initialized constant " + name);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/org/jruby/RubyRational.java
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ public IRubyObject to_f(ThreadContext context) {
long e = ne - de;

if (e > 1023 || e < -1022) {
runtime.getWarnings().warn(IRubyWarnings.ID.FLOAT_OUT_OF_RANGE, "out of Float range", getMetaClass());
runtime.getWarnings().warn(IRubyWarnings.ID.FLOAT_OUT_OF_RANGE, "out of Float range");
return runtime.newFloat(e > 0 ? Double.MAX_VALUE : 0);
}

Expand All @@ -897,7 +897,7 @@ public IRubyObject to_f(ThreadContext context) {
f = ldexp(f, e);

if (Double.isInfinite(f) || Double.isNaN(f)) {
runtime.getWarnings().warn(IRubyWarnings.ID.FLOAT_OUT_OF_RANGE, "out of Float range", getMetaClass());
runtime.getWarnings().warn(IRubyWarnings.ID.FLOAT_OUT_OF_RANGE, "out of Float range");
}

return runtime.newFloat(f);
Expand Down
15 changes: 6 additions & 9 deletions src/org/jruby/RubyStringScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public IRubyObject clear(ThreadContext context) {
check();
Ruby runtime = context.getRuntime();
if (runtime.isVerbose()) {
runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#clear is obsolete; use #terminate instead", "StringScanner#clear", "#terminate");
runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#clear is obsolete; use #terminate instead");
}
return terminate();
}
Expand Down Expand Up @@ -338,8 +338,7 @@ public IRubyObject getbyte(ThreadContext context) {
Ruby runtime = context.getRuntime();
if (runtime.isVerbose()) {
runtime.getWarnings().warning(ID.DEPRECATED_METHOD,
"StringScanner#getbyte is obsolete; use #get_byte instead",
"StringScanner#getbyte", "#get_byte");
"StringScanner#getbyte is obsolete; use #get_byte instead");
}
return get_byte(context);
}
Expand All @@ -365,8 +364,7 @@ public IRubyObject peep(ThreadContext context, IRubyObject length) {
Ruby runtime = context.getRuntime();
if (runtime.isVerbose()) {
runtime.getWarnings().warning(
ID.DEPRECATED_METHOD, "StringScanner#peep is obsolete; use #peek instead",
"StringScanner#peep", "#peek");
ID.DEPRECATED_METHOD, "StringScanner#peep is obsolete; use #peek instead");
}
return peek(context, length);
}
Expand Down Expand Up @@ -405,7 +403,7 @@ public RubyBoolean eos_p(ThreadContext context) {
public RubyBoolean empty_p(ThreadContext context) {
Ruby runtime = context.getRuntime();
if (runtime.isVerbose()) {
runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#empty? is obsolete; use #eos? instead", "StringScanner#empty?", "#eos?");
runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#empty? is obsolete; use #eos? instead");
}
return eos_p(context);
}
Expand Down Expand Up @@ -440,8 +438,7 @@ public IRubyObject matched_size() {
public IRubyObject matchedsize(ThreadContext context) {
Ruby runtime = context.getRuntime();
if (runtime.isVerbose()) {
runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#matchedsize is obsolete; use #matched_size instead",
"StringScanner#matchedize", "#matched_size");
runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#matchedsize is obsolete; use #matched_size instead");
}
return matched_size();
}
Expand Down Expand Up @@ -500,7 +497,7 @@ public RubyFixnum rest_size() {
public RubyFixnum restsize(ThreadContext context) {
Ruby runtime = context.getRuntime();
if (runtime.isVerbose()) {
runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#restsize is obsolete; use #rest_size instead", "StringScanner#restsize", "#rest_size");
runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#restsize is obsolete; use #rest_size instead");
}
return rest_size();
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/jruby/RubyStruct.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public static RubyClass newInstance(IRubyObject recv, IRubyObject[] args, Block
IRubyObject type = superClass.getConstantAt(name);
if (type != null) {
ThreadContext context = runtime.getCurrentContext();
runtime.getWarnings().warn(ID.STRUCT_CONSTANT_REDEFINED, context.getFile(), context.getLine(), "redefining constant Struct::" + name, name);
runtime.getWarnings().warn(ID.STRUCT_CONSTANT_REDEFINED, context.getFile(), context.getLine(), "redefining constant Struct::" + name);
superClass.remove_const(context, runtime.newString(name));
}
newStruct = superClass.defineClassUnder(name, superClass, STRUCT_INSTANCE_ALLOCATOR);
Expand Down
4 changes: 2 additions & 2 deletions src/org/jruby/ast/DefnNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
String name = getName();

if (containingClass == runtime.getObject() && name == "initialize") {
runtime.getWarnings().warn(ID.REDEFINING_DANGEROUS, "redefining Object#initialize may cause infinite loop", "Object#initialize");
runtime.getWarnings().warn(ID.REDEFINING_DANGEROUS, "redefining Object#initialize may cause infinite loop");
}

if (name == "__id__" || name == "__send__") {
runtime.getWarnings().warn(ID.REDEFINING_DANGEROUS, "redefining `" + name + "' may cause serious problem", name);
runtime.getWarnings().warn(ID.REDEFINING_DANGEROUS, "redefining `" + name + "' may cause serious problem");
}

Visibility visibility = context.getCurrentVisibility();
Expand Down

0 comments on commit 7588393

Please sign in to comment.