diff --git a/core/src/main/java/org/jruby/AbstractRubyMethod.java b/core/src/main/java/org/jruby/AbstractRubyMethod.java index 3bb1289bee2..5237ea5e0da 100644 --- a/core/src/main/java/org/jruby/AbstractRubyMethod.java +++ b/core/src/main/java/org/jruby/AbstractRubyMethod.java @@ -77,11 +77,6 @@ public RubyFixnum arity() { return getRuntime().newFixnum(method.getSignature().arityValue()); } - @Deprecated - public final IRubyObject op_eql19(ThreadContext context, IRubyObject other) { - return op_eql(context, other); - } - @JRubyMethod(name = "eql?") public IRubyObject op_eql(ThreadContext context, IRubyObject other) { return RubyBoolean.newBoolean(context, equals(other) ); diff --git a/core/src/main/java/org/jruby/RubyArgsFile.java b/core/src/main/java/org/jruby/RubyArgsFile.java index 94412a9cf1b..28051128da4 100644 --- a/core/src/main/java/org/jruby/RubyArgsFile.java +++ b/core/src/main/java/org/jruby/RubyArgsFile.java @@ -587,21 +587,11 @@ public static IRubyObject lines(ThreadContext context, IRubyObject recv, IRubyOb return each_line(context, recv, args, block); } - @Deprecated - public static IRubyObject each_line19(final ThreadContext context, IRubyObject recv, IRubyObject[] args, final Block block) { - return each_line(context, recv, args, block); - } - @JRubyMethod(name = "each", optional = 1, checkArity = false) public static IRubyObject each(final ThreadContext context, IRubyObject recv, IRubyObject[] args, final Block block) { return block.isGiven() ? each_line(context, recv, args, block) : enumeratorize(context.runtime, recv, "each", args); } - @Deprecated - public static IRubyObject each19(final ThreadContext context, IRubyObject recv, IRubyObject[] args, final Block block) { - return each(context, recv, args, block); - } - @JRubyMethod(name = "file") public static IRubyObject file(ThreadContext context, IRubyObject recv) { ArgsFileData data = ArgsFileData.getArgsFileData(context.runtime); diff --git a/core/src/main/java/org/jruby/RubyArray.java b/core/src/main/java/org/jruby/RubyArray.java index 25128b9398e..b991f3b5554 100644 --- a/core/src/main/java/org/jruby/RubyArray.java +++ b/core/src/main/java/org/jruby/RubyArray.java @@ -41,7 +41,6 @@ import java.io.IOException; import java.lang.reflect.Array; import java.math.BigInteger; -import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.Collection; @@ -59,7 +58,6 @@ import org.jruby.ast.util.ArgsUtil; import org.jruby.common.IRubyWarnings.ID; import org.jruby.exceptions.RaiseException; -import org.jruby.exceptions.RangeError; import org.jruby.java.util.ArrayUtils; import org.jruby.javasupport.JavaUtil; import org.jruby.runtime.Arity; @@ -811,11 +809,6 @@ public boolean includesByEql(ThreadContext context, IRubyObject item) { return false; } - @Deprecated - public RubyFixnum hash19(ThreadContext context) { - return hash(context); - } - @Override public RubyFixnum hash() { return hash(metaClass.runtime.getCurrentContext()); @@ -1141,11 +1134,6 @@ public IRubyObject insert(IRubyObject arg) { return this; } - @Deprecated - public IRubyObject insert19(IRubyObject arg) { - return insert(arg); - } - @JRubyMethod(name = "insert") public IRubyObject insert(IRubyObject arg1, IRubyObject arg2) { modifyCheck(); @@ -1167,11 +1155,6 @@ else if (pos < 0) { spliceOne(pos, val); // rb_ary_new4 } - @Deprecated - public IRubyObject insert19(IRubyObject arg1, IRubyObject arg2) { - return insert(arg1, arg2); - } - @JRubyMethod(name = "insert", required = 1, rest = true, checkArity = false) public IRubyObject insert(IRubyObject[] args) { final Ruby runtime = metaClass.runtime; @@ -1199,11 +1182,6 @@ public IRubyObject insert(IRubyObject[] args) { return this; } - @Deprecated - public IRubyObject insert19(IRubyObject[] args) { - return insert(args); - } - /** rb_ary_transpose * */ @@ -1477,11 +1455,6 @@ public RubyArray push(IRubyObject[] items) { return this; } - @Deprecated - public RubyArray push_m19(IRubyObject[] items) { - return push(items); - } - /** rb_ary_pop * */ @@ -1545,11 +1518,6 @@ public IRubyObject unshift() { return this; } - @Deprecated - public IRubyObject unshift19() { - return unshift(); - } - /** rb_ary_unshift * */ @@ -1577,11 +1545,6 @@ public IRubyObject unshift(IRubyObject item) { return this; } - @Deprecated - public IRubyObject unshift19(IRubyObject item) { - return unshift(item); - } - @JRubyMethod(name = "unshift", alias = "prepend", rest = true) public IRubyObject unshift(IRubyObject[] items) { unpack(); @@ -1604,11 +1567,6 @@ public IRubyObject unshift(IRubyObject[] items) { return this; } - @Deprecated - public IRubyObject unshift19(IRubyObject[] items) { - return unshift(items); - } - /** rb_ary_includes * */ @@ -1659,11 +1617,6 @@ public IRubyObject aref(ThreadContext context, IRubyObject arg0) { } } - @Deprecated - public IRubyObject aref19(IRubyObject arg0) { - return aref(getRuntime().getCurrentContext(), arg0); - } - private IRubyObject arefCommon(IRubyObject arg0) { Ruby runtime = metaClass.runtime; @@ -1689,11 +1642,6 @@ public IRubyObject aref(IRubyObject arg0, IRubyObject arg1) { return arefCommon(arg0, arg1); } - @Deprecated - public IRubyObject aref19(IRubyObject arg0, IRubyObject arg1) { - return aref(arg0, arg1); - } - private IRubyObject arefCommon(IRubyObject arg0, IRubyObject arg1) { long beg = RubyNumeric.num2long(arg0); if (beg < 0) beg += realLength; @@ -1756,11 +1704,6 @@ private void asetFallback(IRubyObject arg0, IRubyObject arg1) { } } - @Deprecated - public IRubyObject aset19(IRubyObject arg0, IRubyObject arg1) { - return aset(arg0, arg1); - } - /** rb_ary_aset * */ @@ -1771,11 +1714,6 @@ public IRubyObject aset(IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { return arg2; } - @Deprecated - public IRubyObject aset19(IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { - return aset(arg0, arg1, arg2); - } - /** rb_ary_at * */ @@ -1831,11 +1769,6 @@ public RubyArray concat(IRubyObject obj) { return concat(metaClass.runtime.getCurrentContext(), obj); } - @Deprecated - public RubyArray concat19(IRubyObject obj) { - return concat(obj); - } - /** inspect_ary * */ @@ -1853,7 +1786,7 @@ protected IRubyObject inspectAry(ThreadContext context) { } else { EncodingUtils.encAssociateIndex(str, s.getEncoding()); } - str.cat19(s); + str.catWithCodeRange(s); } str.cat((byte) ']'); @@ -2067,17 +2000,6 @@ public IRubyObject reverse_each(ThreadContext context, Block block) { return block.isGiven() ? reverseEach(context, block) : enumeratorizeWithSize(context, this, "reverse_each", RubyArray::size); } - /** rb_ary_join - * - */ - public IRubyObject join(ThreadContext context, IRubyObject sep) { - return join19(context, sep); - } - - public IRubyObject join(ThreadContext context) { - return join19(context); - } - // MRI: ary_join_0 protected int joinStrings(RubyString sep, int max, RubyString result) { IRubyObject first; @@ -2090,7 +2012,7 @@ protected int joinStrings(RubyString sep, int max, RubyString result) { for (i = 0; i < max; i++) { IRubyObject val = eltInternal(i); if (!(val instanceof RubyString)) break; - if (i > 0 && sep != null) result.cat19(sep); + if (i > 0 && sep != null) result.catWithCodeRange(sep); result.append(val); } } catch (ArrayIndexOutOfBoundsException e) { @@ -2108,7 +2030,7 @@ private RubyString joinAny(ThreadContext context, RubyString sep, int i, RubyStr JavaSites.CheckedSites to_ary_checked = null; for (; i < realLength; i++) { - if (i > 0 && sep != null) result.cat19(sep); + if (i > 0 && sep != null) result.catWithCodeRange(sep); IRubyObject val = eltOk(i); @@ -2139,7 +2061,7 @@ private RubyString joinAny(ThreadContext context, RubyString sep, int i, RubyStr // MRI: ary_join_1, str_join label private static void strJoin(RubyString result, RubyString val, boolean[] first) { - result.cat19(val); + result.catWithCodeRange(val); if (first[0]) { result.setEncoding(val.getEncoding()); first[0] = false; @@ -2156,11 +2078,16 @@ private void recursiveJoin(final ThreadContext context, final IRubyObject outVal context.safeRecurse(JOIN_RECURSIVE, new JoinRecursive.State(ary, outValue, sep, result, first), outValue, "join", true); } + @Deprecated + public IRubyObject join19(final ThreadContext context, IRubyObject sep) { + return join(context, sep); + } + /** rb_ary_join * */ @JRubyMethod(name = "join") - public IRubyObject join19(final ThreadContext context, IRubyObject sep) { + public IRubyObject join(final ThreadContext context, IRubyObject sep) { final Ruby runtime = context.runtime; if (sep == context.nil) { @@ -2197,9 +2124,14 @@ public IRubyObject join19(final ThreadContext context, IRubyObject sep) { return result; } - @JRubyMethod(name = "join") + @Deprecated public IRubyObject join19(ThreadContext context) { - return join19(context, getDefaultSeparator(context.runtime)); + return join(context); + } + + @JRubyMethod(name = "join") + public IRubyObject join(ThreadContext context) { + return join(context, getDefaultSeparator(context.runtime)); } private IRubyObject getDefaultSeparator(Ruby runtime) { @@ -2372,11 +2304,6 @@ public IRubyObject compact() { return ary; } - @Deprecated - public IRubyObject compact19() { - return compact(); - } - /** rb_ary_empty_p * */ @@ -3465,11 +3392,6 @@ public IRubyObject flatten_bang(ThreadContext context, IRubyObject arg) { return context.nil; } - @Deprecated - public IRubyObject flatten_bang19(ThreadContext context, IRubyObject arg) { - return flatten_bang(context, arg); - } - @JRubyMethod(name = "flatten") public IRubyObject flatten(ThreadContext context) { Ruby runtime = context.runtime; @@ -3490,16 +3412,6 @@ public IRubyObject flatten(ThreadContext context, IRubyObject arg) { return result; } - @Deprecated - public IRubyObject flatten19(ThreadContext context) { - return flatten(context); - } - - @Deprecated - public IRubyObject flatten19(ThreadContext context, IRubyObject arg) { - return flatten(context, arg); - } - @JRubyMethod(name = "count") public IRubyObject count(ThreadContext context, Block block) { if (block.isGiven()) { @@ -3579,7 +3491,7 @@ public IRubyObject op_plus(IRubyObject obj) { public IRubyObject op_times(ThreadContext context, IRubyObject times) { IRubyObject tmp = times.checkStringType(); - if (!tmp.isNil()) return join19(context, tmp); + if (!tmp.isNil()) return join(context, tmp); long len = RubyNumeric.num2long(times); Ruby runtime = context.runtime; @@ -3607,11 +3519,6 @@ public IRubyObject op_times(ThreadContext context, IRubyObject times) { return ary2; } - @Deprecated - public IRubyObject op_times19(ThreadContext context, IRubyObject times) { - return op_times(context, times); - } - /** ary_make_hash * */ @@ -3695,11 +3602,6 @@ public IRubyObject uniq_bang(ThreadContext context, Block block) { return this; } - @Deprecated - public IRubyObject uniq_bang19(ThreadContext context, Block block) { - return uniq_bang(context, block); - } - /** rb_ary_uniq * */ @@ -3729,11 +3631,6 @@ public IRubyObject uniq(ThreadContext context, Block block) { return result; } - @Deprecated - public IRubyObject uniq19(ThreadContext context, Block block) { - return uniq(context, block); - } - /** rb_ary_diff * */ @@ -3966,11 +3863,6 @@ public RubyArray sort(ThreadContext context, Block block) { return ary; } - @Deprecated - public RubyArray sort19(ThreadContext context, Block block) { - return sort(context, block); - } - /** rb_ary_sort_bang * */ @@ -3983,11 +3875,6 @@ public IRubyObject sort_bang(ThreadContext context, Block block) { return this; } - @Deprecated - public IRubyObject sort_bang19(ThreadContext context, Block block) { - return sort_bang(context, block); - } - protected IRubyObject sortInternal(final ThreadContext context, final boolean honorOverride) { try { Arrays.sort(values, begin, begin + realLength, new DefaultComparator(context, honorOverride) { @@ -4338,11 +4225,6 @@ public IRubyObject product(ThreadContext context, IRubyObject[] args, Block bloc return result; } - @Deprecated - public IRubyObject product19(ThreadContext context, IRubyObject[] args, Block block) { - return product(context, args, block); - } - /** rb_ary_combination * */ @@ -6014,16 +5896,6 @@ private static ArraySites sites(ThreadContext context) { return context.sites.Array; } - @Deprecated - public IRubyObject compatc19() { - return compact19(); - } - - @Deprecated - public final RubyArray aryDup19() { - return aryDup(); - } - /** * Increases the capacity of this Array, if necessary. * @param minCapacity the desired minimum capacity of the internal array @@ -6041,21 +5913,6 @@ public void ensureCapacity(int minCapacity) { } } - @Deprecated - public IRubyObject flatten_bang19(ThreadContext context) { - return flatten_bang(context); - } - - @Deprecated - public IRubyObject map19(ThreadContext context, Block block) { - return map(context, block); - } - - @Deprecated - public IRubyObject collect19(ThreadContext context, Block block) { - return rbCollect(context, block); - } - @Deprecated @Override public RubyArray to_a() { diff --git a/core/src/main/java/org/jruby/RubyBasicObject.java b/core/src/main/java/org/jruby/RubyBasicObject.java index 877ce763d20..8217d24d2de 100644 --- a/core/src/main/java/org/jruby/RubyBasicObject.java +++ b/core/src/main/java/org/jruby/RubyBasicObject.java @@ -226,15 +226,6 @@ public IRubyObject initialize(ThreadContext context) { return context.nil; } - @Deprecated - public IRubyObject initialize19(ThreadContext context) { - return initialize(context); - } - - //public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { - // return initialize(context); - //} - /** * Standard path for object creation. Objects are entered into ObjectSpace * only if ObjectSpace is enabled. @@ -768,15 +759,6 @@ public IRubyObject checkStringType() { return TypeConverter.checkStringType(context, sites.to_str_checked, this); } - /** - * @deprecated - * @see #checkStringType() - */ - @Override - public final IRubyObject checkStringType19() { - return checkStringType(); - } - /** rb_check_array_type * * Returns the result of trying to convert this object to an Array with "to_ary". @@ -1214,11 +1196,6 @@ public IRubyObject op_equal(ThreadContext context, IRubyObject obj) { return this == obj ? context.tru : context.fals; } - @Deprecated - public IRubyObject op_equal_19(ThreadContext context, IRubyObject obj) { - return op_equal(context, obj); - } - @Override public IRubyObject op_eqq(ThreadContext context, IRubyObject other) { // Remain unimplemented due to problems with the double java hierarchy @@ -1621,21 +1598,6 @@ public static IRubyObject singleton_method_undefined(ThreadContext context, IRub return context.nil; } - @Deprecated - public static IRubyObject singleton_method_added19(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block) { - return singleton_method_added(context, recv, symbolId, block); - } - - @Deprecated - public static IRubyObject singleton_method_removed19(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block) { - return singleton_method_removed(context, recv, symbolId, block); - } - - @Deprecated - public static IRubyObject singleton_method_undefined19(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block) { - return singleton_method_undefined(context, recv, symbolId, block); - } - @JRubyMethod(name = "method_missing", rest = true, module = true, omit = true, visibility = PRIVATE) public static IRubyObject method_missing(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { Visibility lastVis = context.getLastVisibility(); @@ -1648,11 +1610,6 @@ public static IRubyObject method_missing(ThreadContext context, IRubyObject recv return RubyKernel.methodMissingDirect(context, recv, (RubySymbol)args[0], lastVis, lastCallType, args); } - @Deprecated - public static IRubyObject method_missing19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { - return method_missing(context, recv, args, block); - } - @JRubyMethod(name = "__send__", omit = true, keywords = true) public IRubyObject send(ThreadContext context, IRubyObject arg0, Block block) { String name = RubySymbol.checkID(arg0); @@ -1969,11 +1926,6 @@ public IRubyObject equal_p(ThreadContext context, IRubyObject other) { return this == other ? context.tru : context.fals; } - @Deprecated - public IRubyObject equal_p19(ThreadContext context, IRubyObject other) { - return equal_p(context, other); - } - /** rb_obj_equal * * Just like "==" and "equal?", "eql?" will use identity equality for Object. @@ -2040,22 +1992,12 @@ public final RubyBoolean respond_to_p(IRubyObject mname) { return getRuntime().newBoolean(getMetaClass().respondsToMethod(mname.asJavaString(), true)); } - @Deprecated - public final RubyBoolean respond_to_p19(IRubyObject mname) { - return respond_to_p(getRuntime().getCurrentContext(), mname, false); - } - @Deprecated // NOTE: does not match Ruby 2.x rules (does method bound check only) public final RubyBoolean respond_to_p(IRubyObject mname, IRubyObject includePrivate) { String name = mname.asJavaString(); return getRuntime().newBoolean(getMetaClass().isMethodBound(name, !includePrivate.isTrue())); } - @Deprecated - public final RubyBoolean respond_to_p19(IRubyObject mname, IRubyObject includePrivate) { - return respond_to_p(getRuntime().getCurrentContext(), mname, includePrivate.isTrue()); - } - final RubyBoolean respond_to_p(ThreadContext context, IRubyObject methodName, final boolean includePrivate) { RubySymbol name = TypeConverter.checkID(methodName); @@ -2248,11 +2190,6 @@ public IRubyObject methods(ThreadContext context, IRubyObject... args) { return methodsImpl(context, args.length == 1 ? args[0].isTrue() : true); } - @Deprecated - public IRubyObject methods19(ThreadContext context, IRubyObject[] args) { - return methods(context, args); - } - final IRubyObject methodsImpl(ThreadContext context, final boolean all) { final RubyArray methods = RubyArray.newArray(context.runtime); final Set seen = new HashSet<>(); @@ -2288,11 +2225,6 @@ public IRubyObject public_methods(ThreadContext context, IRubyObject[] args) { return getMetaClass().instanceMethods(args, PUBLIC, true, false); } - @Deprecated - public IRubyObject public_methods19(ThreadContext context, IRubyObject[] args) { - return public_methods(context, args); - } - /** rb_obj_protected_methods * * call-seq: @@ -2309,11 +2241,6 @@ public IRubyObject protected_methods(ThreadContext context, IRubyObject[] args) return getMetaClass().instanceMethods(args, PROTECTED, true, false); } - @Deprecated - public IRubyObject protected_methods19(ThreadContext context, IRubyObject[] args) { - return protected_methods(context, args); - } - /** rb_obj_private_methods * * call-seq: @@ -2330,11 +2257,6 @@ public IRubyObject private_methods(ThreadContext context, IRubyObject[] args) { return getMetaClass().instanceMethods(args, PRIVATE, true, false); } - @Deprecated - public IRubyObject private_methods19(ThreadContext context, IRubyObject[] args) { - return private_methods(context, args); - } - /** rb_obj_singleton_methods * * call-seq: @@ -2460,11 +2382,6 @@ public IRubyObject method(IRubyObject name, StaticScope refinedScope) { return getMetaClass().newMethod(this, symbol.idString(), refinedScope, true, null, true); } - @Deprecated - public IRubyObject method19(IRubyObject name) { - return method(name); - } - /** rb_any_to_s * * call-seq: @@ -2566,23 +2483,6 @@ public IRubyObject instance_eval(ThreadContext context, IRubyObject[] args, Bloc throw context.runtime.newArgumentError(args.length, 1, 3); } - @Deprecated - public IRubyObject instance_eval19(ThreadContext context, Block block) { - return specificEval(context, getInstanceEvalClass(), block, EvalType.INSTANCE_EVAL); - } - @Deprecated - public IRubyObject instance_eval19(ThreadContext context, IRubyObject arg0, Block block) { - return specificEval(context, getInstanceEvalClass(), arg0, block, EvalType.INSTANCE_EVAL); - } - @Deprecated - public IRubyObject instance_eval19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) { - return specificEval(context, getInstanceEvalClass(), arg0, arg1, block, EvalType.INSTANCE_EVAL); - } - @Deprecated - public IRubyObject instance_eval19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) { - return specificEval(context, getInstanceEvalClass(), arg0, arg1, arg2, block, EvalType.INSTANCE_EVAL); - } - /** rb_obj_instance_exec * * call-seq: @@ -2620,11 +2520,6 @@ public IRubyObject instance_exec(ThreadContext context, IRubyObject[] args, Bloc return yieldUnder(context, klazz, args, block, EvalType.INSTANCE_EVAL); } - @Deprecated - public IRubyObject instance_exec19(ThreadContext context, IRubyObject[] args, Block block) { - return instance_exec(context, args, block); - } - /** rb_obj_extend * * call-seq: @@ -2668,49 +2563,6 @@ public IRubyObject extend(IRubyObject[] args) { return this; } - /** rb_f_send - * - * send( aSymbol [, args ]* )$ -> anObject - * - * Invokes the method identified by aSymbol, passing it any arguments - * specified. You can use __send__ if the name send clashes with an - * existing method in this object. - * - *
-     * class Klass
-     *   def hello(*args)
-     *     "Hello " + args.join(' ')
-     *   end
-     * end
-     *
-     * k = Klass.new
-     * k.send :hello, "gentle", "readers"
-     * 
- * - * @return the result of invoking the method identified by aSymbol. - */ - @Deprecated - public IRubyObject send(ThreadContext context, Block block) { - throw context.runtime.newArgumentError(0, 1); - } - @Deprecated - public IRubyObject send19(ThreadContext context, IRubyObject arg0, Block block) { - return send(context, arg0, block); - } - @Deprecated - public IRubyObject send19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) { - return send(context, arg0, arg1, block); - } - @Deprecated - public IRubyObject send19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) { - return send(context, arg0, arg1, arg2, block); - } - @Deprecated - public IRubyObject send19(ThreadContext context, IRubyObject[] args, Block block) { - if (args.length == 0) throw context.runtime.newArgumentError(0, 1); - return send(context, args, block); - } - /** rb_false * * call_seq: @@ -2886,11 +2738,6 @@ public RubyArray instance_variables(ThreadContext context) { return array; } - @Deprecated - public RubyArray instance_variables19(ThreadContext context) { - return instance_variables(context); - } - /** * This method is just a wrapper around the Ruby "==" method, * provided so that RubyObjects can be used as keys in the Java @@ -3157,11 +3004,6 @@ public synchronized Object dataGetStructChecked() { return getInternalVariable("__wrap_struct__"); } - @Deprecated - public IRubyObject op_match19(ThreadContext context, IRubyObject arg) { - return context.nil; - } - @Deprecated public RubyArray to_a() { return to_a(getRuntime().getCurrentContext()); diff --git a/core/src/main/java/org/jruby/RubyBignum.java b/core/src/main/java/org/jruby/RubyBignum.java index c7e05f077c1..08ebc536ca6 100644 --- a/core/src/main/java/org/jruby/RubyBignum.java +++ b/core/src/main/java/org/jruby/RubyBignum.java @@ -519,11 +519,6 @@ public IRubyObject op_mul(ThreadContext context, IRubyObject other) { return bignorm(context.runtime, value.multiply(((RubyBignum) other).value)); } - @Deprecated - public final IRubyObject op_mul19(ThreadContext context, IRubyObject other) { - return op_mul(context, other); - } - @Override public final IRubyObject op_mul(ThreadContext context, long other) { return bignorm(context.runtime, value.multiply(long2big(other))); @@ -669,11 +664,6 @@ IRubyObject modulo(ThreadContext context, long other) { return op_mod(context, other); } - @Deprecated - public IRubyObject op_mod19(ThreadContext context, IRubyObject other) { - return op_mod(context, other); - } - /** rb_big_remainder * */ @@ -699,11 +689,6 @@ public IRubyObject remainder(ThreadContext context, IRubyObject other) { return bignorm(context.runtime, value.remainder(otherValue)); } - @Deprecated - public IRubyObject remainder19(ThreadContext context, IRubyObject other) { - return remainder(context, other); - } - /** rb_big_quo * */ @@ -724,11 +709,6 @@ public IRubyObject quo(ThreadContext context, IRubyObject other) { } } - @Deprecated - public final IRubyObject quo19(ThreadContext context, IRubyObject other) { - return quo(context, other); - } - /** rb_big_pow * */ @@ -792,11 +772,6 @@ private void warnIfPowExponentTooBig(final ThreadContext context, final long oth } } - @Deprecated - public IRubyObject op_pow19(ThreadContext context, IRubyObject other) { - return op_pow(context, other); - } - /** rb_big_and * */ @@ -815,11 +790,6 @@ final RubyInteger op_and(ThreadContext context, RubyFixnum other) { return bignorm(context.runtime, value.and(fix2big(other))); } - @Deprecated - public IRubyObject op_and19(ThreadContext context, IRubyObject other) { - return op_and(context, other); - } - /** rb_big_or * */ @@ -843,11 +813,6 @@ public IRubyObject bit_length(ThreadContext context) { return context.runtime.newFixnum(value.bitLength()); } - @Deprecated - public IRubyObject op_or19(ThreadContext context, IRubyObject other) { - return op_or(context, other); - } - /** rb_big_xor * */ @@ -862,11 +827,6 @@ public IRubyObject op_xor(ThreadContext context, IRubyObject other) { return coerceBit(context, sites(context).checked_op_xor, other); } - @Deprecated - public IRubyObject op_xor19(ThreadContext context, IRubyObject other) { - return op_xor(context, other); - } - /** rb_big_neg * */ @@ -1207,11 +1167,6 @@ public IRubyObject eql_p(IRubyObject other) { return op_equal(metaClass.runtime.getCurrentContext(), other); } - @Deprecated - public IRubyObject eql_p19(IRubyObject other) { - return eql_p(other); - } - /** rb_big_hash * */ diff --git a/core/src/main/java/org/jruby/RubyClass.java b/core/src/main/java/org/jruby/RubyClass.java index 30db04be796..b4180c86fdb 100644 --- a/core/src/main/java/org/jruby/RubyClass.java +++ b/core/src/main/java/org/jruby/RubyClass.java @@ -2914,16 +2914,6 @@ public VariableAccessorField getObjectGroupAccessorField() { return variableTableManager.getObjectGroupAccessorField(); } - @Deprecated - public IRubyObject initialize19(ThreadContext context, Block block) { - return initialize(context, block); - } - - @Deprecated - public IRubyObject initialize19(ThreadContext context, IRubyObject superObject, Block block) { - return initialize(context, superObject, block); - } - @Deprecated public IRubyObject invokeFrom(ThreadContext context, CallType callType, IRubyObject caller, IRubyObject self, String name, Block block) { diff --git a/core/src/main/java/org/jruby/RubyComparable.java b/core/src/main/java/org/jruby/RubyComparable.java index d3f443c9f92..8ce337aaace 100644 --- a/core/src/main/java/org/jruby/RubyComparable.java +++ b/core/src/main/java/org/jruby/RubyComparable.java @@ -154,11 +154,6 @@ public static IRubyObject op_equal(ThreadContext context, IRubyObject recv, IRub return callCmpMethod(context, recv, other, context.fals); } - @Deprecated - public static IRubyObject op_equal19(ThreadContext context, IRubyObject recv, IRubyObject other) { - return op_equal(context, recv, other); - } - private static IRubyObject callCmpMethod(final ThreadContext context, final IRubyObject recv, final IRubyObject other, IRubyObject returnValueOnError) { final Ruby runtime = context.runtime; diff --git a/core/src/main/java/org/jruby/RubyComplex.java b/core/src/main/java/org/jruby/RubyComplex.java index 950aa62615d..3dcc3ceb197 100644 --- a/core/src/main/java/org/jruby/RubyComplex.java +++ b/core/src/main/java/org/jruby/RubyComplex.java @@ -413,11 +413,6 @@ public static IRubyObject polar(ThreadContext context, IRubyObject clazz, IRubyO return f_complex_polar(context, (RubyClass) clazz, abs, arg); } - @Deprecated - public static IRubyObject polar19(ThreadContext context, IRubyObject clazz, IRubyObject[] args) { - return polar(context, clazz, args); - } - /** rb_Complex1 * */ diff --git a/core/src/main/java/org/jruby/RubyConverter.java b/core/src/main/java/org/jruby/RubyConverter.java index b9662d0ee22..9ade805888b 100644 --- a/core/src/main/java/org/jruby/RubyConverter.java +++ b/core/src/main/java/org/jruby/RubyConverter.java @@ -287,12 +287,12 @@ public IRubyObject primitive_convert(ThreadContext context, IRubyObject[] args) inBytes = new ByteList(); } else { input = args[0].convertToString(); - input.modify19(); + input.modifyAndClearCodeRange(); inBytes = input.getByteList(); } output = args[1].convertToString(); - output.modify19(); + output.modifyAndClearCodeRange(); outBytes = output.getByteList(); Ptr inPtr = new Ptr(); diff --git a/core/src/main/java/org/jruby/RubyDir.java b/core/src/main/java/org/jruby/RubyDir.java index b8a35216ef5..acb0ece3c56 100644 --- a/core/src/main/java/org/jruby/RubyDir.java +++ b/core/src/main/java/org/jruby/RubyDir.java @@ -44,7 +44,6 @@ import java.util.Collections; import java.util.List; import java.util.Optional; -import java.util.regex.Pattern; import jnr.posix.FileStat; import jnr.posix.POSIX; @@ -175,11 +174,6 @@ private RubyDir initializeCommon(ThreadContext context, IRubyObject pathArg, IRu return this; } - @Deprecated - public IRubyObject initialize19(ThreadContext context, IRubyObject arg) { - return initialize(context, arg); - } - // ----- Ruby Class Methods ---------------------------------------------------- private static ArrayList dirGlobs(ThreadContext context, String cwd, IRubyObject[] args, int flags, boolean sort) { @@ -492,15 +486,16 @@ public static RubyArray children(ThreadContext context, IRubyObject recv, IRubyO return dir.children(context); } + @Deprecated + public static IRubyObject rmdir19(IRubyObject recv, IRubyObject path) { + return rmdir(recv.getRuntime().getCurrentContext(), recv, path); + } + /** * Deletes the directory specified by path. The directory must be empty. */ - public static IRubyObject rmdir(IRubyObject recv, IRubyObject path) { - return rmdir19(recv.getRuntime().getCurrentContext(), recv, path); - } - @JRubyMethod(name = {"rmdir", "unlink", "delete"}, meta = true) - public static IRubyObject rmdir19(ThreadContext context, IRubyObject recv, IRubyObject path) { + public static IRubyObject rmdir(ThreadContext context, IRubyObject recv, IRubyObject path) { Ruby runtime = context.runtime; RubyString cleanPath = StringSupport.checkEmbeddedNulls(runtime, RubyFile.get_path(context, path)); return rmdirCommon(runtime, cleanPath.asJavaString()); @@ -663,11 +658,6 @@ public static IRubyObject mkdir(IRubyObject recv, IRubyObject[] args) { return mkdir(recv.getRuntime().getCurrentContext(), recv, args); } - @Deprecated - public static IRubyObject mkdir19(ThreadContext context, IRubyObject recv, IRubyObject[] args) { - return mkdir(context, recv, args); - } - private static IRubyObject mkdirCommon(Ruby runtime, String path, IRubyObject[] args) { if (path.startsWith("uri:")) throw runtime.newErrnoEACCESError(path); @@ -732,11 +722,6 @@ public static IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObj } } - @Deprecated - public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyObject path, Block block) { - return open(context, recv, path, block); - } - // ----- Ruby Instance Methods ------------------------------------------------- /** @@ -783,16 +768,6 @@ public IRubyObject each(ThreadContext context, IRubyObject encOpts, Block block) return block.isGiven() ? each(context, encoding, block) : enumeratorize(context.runtime, this, "each", encOpts); } - @Deprecated - public IRubyObject each19(ThreadContext context, Block block) { - return each(context, block); - } - - @Deprecated - public IRubyObject each19(ThreadContext context, IRubyObject encoding, Block block) { - return each(context, encoding, block); - } - /** * Executes the block once for each child in the directory * (i.e. all the directory entries except for "." and ".."). @@ -1180,16 +1155,6 @@ public T toJava(Class target) { return super.toJava(target); } - @Deprecated - public static RubyArray entries19(ThreadContext context, IRubyObject recv, IRubyObject arg) { - return entries(context, recv, arg); - } - - @Deprecated - public static RubyArray entries19(ThreadContext context, IRubyObject recv, IRubyObject arg, IRubyObject opts) { - return entries(context, recv, arg, opts); - } - @Deprecated public static IRubyObject home(ThreadContext context, IRubyObject recv, IRubyObject[] args) { if (args.length > 0 && args[0] != context.nil) return getHomeDirectoryPath(context, args[0].toString()); @@ -1197,16 +1162,6 @@ public static IRubyObject home(ThreadContext context, IRubyObject recv, IRubyObj return getHomeDirectoryPath(context); } - @Deprecated - public static IRubyObject foreach19(ThreadContext context, IRubyObject recv, IRubyObject path, Block block) { - return foreachCommon(context, recv, RubyFile.get_path(context, path), null, block); - } - - @Deprecated - public static IRubyObject foreach19(ThreadContext context, IRubyObject recv, IRubyObject path, IRubyObject enc, Block block) { - return foreachCommon(context, recv, RubyFile.get_path(context, path), RubyHash.newKwargs(context.runtime, "encoding", enc), block); - } - @Deprecated public static RubyArray entries(IRubyObject recv, IRubyObject path) { return entries(recv.getRuntime().getCurrentContext(), recv, path); diff --git a/core/src/main/java/org/jruby/RubyEnumerator.java b/core/src/main/java/org/jruby/RubyEnumerator.java index 32b16066daa..0192c088fdf 100644 --- a/core/src/main/java/org/jruby/RubyEnumerator.java +++ b/core/src/main/java/org/jruby/RubyEnumerator.java @@ -367,14 +367,14 @@ private IRubyObject inspect(ThreadContext context, boolean recurse) { if (recurse) { return result.catString("...>"); } else { - result.cat19(RubyObject.inspect(context, object)); + result.catWithCodeRange(RubyObject.inspect(context, object)); result.cat(':'); - result.cat19(getMethod().asString()); + result.catWithCodeRange(getMethod().asString()); if (methodArgs.length > 0) { result.cat('('); for (int i= 0; i < methodArgs.length; i++) { if (methodArgsHasKeywords && i == 0) break; - result.cat19(RubyObject.inspect(context, methodArgs[i])); + result.catWithCodeRange(RubyObject.inspect(context, methodArgs[i])); if (i < methodArgs.length - 1) { result.catString(", "); } else { @@ -595,9 +595,4 @@ public IRubyObject initialize(ThreadContext context, IRubyObject[] args, Block b public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { return initialize(context, args, Block.NULL_BLOCK); } - - @Deprecated - public IRubyObject inspect19(ThreadContext context) { - return inspect(context); - } } diff --git a/core/src/main/java/org/jruby/RubyException.java b/core/src/main/java/org/jruby/RubyException.java index d4da217b55a..c93a9d29002 100644 --- a/core/src/main/java/org/jruby/RubyException.java +++ b/core/src/main/java/org/jruby/RubyException.java @@ -324,9 +324,6 @@ public IRubyObject to_s(ThreadContext context) { return context.runtime.newString(getMetaClass().getRealClass().getName()); } - @Deprecated - public IRubyObject to_s19(ThreadContext context) { return to_s(context); } - @JRubyMethod(name = "message") public IRubyObject message(ThreadContext context) { return callMethod(context, "to_s"); diff --git a/core/src/main/java/org/jruby/RubyFile.java b/core/src/main/java/org/jruby/RubyFile.java index 1bb37b7e454..ca718c1b12a 100644 --- a/core/src/main/java/org/jruby/RubyFile.java +++ b/core/src/main/java/org/jruby/RubyFile.java @@ -1268,13 +1268,14 @@ public static IRubyObject readlink(ThreadContext context, IRubyObject recv, IRub } } - // Can we produce IOError which bypasses a close? - public static IRubyObject truncate(ThreadContext context, IRubyObject recv, IRubyObject arg1, IRubyObject arg2) { - return truncate19(context, recv, arg1, arg2); + @Deprecated + public static IRubyObject truncate19(ThreadContext context, IRubyObject recv, IRubyObject arg1, IRubyObject arg2) { + return truncate(context, recv, arg1, arg2); } + // Can we produce IOError which bypasses a close? @JRubyMethod(name = "truncate", meta = true) - public static IRubyObject truncate19(ThreadContext context, IRubyObject recv, IRubyObject arg1, IRubyObject arg2) { + public static IRubyObject truncate(ThreadContext context, IRubyObject recv, IRubyObject arg1, IRubyObject arg2) { RubyString path = StringSupport.checkEmbeddedNulls(context.runtime, get_path(context, arg1)); return truncateCommon(context, recv, path, arg2); } @@ -2520,11 +2521,6 @@ private static FileSites sites(ThreadContext context) { return context.sites.File; } - @Deprecated - public IRubyObject initialize19(IRubyObject[] args, Block block) { - return initialize(null, args, block); - } - private static final long serialVersionUID = 1L; public static final int LOCK_SH = PosixShim.LOCK_SH; @@ -2569,11 +2565,6 @@ public static IRubyObject expand_path(ThreadContext context, IRubyObject recv, I } } - @Deprecated - public static IRubyObject expand_path19(ThreadContext context, IRubyObject recv, IRubyObject[] args) { - return expand_path(context, recv, args); - } - @Deprecated private static RubyString expandPathInternal(ThreadContext context, IRubyObject[] args, boolean expandUser, boolean canonicalize) { switch (args.length) { diff --git a/core/src/main/java/org/jruby/RubyFileStat.java b/core/src/main/java/org/jruby/RubyFileStat.java index 0ba50e2c460..11995b63ea5 100644 --- a/core/src/main/java/org/jruby/RubyFileStat.java +++ b/core/src/main/java/org/jruby/RubyFileStat.java @@ -142,12 +142,13 @@ private void setup(String filename, boolean lstat) { } } - public IRubyObject initialize(IRubyObject fname, Block unusedBlock) { - return initialize19(fname, unusedBlock); + @Deprecated + public IRubyObject initialize19(IRubyObject fname, Block unusedBlock) { + return initialize(fname, unusedBlock); } @JRubyMethod(name = "initialize", visibility = Visibility.PRIVATE) - public IRubyObject initialize19(IRubyObject fname, Block unusedBlock) { + public IRubyObject initialize(IRubyObject fname, Block unusedBlock) { Ruby runtime = getRuntime(); ThreadContext context = runtime.getCurrentContext(); RubyString path = StringSupport.checkEmbeddedNulls(runtime, RubyFile.get_path(context, fname)); diff --git a/core/src/main/java/org/jruby/RubyFixnum.java b/core/src/main/java/org/jruby/RubyFixnum.java index 9020d989f72..1d68a68c5b9 100644 --- a/core/src/main/java/org/jruby/RubyFixnum.java +++ b/core/src/main/java/org/jruby/RubyFixnum.java @@ -835,11 +835,6 @@ public IRubyObject op_pow(ThreadContext context, long other) { return powerFixnum(context, RubyFixnum.newFixnum(context.runtime, other)); } - @Deprecated - public IRubyObject op_pow_19(ThreadContext context, IRubyObject other) { - return op_pow(context, other); - } - private IRubyObject powerOther(ThreadContext context, IRubyObject other) { final Ruby runtime = context.runtime; final long a = this.value; diff --git a/core/src/main/java/org/jruby/RubyFloat.java b/core/src/main/java/org/jruby/RubyFloat.java index a028ce85424..c8cb23364e5 100644 --- a/core/src/main/java/org/jruby/RubyFloat.java +++ b/core/src/main/java/org/jruby/RubyFloat.java @@ -423,11 +423,6 @@ public IRubyObject op_mod(ThreadContext context, double other) { return RubyFloat.newFloat(context.runtime, mod); } - @Deprecated - public final IRubyObject op_mod19(ThreadContext context, IRubyObject other) { - return op_mod(context, other); - } - /** flo_divmod * */ @@ -483,11 +478,6 @@ public IRubyObject op_pow(ThreadContext context, double other) { return RubyFloat.newFloat(context.runtime, Math.pow(value, other)); } - @Deprecated - public IRubyObject op_pow19(ThreadContext context, IRubyObject other) { - return op_pow(context, other); - } - /** flo_eq * */ @@ -1230,7 +1220,7 @@ public static RubyFloat unmarshalFrom(UnmarshalStream input) throws java.io.IOEx } else if (value.equals(INFINITY_BYTELIST)) { return RubyFloat.newFloat(input.getRuntime(), Double.POSITIVE_INFINITY); } else { - return RubyFloat.newFloat(input.getRuntime(), ConvertDouble.byteListToDouble19(value, false)); + return RubyFloat.newFloat(input.getRuntime(), ConvertDouble.byteListToDouble(value, false)); } } diff --git a/core/src/main/java/org/jruby/RubyGlobal.java b/core/src/main/java/org/jruby/RubyGlobal.java index ba8efeea260..f76bf32cb20 100644 --- a/core/src/main/java/org/jruby/RubyGlobal.java +++ b/core/src/main/java/org/jruby/RubyGlobal.java @@ -694,12 +694,6 @@ public IRubyObject op_aset(ThreadContext context, IRubyObject key, IRubyObject v return case_aware_op_aset(context, key, value); } - @Override - @Deprecated - public IRubyObject op_aset19(ThreadContext context, IRubyObject key, IRubyObject value) { - return op_aset(context, key, value); - } - private IRubyObject case_aware_op_aset(ThreadContext context, IRubyObject key, final IRubyObject value) { RubyString keyAsStr = verifyValidKey(context, verifyStringLike(context, key).convertToString(), value); diff --git a/core/src/main/java/org/jruby/RubyHash.java b/core/src/main/java/org/jruby/RubyHash.java index 28e1a708e72..6a857ff17ea 100644 --- a/core/src/main/java/org/jruby/RubyHash.java +++ b/core/src/main/java/org/jruby/RubyHash.java @@ -928,9 +928,9 @@ public void visit(ThreadContext context, RubyHash self, IRubyObject key, IRubyOb if (index > 0) bytes.append((byte) ',').append((byte) ' '); - str.cat19(keyStr); + str.catWithCodeRange(keyStr); bytes.append((byte) '=').append((byte) '>'); - str.cat19(valStr); + str.catWithCodeRange(valStr); } }; @@ -957,11 +957,6 @@ public IRubyObject inspect(ThreadContext context) { } } - @Deprecated - public IRubyObject inspect19(ThreadContext context) { - return inspect(context); - } - /** rb_hash_size * */ @@ -1020,10 +1015,6 @@ public IRubyObject to_s(ThreadContext context) { return inspect(context); } - public final IRubyObject to_s19(ThreadContext context) { - return to_s(context); - } - /** rb_hash_rehash * */ @@ -1306,11 +1297,6 @@ public IRubyObject op_eql(final ThreadContext context, IRubyObject other) { return RecursiveComparator.compare(context, FindMismatchUsingEqlVisitor, this, other); } - @Deprecated - public IRubyObject op_eql19(final ThreadContext context, IRubyObject other) { - return op_eql(context, other); - } - /** rb_hash_aref * */ @@ -1396,11 +1382,6 @@ public void visit(ThreadContext context, RubyHash self, IRubyObject key, IRubyOb } }; - @Deprecated - public final RubyFixnum hash19() { - return hash(getRuntime().getCurrentContext()); - } - /** rb_hash_fetch * */ @@ -1818,11 +1799,6 @@ public IRubyObject sort(ThreadContext context, Block block) { return to_a(context).sort_bang(context, block); } - @Deprecated - public IRubyObject index19(ThreadContext context, IRubyObject expected) { - return key(context, expected); - } - @JRubyMethod public IRubyObject key(ThreadContext context, IRubyObject expected) { IRubyObject key = internalIndex(context, expected); @@ -2007,11 +1983,6 @@ public RubyHash slice(final ThreadContext context, final IRubyObject[] args) { return result; } - @Deprecated - public IRubyObject select19(ThreadContext context, Block block) { - return select(context, block); - } - /** rb_hash_delete_if * */ @@ -2135,11 +2106,6 @@ public RubyHash merge_bang(ThreadContext context, IRubyObject[] others, Block bl return this; } - @Deprecated - public RubyHash merge_bang19(ThreadContext context, IRubyObject other, Block block) { - return merge_bang(context, other, block); - } - @Deprecated public RubyHash merge(ThreadContext context, IRubyObject other, Block block) { return merge(context, new IRubyObject[]{other}, block); @@ -2159,11 +2125,6 @@ public RubyHash initialize_copy(ThreadContext context, IRubyObject other) { return replace(context, other); } - @Deprecated - public RubyHash initialize_copy19(ThreadContext context, IRubyObject other) { - return initialize_copy(context, other); - } - /** rb_hash_replace * */ @@ -2950,14 +2911,6 @@ public int hashCode() { } } - @Deprecated - public IRubyObject op_aset19(ThreadContext context, IRubyObject key, IRubyObject value) { - modify(); - - fastASetCheckString19(context.runtime, key, value); - return value; - } - /** * Note: this is included as a compatibility measure for AR-JDBC * @deprecated use RubyHash.op_aset instead @@ -2978,16 +2931,6 @@ private static HashSites sites(ThreadContext context) { return context.sites.Hash; } - @Deprecated - public final void fastASetCheckString19(Ruby runtime, IRubyObject key, IRubyObject value) { - fastASetCheckString(runtime, key, value); - } - - @Deprecated - public final void fastASetSmallCheckString19(Ruby runtime, IRubyObject key, IRubyObject value) { - fastASetSmallCheckString(runtime, key, value); - } - @Deprecated public IRubyObject op_aset(IRubyObject key, IRubyObject value) { return op_aset(metaClass.runtime.getCurrentContext(), key, value); @@ -3005,11 +2948,6 @@ public RubyHash each_pairCommon(final ThreadContext context, final Block block, return this; } - @Deprecated - public RubyHash replace19(final ThreadContext context, IRubyObject other) { - return replace(context, other); - } - @Deprecated public final void visitAll(Visitor visitor) { // use -1 to disable concurrency checks @@ -3091,11 +3029,6 @@ public RubyHash rb_clear() { return rb_clear(getRuntime().getCurrentContext()); } - @Deprecated - public IRubyObject each19(final ThreadContext context, final Block block) { - return each(context, block); - } - @Deprecated public IRubyObject any_p(ThreadContext context, IRubyObject[] args, Block block) { switch (args.length) { diff --git a/core/src/main/java/org/jruby/RubyIO.java b/core/src/main/java/org/jruby/RubyIO.java index 4bd67d3a76e..7015cd1e1b6 100644 --- a/core/src/main/java/org/jruby/RubyIO.java +++ b/core/src/main/java/org/jruby/RubyIO.java @@ -1213,11 +1213,6 @@ public static IRubyObject sysopen(IRubyObject recv, IRubyObject[] args, Block bl return sysopen(recv.getRuntime().getCurrentContext(), recv, args, block); } - @Deprecated - public static IRubyObject sysopen19(ThreadContext context, IRubyObject recv, IRubyObject[] argv, Block block) { - return sysopen(context, recv, argv, block); - } - // rb_io_s_sysopen @JRubyMethod(name = "sysopen", required = 1, optional = 2, checkArity = false, meta = true) public static IRubyObject sysopen(ThreadContext context, IRubyObject recv, IRubyObject[] argv, Block block) { @@ -3013,11 +3008,6 @@ public IRubyObject getc(ThreadContext context) { } } - @Deprecated - public final IRubyObject getc19(ThreadContext context) { - return getc(context); - } - // rb_io_ungetbyte @JRubyMethod public IRubyObject ungetbyte(ThreadContext context, IRubyObject b) { @@ -4350,11 +4340,6 @@ static IRubyObject seekBeforeAccess(ThreadContext context, RubyIO io, IRubyObjec return io.seek(context, offset); } - @Deprecated - public static IRubyObject readlines19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block unusedBlock) { - return readlines(context, recv, args, unusedBlock); - } - // rb_io_s_readlines @JRubyMethod(name = "readlines", required = 1, optional = 3, checkArity = false, meta = true) public static IRubyObject readlines(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block unusedBlock) { @@ -5502,26 +5487,6 @@ public IRubyObject getline(ThreadContext context, ByteList separator, long limit return getline(context, RubyString.newString(context.runtime, separator), limit); } - @Deprecated - public IRubyObject lines19(final ThreadContext context, Block block) { - return lines(context, block); - } - - @Deprecated - public IRubyObject each_char19(final ThreadContext context, final Block block) { - return each_char(context, block); - } - - @Deprecated - public IRubyObject chars19(final ThreadContext context, final Block block) { - return chars(context, block); - } - - @Deprecated - public RubyArray readlines19(ThreadContext context, IRubyObject[] args) { - return readlines(context, args); - } - @Deprecated public RubyIO(Ruby runtime, STDIO stdio) { super(runtime, runtime.getIO()); @@ -5772,11 +5737,6 @@ public static IRubyObject ioOpen(ThreadContext context, IRubyObject filename, IR return ioOpen(context, context.runtime.getIO(), filename, vmode, vperm, opt); } - @Deprecated - public static IRubyObject read19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block unusedBlock) { - return read(context, recv, args, unusedBlock); - } - @Deprecated public IRubyObject write_nonblock(ThreadContext context, IRubyObject[] argv) { switch (argv.length) { @@ -5827,21 +5787,6 @@ public IRubyObject sysread(ThreadContext context, IRubyObject[] args) { return sysreadCommon(context, runtime, _length, _str); } - @Deprecated - public static IRubyObject pipe19(ThreadContext context, IRubyObject recv) { - return pipe19(context, recv, IRubyObject.NULL_ARRAY, Block.NULL_BLOCK); - } - - @Deprecated - public static IRubyObject pipe19(ThreadContext context, IRubyObject recv, IRubyObject modes) { - return pipe19(context, recv, new IRubyObject[] {modes}, Block.NULL_BLOCK); - } - - @Deprecated - public static IRubyObject pipe19(ThreadContext context, IRubyObject klass, IRubyObject[] argv, Block block) { - return pipe(context, klass, argv, block); - } - @Deprecated public static IRubyObject pipe(ThreadContext context, IRubyObject klass, IRubyObject[] argv, Block block) { switch (argv.length) { diff --git a/core/src/main/java/org/jruby/RubyInteger.java b/core/src/main/java/org/jruby/RubyInteger.java index 653efba4ca3..a57422d3638 100644 --- a/core/src/main/java/org/jruby/RubyInteger.java +++ b/core/src/main/java/org/jruby/RubyInteger.java @@ -514,11 +514,6 @@ public static long numToUint(IRubyObject val) { return NUMERR_TYPE; } - @Deprecated - public final RubyString chr19(ThreadContext context) { - return chr(context); - } - @JRubyMethod(name = "chr") public RubyString chr(ThreadContext context, IRubyObject arg) { Ruby runtime = context.runtime; @@ -534,11 +529,6 @@ public RubyString chr(ThreadContext context, IRubyObject arg) { return chrCommon(context, uint, enc); } - @Deprecated - public RubyString chr19(ThreadContext context, IRubyObject arg) { - return chr(context, arg); - } - private RubyString chrCommon(ThreadContext context, long value, Encoding enc) { if (value > 0xFFFFFFFFL) { throw context.runtime.newRangeError(this + " out of char range"); @@ -1197,16 +1187,6 @@ public IRubyObject truncate(){ return this; } - @Deprecated - public final IRubyObject round19() { - return round(getRuntime().getCurrentContext()); - } - - @Deprecated - public final IRubyObject round19(ThreadContext context, IRubyObject arg) { - return round(context, arg); - } - @Deprecated public final IRubyObject op_idiv(ThreadContext context, IRubyObject arg) { return div(context, arg); diff --git a/core/src/main/java/org/jruby/RubyKernel.java b/core/src/main/java/org/jruby/RubyKernel.java index ad380c2239f..f5f7e0be83d 100644 --- a/core/src/main/java/org/jruby/RubyKernel.java +++ b/core/src/main/java/org/jruby/RubyKernel.java @@ -252,11 +252,6 @@ private static String getMethodMissingFormat(Visibility visibility, CallType cal return format; } - @Deprecated - public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { - return open(context, recv, args, block); - } - @JRubyMethod(name = "open", required = 1, optional = 3, checkArity = false, module = true, visibility = PRIVATE, keywords = true) public static IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { int argc = Arity.checkArgumentCount(context, args, 1, 4); @@ -628,11 +623,6 @@ public static IRubyObject new_string(ThreadContext context, IRubyObject recv, IR return tmp; } - @Deprecated - public static IRubyObject new_string19(ThreadContext context, IRubyObject recv, IRubyObject object) { - return new_string(context, recv, object); - } - // MRI: rb_f_p @JRubyMethod(rest = true, module = true, visibility = PRIVATE) public static IRubyObject p(ThreadContext context, IRubyObject recv, IRubyObject[] args) { @@ -936,11 +926,6 @@ public static RubyArray global_variables(ThreadContext context, IRubyObject recv return globalVariables; } - @Deprecated - public static RubyArray global_variables19(ThreadContext context, IRubyObject recv) { - return global_variables(context, recv); - } - /** * @param context * @param recv @@ -951,11 +936,6 @@ public static RubyArray local_variables(ThreadContext context, IRubyObject recv) return context.getCurrentStaticScope().getLocalVariables(context.runtime); } - @Deprecated - public static RubyArray local_variables19(ThreadContext context, IRubyObject recv) { - return local_variables(context, recv); - } - @JRubyMethod(name = "binding", module = true, visibility = PRIVATE, reads = {LASTLINE, BACKREF, VISIBILITY, BLOCK, SELF, METHODNAME, LINE, CLASS, FILENAME, SCOPE}, writes = {LASTLINE, BACKREF, VISIBILITY, BLOCK, SELF, METHODNAME, LINE, CLASS, FILENAME, SCOPE}) @@ -963,11 +943,6 @@ public static RubyBinding binding(ThreadContext context, IRubyObject recv, Block return RubyBinding.newBinding(context.runtime, context.currentBinding()); } - @Deprecated - public static RubyBinding binding19(ThreadContext context, IRubyObject recv, Block block) { - return binding(context, recv, block); - } - @JRubyMethod(name = {"block_given?", "iterator?"}, module = true, visibility = PRIVATE, reads = BLOCK) public static RubyBoolean block_given_p(ThreadContext context, IRubyObject recv) { return RubyBoolean.newBoolean(context, context.getCurrentFrame().getBlock().isGiven()); @@ -1229,16 +1204,6 @@ public static IRubyObject load(ThreadContext context, IRubyObject recv, IRubyObj return null; // not reached } - @Deprecated - public static IRubyObject load(IRubyObject recv, IRubyObject[] args, Block block) { - return load19(recv.getRuntime().getCurrentContext(), recv, args, block); - } - - @Deprecated - public static IRubyObject load19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { - return load(context, recv, args, block); - } - private static IRubyObject loadCommon(Ruby runtime, RubyString path, boolean wrap) { runtime.getLoadService().load(path.toString(), wrap); @@ -1267,11 +1232,6 @@ public static IRubyObject eval(ThreadContext context, IRubyObject recv, IRubyObj return evalCommon(context, recv, args); } - @Deprecated - public static IRubyObject eval19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { - return eval(context, recv, args, block); - } - private static IRubyObject evalCommon(ThreadContext context, IRubyObject recv, IRubyObject[] args) { // string to eval RubyString src = args[0].convertToString(); @@ -1416,16 +1376,6 @@ public static IRubyObject rbCatch(ThreadContext context, IRubyObject recv, IRuby return new CatchThrow(tag).enter(context, tag, block); } - @Deprecated - public static IRubyObject rbCatch19(ThreadContext context, IRubyObject recv, Block block) { - return rbCatch(context, recv, block); - } - - @Deprecated - public static IRubyObject rbCatch19(ThreadContext context, IRubyObject recv, IRubyObject tag, Block block) { - return rbCatch(context, recv, tag, block); - } - @JRubyMethod(name = "throw", module = true, visibility = PRIVATE) public static IRubyObject rbThrow(ThreadContext context, IRubyObject recv, IRubyObject tag, Block block) { return rbThrowInternal(context, tag, null); @@ -1436,16 +1386,6 @@ public static IRubyObject rbThrow(ThreadContext context, IRubyObject recv, IRuby return rbThrowInternal(context, tag, value); } - @Deprecated - public static IRubyObject rbThrow19(ThreadContext context, IRubyObject recv, IRubyObject tag, Block block) { - return rbThrowInternal(context, tag, null); - } - - @Deprecated - public static IRubyObject rbThrow19(ThreadContext context, IRubyObject recv, IRubyObject tag, IRubyObject value, Block block) { - return rbThrowInternal(context, tag, value); - } - private static final byte[] uncaught_throw_p = { 'u','n','c','a','u','g','h','t',' ','t','h','r','o','w',' ','%','p' }; private static IRubyObject rbThrowInternal(ThreadContext context, IRubyObject tag, IRubyObject arg) { @@ -1570,7 +1510,8 @@ private static RubyString buildWarnMessage(ThreadContext context, final int uple } else { message.catString("warning: "); } - return (RubyString) message.op_plus19(context, arg.asString()); + IRubyObject arg1 = arg.asString(); + return (RubyString) message.op_plus(context, arg1); } @JRubyMethod(module = true, alias = "then") @@ -1974,11 +1915,6 @@ public static IRubyObject system(ThreadContext context, IRubyObject recv, IRu } } - @Deprecated - public static IRubyObject system19(ThreadContext context, IRubyObject recv, IRubyObject[] args) { - return system(context, recv, args); - } - private static int systemCommon(ThreadContext context, IRubyObject recv, IRubyObject[] args) { Ruby runtime = context.runtime; long[] tuple; @@ -2141,11 +2077,6 @@ public static IRubyObject fork(ThreadContext context, IRubyObject recv, Block bl throw runtime.newNotImplementedError("fork is not available on this platform"); } - @Deprecated - public static IRubyObject fork19(ThreadContext context, IRubyObject recv, Block block) { - return fork(context, recv, block); - } - @JRubyMethod(name = {"to_enum", "enum_for"}, rest = true, keywords = true) public static IRubyObject obj_to_enum(final ThreadContext context, IRubyObject self, IRubyObject[] args, final Block block) { // to_enum is a bit strange in that it will propagate the arguments it passes to each element it calls. We are determining @@ -2277,21 +2208,11 @@ public static RubyBoolean respond_to_p(IRubyObject self, IRubyObject mname) { return ((RubyBasicObject) self).respond_to_p(mname); } - @Deprecated - public static IRubyObject respond_to_p19(IRubyObject self, IRubyObject mname) { - return ((RubyBasicObject) self).respond_to_p19(mname); - } - @Deprecated public static RubyBoolean respond_to_p(IRubyObject self, IRubyObject mname, IRubyObject includePrivate) { return ((RubyBasicObject) self).respond_to_p(mname, includePrivate); } - @Deprecated - public static IRubyObject respond_to_p19(IRubyObject self, IRubyObject mname, IRubyObject includePrivate) { - return ((RubyBasicObject) self).respond_to_p19(mname, includePrivate); - } - @JRubyMethod(name = "respond_to?") public static IRubyObject respond_to_p(ThreadContext context, IRubyObject self, IRubyObject name) { return ((RubyBasicObject) self).respond_to_p(context, name, false); @@ -2371,11 +2292,6 @@ public static IRubyObject methods(ThreadContext context, IRubyObject self, IRuby return ((RubyBasicObject)self).methods(context, args); } - @Deprecated - public static IRubyObject methods19(ThreadContext context, IRubyObject self, IRubyObject[] args) { - return ((RubyBasicObject)self).methods(context, args); - } - @JRubyMethod(name = "object_id") public static IRubyObject object_id(IRubyObject self) { return self.id(); @@ -2388,11 +2304,6 @@ public static IRubyObject public_methods(ThreadContext context, IRubyObject self return ((RubyBasicObject)self).public_methods(context, args); } - @Deprecated - public static IRubyObject public_methods19(ThreadContext context, IRubyObject self, IRubyObject[] args) { - return ((RubyBasicObject)self).public_methods(context, args); - } - @JRubyMethod(name = "protected_methods", optional = 1, checkArity = false) public static IRubyObject protected_methods(ThreadContext context, IRubyObject self, IRubyObject[] args) { Arity.checkArgumentCount(context, args, 0, 1); @@ -2400,11 +2311,6 @@ public static IRubyObject protected_methods(ThreadContext context, IRubyObject s return ((RubyBasicObject)self).protected_methods(context, args); } - @Deprecated - public static IRubyObject protected_methods19(ThreadContext context, IRubyObject self, IRubyObject[] args) { - return ((RubyBasicObject)self).protected_methods(context, args); - } - @JRubyMethod(name = "private_methods", optional = 1, checkArity = false) public static IRubyObject private_methods(ThreadContext context, IRubyObject self, IRubyObject[] args) { Arity.checkArgumentCount(context, args, 0, 1); @@ -2412,11 +2318,6 @@ public static IRubyObject private_methods(ThreadContext context, IRubyObject sel return ((RubyBasicObject)self).private_methods(context, args); } - @Deprecated - public static IRubyObject private_methods19(ThreadContext context, IRubyObject self, IRubyObject[] args) { - return ((RubyBasicObject)self).private_methods(context, args); - } - @JRubyMethod(name = "singleton_methods", optional = 1, checkArity = false) public static RubyArray singleton_methods(ThreadContext context, IRubyObject self, IRubyObject[] args) { Arity.checkArgumentCount(context, args, 0, 1); @@ -2424,11 +2325,6 @@ public static RubyArray singleton_methods(ThreadContext context, IRubyObject sel return ((RubyBasicObject)self).singleton_methods(context, args); } - @Deprecated - public static RubyArray singleton_methods19(ThreadContext context, IRubyObject self, IRubyObject[] args) { - return ((RubyBasicObject)self).singleton_methods(context, args); - } - @JRubyMethod(name = "singleton_method") public static IRubyObject singleton_method(IRubyObject self, IRubyObject symbol) { return ((RubyBasicObject)self).singleton_method(symbol); @@ -2470,23 +2366,6 @@ public static IRubyObject send(ThreadContext context, IRubyObject self, IRubyObj return ((RubyBasicObject)self).send(context, args, block); } - @Deprecated - public static IRubyObject send19(ThreadContext context, IRubyObject self, IRubyObject arg0, Block block) { - return send(context, self, arg0, block); - } - @Deprecated - public static IRubyObject send19(ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1, Block block) { - return send(context, self, arg0, arg1, block); - } - @Deprecated - public static IRubyObject send19(ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) { - return send(context, self, arg0, arg1, arg2, block); - } - @Deprecated - public static IRubyObject send19(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) { - return send(context, self, args, block); - } - @JRubyMethod(name = "nil?") public static IRubyObject nil_p(ThreadContext context, IRubyObject self) { return ((RubyBasicObject) self).nil_p(context); @@ -2523,11 +2402,6 @@ public static RubyArray instance_variables(ThreadContext context, IRubyObject se return ((RubyBasicObject) self).instance_variables(context); } - @Deprecated - public static RubyArray instance_variables19(ThreadContext context, IRubyObject self) { - return instance_variables(context, self); - } - /* end delegated bindings */ public static IRubyObject gsub(ThreadContext context, IRubyObject recv, IRubyObject arg0, Block block) { @@ -2600,16 +2474,6 @@ public static IRubyObject methodMissing(ThreadContext context, IRubyObject recv, return methodMissing(context, recv, name, lastVis, lastCallType, args); } - @Deprecated - public static IRubyObject caller20(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { - return caller(context, recv, args, block); - } - - @Deprecated - public static IRubyObject caller19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { - return caller(context, recv, args, block); - } - @Deprecated private static IRubyObject caller(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { switch (args.length) { @@ -2645,16 +2509,6 @@ public static IRubyObject require(IRubyObject recv, IRubyObject name, Block bloc return require(recv.getRuntime().getCurrentContext(), recv, name, block); } - @Deprecated - public static IRubyObject require19(ThreadContext context, IRubyObject recv, IRubyObject name, Block block) { - return require(context, recv, name, block); - } - - @Deprecated - public static IRubyObject op_match19(ThreadContext context, IRubyObject self, IRubyObject arg) { - return op_match(context, self, arg); - } - @Deprecated public static IRubyObject op_match(ThreadContext context, IRubyObject self, IRubyObject arg) { context.runtime.getWarnings().warn(ID.DEPRECATED_METHOD, @@ -2663,31 +2517,11 @@ public static IRubyObject op_match(ThreadContext context, IRubyObject self, IRub return ((RubyBasicObject) self).op_match(context, arg); } - @Deprecated - public static IRubyObject new_integer19(ThreadContext context, IRubyObject recv, IRubyObject object) { - return new_integer(context, recv, object); - } - - @Deprecated - public static RubyFloat new_float19(IRubyObject recv, IRubyObject object) { - return new_float(recv, object); - } - @Deprecated public static IRubyObject autoload(final IRubyObject recv, IRubyObject symbol, IRubyObject file) { return autoload(recv.getRuntime().getCurrentContext(), recv, symbol, file); } - @Deprecated - public static IRubyObject rand18(ThreadContext context, IRubyObject recv, IRubyObject[] arg) { - return rand(context, recv, arg); - } - - @Deprecated - public static IRubyObject rand19(ThreadContext context, IRubyObject recv, IRubyObject[] arg) { - return rand(context, recv, arg); - } - @Deprecated public static IRubyObject rand(ThreadContext context, IRubyObject recv, IRubyObject[] args) { switch (args.length) { @@ -2705,11 +2539,6 @@ public static IRubyObject method(IRubyObject self, IRubyObject symbol) { return ((RubyBasicObject)self).method(symbol); } - @Deprecated - public static IRubyObject method19(IRubyObject self, IRubyObject symbol) { - return method(self, symbol); - } - // defined in Ruby now but left here for backward compat @Deprecated public static IRubyObject tap(ThreadContext context, IRubyObject recv, Block block) { diff --git a/core/src/main/java/org/jruby/RubyMatchData.java b/core/src/main/java/org/jruby/RubyMatchData.java index 172fa01f46b..146de383bf4 100644 --- a/core/src/main/java/org/jruby/RubyMatchData.java +++ b/core/src/main/java/org/jruby/RubyMatchData.java @@ -581,12 +581,6 @@ private IRubyObject matchAryAref(ThreadContext context, IRubyObject index, RubyA return matchArySubseq(context, begLen[0], begLen[1], result); } - - @Deprecated - public IRubyObject op_aref19(IRubyObject idx, IRubyObject rest) { - return op_aref(getRuntime().getCurrentContext(), idx, rest); - } - /** match_aref * */ @@ -679,15 +673,16 @@ public IRubyObject end(ThreadContext context, IRubyObject index) { return RubyFixnum.newFixnum(runtime, e); } + @Deprecated + public IRubyObject offset19(ThreadContext context, IRubyObject index) { + return offset(context, index); + } + /** match_offset * */ - public IRubyObject offset(ThreadContext context, IRubyObject index) { - return offset19(context, index); - } - @JRubyMethod(name = "offset") - public IRubyObject offset19(ThreadContext context, IRubyObject index) { + public IRubyObject offset(ThreadContext context, IRubyObject index) { check(); final Ruby runtime = context.runtime; diff --git a/core/src/main/java/org/jruby/RubyMath.java b/core/src/main/java/org/jruby/RubyMath.java index 8abd6469a35..7f6dd6c5757 100644 --- a/core/src/main/java/org/jruby/RubyMath.java +++ b/core/src/main/java/org/jruby/RubyMath.java @@ -53,15 +53,8 @@ public static RubyModule createMathModule(Ruby runtime) { return result; } - - - private static void domainCheck(IRubyObject recv, double value, String msg) { - if (Double.isNaN(value)) { - throw recv.getRuntime().newErrnoEDOMError(msg); - } - } - private static void domainCheck19(IRubyObject recv, double value, String msg) { + private static void domainCheck(IRubyObject recv, double value, String msg) { if (Double.isNaN(value)) { throw recv.getRuntime().newMathDomainError(msg); } @@ -95,41 +88,21 @@ public static RubyFloat atan2(ThreadContext context, IRubyObject recv, IRubyObje return RubyFloat.newFloat(context.runtime, Math.atan2(valuea, valueb)); } - @Deprecated - public static RubyFloat atan219(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) { - return atan2(context, recv, x, y); - } - @JRubyMethod(name = "cos", module = true, visibility = Visibility.PRIVATE) public static RubyFloat cos(ThreadContext context, IRubyObject recv, IRubyObject x) { return RubyFloat.newFloat(context.runtime, Math.cos(RubyNumeric.num2dbl(context, x))); } - @Deprecated - public static RubyFloat cos19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return cos(context, recv, x); - } - @JRubyMethod(name = "sin", module = true, visibility = Visibility.PRIVATE) public static RubyFloat sin(ThreadContext context, IRubyObject recv, IRubyObject x) { return RubyFloat.newFloat(context.runtime, Math.sin(RubyNumeric.num2dbl(context, x))); } - @Deprecated - public static RubyFloat sin19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return sin(context, recv, x); - } - @JRubyMethod(name = "tan", module = true, visibility = Visibility.PRIVATE) public static RubyFloat tan(ThreadContext context, IRubyObject recv, IRubyObject x) { return RubyFloat.newFloat(context.runtime, Math.tan(RubyNumeric.num2dbl(context, x))); } - @Deprecated - public static RubyFloat tan19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return tan(context, recv, x); - } - @JRubyMethod(name = "asin", module = true, visibility = Visibility.PRIVATE) public static RubyFloat asin(ThreadContext context, IRubyObject recv, IRubyObject x) { double value = RubyNumeric.num2dbl(context, x); @@ -139,11 +112,6 @@ public static RubyFloat asin(ThreadContext context, IRubyObject recv, IRubyObjec return RubyFloat.newFloat(context.runtime, Math.asin(value)); } - @Deprecated - public static RubyFloat asin19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return asin(context, recv, x); - } - @JRubyMethod(name = "acos", module = true, visibility = Visibility.PRIVATE) public static RubyFloat acos(ThreadContext context, IRubyObject recv, IRubyObject x) { double value = RubyNumeric.num2dbl(context, x); @@ -153,21 +121,11 @@ public static RubyFloat acos(ThreadContext context, IRubyObject recv, IRubyObjec return RubyFloat.newFloat(context.runtime, Math.acos(value)); } - @Deprecated - public static RubyFloat acos19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return acos(context, recv, x); - } - @JRubyMethod(name = "atan", module = true, visibility = Visibility.PRIVATE) public static RubyFloat atan(ThreadContext context, IRubyObject recv, IRubyObject x) { return RubyFloat.newFloat(context.runtime, Math.atan(RubyNumeric.num2dbl(context, x))); } - @Deprecated - public static RubyFloat atan19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return atan(context, recv, x); - } - @JRubyMethod(name = "cosh", module = true, visibility = Visibility.PRIVATE) public static RubyFloat cosh(ThreadContext context, IRubyObject recv, IRubyObject x) { double value = RubyNumeric.num2dbl(context, x); @@ -175,11 +133,6 @@ public static RubyFloat cosh(ThreadContext context, IRubyObject recv, IRubyObjec return RubyFloat.newFloat(context.runtime, (Math.exp(value) + Math.exp(-value)) / 2.0); } - @Deprecated - public static RubyFloat cosh19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return cosh(context, recv, x); - } - @JRubyMethod(name = "sinh", module = true, visibility = Visibility.PRIVATE) public static RubyFloat sinh(ThreadContext context, IRubyObject recv, IRubyObject x) { double value = RubyNumeric.num2dbl(context, x); @@ -187,21 +140,11 @@ public static RubyFloat sinh(ThreadContext context, IRubyObject recv, IRubyObjec return RubyFloat.newFloat(context.runtime, (Math.exp(value) - Math.exp(-value)) / 2.0); } - @Deprecated - public static RubyFloat sinh19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return sinh(context, recv, x); - } - @JRubyMethod(name = "tanh", module = true, visibility = Visibility.PRIVATE) public static RubyFloat tanh(ThreadContext context, IRubyObject recv, IRubyObject x) { return RubyFloat.newFloat(context.runtime, Math.tanh(RubyNumeric.num2dbl(context, x))); } - @Deprecated - public static RubyFloat tanh19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return tanh(context, recv, x); - } - @JRubyMethod(name = "acosh", module = true, visibility = Visibility.PRIVATE) public static RubyFloat acosh(ThreadContext context, IRubyObject recv, IRubyObject x) { double value = RubyNumeric.num2dbl(context, x); @@ -220,11 +163,6 @@ public static RubyFloat acosh(ThreadContext context, IRubyObject recv, IRubyObje return RubyFloat.newFloat(context.runtime,result); } - @Deprecated - public static RubyFloat acosh19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return acosh(context, recv, x); - } - public static final double[] ASINH_COEF = { -.12820039911738186343372127359268e+0, -.58811761189951767565211757138362e-1, @@ -270,11 +208,6 @@ public static RubyFloat asinh(ThreadContext context, IRubyObject recv, IRubyObje return RubyFloat.newFloat(context.runtime, result); } - - @Deprecated - public static RubyFloat asinh19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return asinh(context, recv, x); - } public static final double[] ATANH_COEF = { .9439510239319549230842892218633e-1, @@ -321,11 +254,6 @@ public static RubyFloat atanh(ThreadContext context, IRubyObject recv, IRubyObje return RubyFloat.newFloat(context.runtime, result); } - @Deprecated - public static RubyFloat atanh_19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return atanh(context, recv, x); - } - @JRubyMethod(name = "exp", module = true, visibility = Visibility.PRIVATE) public static RubyFloat exp(ThreadContext context, IRubyObject recv, IRubyObject exponent) { return exp(context, exponent); @@ -335,11 +263,6 @@ public static RubyFloat exp(ThreadContext context, IRubyObject exponent) { return RubyFloat.newFloat(context.runtime, Math.exp(RubyNumeric.num2dbl(context, exponent))); } - @Deprecated - public static RubyFloat exp19(ThreadContext context, IRubyObject recv, IRubyObject exponent) { - return exp(context, recv, exponent); - } - // MRI : get_double_rshift private static double[] get_double_rshift(ThreadContext context, IRubyObject x) { int numbits = 0; @@ -401,11 +324,6 @@ public static RubyFloat log(ThreadContext context, IRubyObject recv, IRubyObject return log(context, recv, args[0]); } - @Deprecated - public static RubyFloat log_19(ThreadContext context, IRubyObject recv, IRubyObject[] args) { - return log(context, recv, args); - } - /** Returns the base 10 logarithm of x. * */ @@ -421,11 +339,6 @@ public static RubyFloat log10(ThreadContext context, IRubyObject recv, IRubyObje return RubyFloat.newFloat(context.runtime, Math.log10(ret[0]) + ret[1] * LOG_10_2); } - @Deprecated - public static RubyFloat log10_19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return log10(context, recv, x); - } - /** Returns the base 2 logarithm of x. * */ @@ -441,11 +354,6 @@ public static RubyFloat log2(ThreadContext context, IRubyObject recv, IRubyObjec return RubyFloat.newFloat(context.runtime, Math.log(ret[0]) / LOG_E_2 + ret[1]); } - @Deprecated - public static RubyFloat log2_19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return log2(context, recv, x); - } - @JRubyMethod(name = "sqrt", module = true, visibility = Visibility.PRIVATE) public static RubyFloat sqrt(ThreadContext context, IRubyObject recv, IRubyObject x) { double value = RubyNumeric.num2dbl(context, x); @@ -455,11 +363,6 @@ public static RubyFloat sqrt(ThreadContext context, IRubyObject recv, IRubyObjec return RubyFloat.newFloat(context.runtime, value == 0.0 ? 0.0 : Math.sqrt(value)); } - @Deprecated - public static RubyFloat sqrt19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return sqrt(context, recv, x); - } - @JRubyMethod(name = "cbrt", module = true, visibility = Visibility.PRIVATE) public static RubyFloat cbrt(ThreadContext context, IRubyObject recv, IRubyObject x) { double result = Math.cbrt(RubyNumeric.num2dbl(context, x)); @@ -467,12 +370,13 @@ public static RubyFloat cbrt(ThreadContext context, IRubyObject recv, IRubyObjec return RubyFloat.newFloat(context.runtime, result); } - public static RubyFloat hypot(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) { - return hypot19(context, recv, x, y); + @Deprecated + public static RubyFloat hypot19(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) { + return hypot(context, recv, x, y); } @JRubyMethod(name = "hypot", module = true, visibility = Visibility.PRIVATE) - public static RubyFloat hypot19(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) { + public static RubyFloat hypot(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) { double valuea = RubyNumeric.num2dbl(context, x); double valueb = RubyNumeric.num2dbl(context, y); double result; @@ -524,11 +428,6 @@ public static RubyArray frexp(ThreadContext context, IRubyObject recv, IRubyObje RubyNumeric.int2fix(context.runtime, exponent)); } - @Deprecated - public static RubyArray frexp19(ThreadContext context, IRubyObject recv, IRubyObject other) { - return frexp(context, recv, other); - } - /* * r = x * 2 ** y */ @@ -545,10 +444,6 @@ public static RubyFloat ldexp(ThreadContext context, IRubyObject recv, IRubyObje return RubyFloat.newFloat(context.runtime, m * Math.pow(2.0, e)); } - public static RubyFloat ldexp19(ThreadContext context, IRubyObject recv, IRubyObject mantissa, IRubyObject exponent) { - return ldexp(context, recv, mantissa, exponent); - } - public static final double[] ERFC_COEF = { -.490461212346918080399845440334e-1, -.142261205103713642378247418996e0, @@ -588,10 +483,6 @@ public static RubyFloat erf(ThreadContext context, IRubyObject recv, IRubyObject return RubyFloat.newFloat(context.runtime,result); } - public static RubyFloat erf19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return erf(context, recv, x); - } - public static final double[] ERFC2_COEF = { -.69601346602309501127391508262e-1, -.411013393626208934898221208467e-1, @@ -681,11 +572,6 @@ public static RubyFloat erfc(ThreadContext context, IRubyObject recv, IRubyObjec return RubyFloat.newFloat(context.runtime,result); } - @Deprecated - public static RubyFloat erfc19(ThreadContext context, IRubyObject recv, IRubyObject x) { - return erfc(context, recv, x); - } - private static final double FACTORIAL[] = { /* 0! */ 1.0, /* 1! */ 1.0, @@ -771,7 +657,7 @@ public static RubyFloat gamma(ThreadContext context, IRubyObject recv, IRubyObje return RubyFloat.newFloat(context.runtime, Double.NaN); } - domainCheck19(recv, result, "gamma"); + domainCheck(recv, result, "gamma"); return RubyFloat.newFloat(context.runtime, result); } diff --git a/core/src/main/java/org/jruby/RubyMethod.java b/core/src/main/java/org/jruby/RubyMethod.java index 7ebbad1bb11..68d2cd7800b 100644 --- a/core/src/main/java/org/jruby/RubyMethod.java +++ b/core/src/main/java/org/jruby/RubyMethod.java @@ -47,10 +47,8 @@ import org.jruby.runtime.JavaSites; import org.jruby.runtime.MethodBlockBody; import org.jruby.runtime.ObjectAllocator; -import org.jruby.runtime.PositionAware; import org.jruby.runtime.Signature; import org.jruby.runtime.ThreadContext; -import org.jruby.runtime.backtrace.TraceType; import org.jruby.runtime.builtin.IRubyObject; import org.jruby.runtime.callsite.CacheEntry; @@ -281,14 +279,14 @@ public IRubyObject inspect() { if (mklass.isSingleton()) { IRubyObject attached = ((MetaClass) mklass).getAttached(); if (receiver == null) { - str.cat19(inspect(context, mklass).convertToString()); + str.catWithCodeRange(inspect(context, mklass).convertToString()); } else if (receiver == attached) { - str.cat19(inspect(context, attached).convertToString()); + str.catWithCodeRange(inspect(context, attached).convertToString()); sharp = "."; } else { - str.cat19(inspect(context, receiver).convertToString()); + str.catWithCodeRange(inspect(context, receiver).convertToString()); str.catString("("); - str.cat19(inspect(context, attached).convertToString()); + str.catWithCodeRange(inspect(context, attached).convertToString()); str.catString(")"); sharp = "."; } diff --git a/core/src/main/java/org/jruby/RubyModule.java b/core/src/main/java/org/jruby/RubyModule.java index 27892dd465d..32f00280a72 100644 --- a/core/src/main/java/org/jruby/RubyModule.java +++ b/core/src/main/java/org/jruby/RubyModule.java @@ -111,7 +111,6 @@ import org.jruby.runtime.builtin.IRubyObject; import org.jruby.runtime.builtin.Variable; import org.jruby.runtime.callsite.CacheEntry; -import org.jruby.runtime.callsite.CachingCallSite; import org.jruby.runtime.load.LoadService; import org.jruby.runtime.marshal.MarshalStream; import org.jruby.runtime.marshal.UnmarshalStream; @@ -121,13 +120,11 @@ import org.jruby.util.RubyStringBuilder; import org.jruby.util.ByteList; import org.jruby.util.ClassProvider; -import org.jruby.util.CommonByteLists; import org.jruby.util.IdUtil; import org.jruby.util.StringSupport; import org.jruby.util.TypeConverter; import org.jruby.util.cli.Options; import org.jruby.util.collections.WeakHashSet; -import org.jruby.util.io.EncodingUtils; import org.jruby.util.log.Logger; import org.jruby.util.log.LoggerFactory; @@ -148,7 +145,6 @@ import static org.jruby.runtime.Visibility.UNDEFINED; import static org.jruby.util.CommonByteLists.COLON_COLON; -import static org.jruby.util.IdUtil.isValidConstantName; import static org.jruby.util.RubyStringBuilder.str; import static org.jruby.util.RubyStringBuilder.ids; import static org.jruby.util.RubyStringBuilder.types; @@ -719,9 +715,10 @@ private RubyString calculateRubyName() { RubyString fullName = runtime.newString(); // newString creates empty ByteList which ends up as fullName.setEncoding(USASCIIEncoding.INSTANCE); // ASCII-8BIT. 8BIT is unfriendly to string concats. for (RubyString parent: parents) { - fullName.cat19(parent).cat19(colons); + RubyString rubyString = fullName.catWithCodeRange(parent); + rubyString.catWithCodeRange(colons); } - fullName.cat19(rubyBaseName()); + fullName.catWithCodeRange(rubyBaseName()); fullName.setFrozen(true); @@ -2633,11 +2630,6 @@ public IRubyObject name(ThreadContext context) { return getBaseName() == null ? context.nil : rubyName(); } - @Deprecated - public IRubyObject name19() { - return getBaseName() == null ? getRuntime().getNil() : rubyName().strDup(getRuntime()); - } - protected final IRubyObject cloneMethods(RubyModule clone) { Ruby runtime = getRuntime(); RubyModule realType = this.getOrigin(); @@ -2810,9 +2802,9 @@ public RubyString to_s() { RubyString buffer = runtime.newString("#', buffer.getEncoding()); @@ -2824,9 +2816,9 @@ public RubyString to_s() { if (refinedClass != null) { RubyString buffer = runtime.newString("#', buffer.getEncoding()); return buffer; @@ -3070,11 +3062,6 @@ public IRubyObject attr(ThreadContext context, IRubyObject[] args) { return attr_reader(context, args); } - @Deprecated - public IRubyObject attr19(ThreadContext context, IRubyObject[] args) { - return attr(context, args); - } - @Deprecated public IRubyObject attr_reader(IRubyObject[] args) { return attr_reader(getRuntime().getCurrentContext(), args); @@ -3215,23 +3202,25 @@ protected void addMethodSymbols(Ruby runtime, Set seen, RubyArray ary, b }); } - public RubyArray instance_methods(IRubyObject[] args) { - return instance_methods19(args); + @Deprecated + public RubyArray instance_methods19(IRubyObject[] args) { + return instance_methods(args); } @JRubyMethod(name = "instance_methods", optional = 1, checkArity = false) - public RubyArray instance_methods19(IRubyObject[] args) { + public RubyArray instance_methods(IRubyObject[] args) { Arity.checkArgumentCount(getRuntime(), args, 0, 1); return instanceMethods(args, PRIVATE, false, true); } - public RubyArray public_instance_methods(IRubyObject[] args) { - return public_instance_methods19(args); + @Deprecated + public RubyArray public_instance_methods19(IRubyObject[] args) { + return public_instance_methods(args); } @JRubyMethod(name = "public_instance_methods", optional = 1, checkArity = false) - public RubyArray public_instance_methods19(IRubyObject[] args) { + public RubyArray public_instance_methods(IRubyObject[] args) { Arity.checkArgumentCount(getRuntime(), args, 0, 1); return instanceMethods(args, PUBLIC, false, false); @@ -3261,11 +3250,6 @@ public RubyArray protected_instance_methods(IRubyObject[] args) { return instanceMethods(args, PROTECTED, false, false); } - @Deprecated - public RubyArray protected_instance_methods19(IRubyObject[] args) { - return protected_instance_methods(args); - } - /** rb_class_private_instance_methods * */ @@ -3276,11 +3260,6 @@ public RubyArray private_instance_methods(IRubyObject[] args) { return instanceMethods(args, PRIVATE, false, false); } - @Deprecated - public RubyArray private_instance_methods19(IRubyObject[] args) { - return private_instance_methods(args); - } - @JRubyMethod(name = "undefined_instance_methods") public IRubyObject undefined_instance_method(ThreadContext context) { RubyArray list = context.runtime.newArray(); @@ -4037,26 +4016,28 @@ public IRubyObject class_variable_defined_p(ThreadContext context, IRubyObject v return context.fals; } + @Deprecated + public IRubyObject class_variable_get19(IRubyObject name) { + return class_variable_get(name); + } + /** rb_mod_cvar_get * */ + @JRubyMethod(name = "class_variable_get") public IRubyObject class_variable_get(IRubyObject name) { return getClassVar(name, validateClassVariable(getRuntime(), name)); } - @JRubyMethod(name = "class_variable_get") - public IRubyObject class_variable_get19(IRubyObject name) { - return class_variable_get(name); - } - /** rb_mod_cvar_set * */ + @JRubyMethod(name = "class_variable_set") public IRubyObject class_variable_set(IRubyObject name, IRubyObject value) { return setClassVar(validateClassVariable(getRuntime(), name), value); } - @JRubyMethod(name = "class_variable_set") + @Deprecated public IRubyObject class_variable_set19(IRubyObject name, IRubyObject value) { return class_variable_set(name, value); } @@ -4064,20 +4045,16 @@ public IRubyObject class_variable_set19(IRubyObject name, IRubyObject value) { /** rb_mod_remove_cvar * */ + @JRubyMethod(name = "remove_class_variable") public IRubyObject remove_class_variable(ThreadContext context, IRubyObject name) { return removeClassVariable(validateClassVariable(context.runtime, name)); } - @JRubyMethod(name = "remove_class_variable") + @Deprecated public IRubyObject remove_class_variable19(ThreadContext context, IRubyObject name) { return remove_class_variable(context, name); } - @Deprecated - public RubyArray class_variables19(ThreadContext context) { - return class_variables(context); - } - @JRubyMethod(name = "class_variables") public RubyArray class_variables(ThreadContext context) { Ruby runtime = context.runtime; @@ -4433,21 +4410,6 @@ public RubyArray constants(ThreadContext context, IRubyObject allConstants) { return constantsCommon(context, false, allConstants.isTrue()); } - @Deprecated - public RubyArray constants19(ThreadContext context) { - return constants(context); - } - - @Deprecated - public RubyArray constants19(ThreadContext context, IRubyObject allConstants) { - return constants(context, allConstants); - } - - @Deprecated // no longer used - public RubyArray constantsCommon19(ThreadContext context, boolean replaceModule, boolean allConstants) { - return constantsCommon(context, replaceModule, allConstants); - } - private RubyArray constantsCommon(ThreadContext context, boolean replaceModule, boolean allConstants) { Ruby runtime = context.runtime; @@ -6194,29 +6156,6 @@ public boolean fastIsConstantDefined(String internedName){ return isConstantDefined(internedName); } - @Deprecated - public boolean fastIsConstantDefined19(String internedName) { - return isConstantDefined(internedName, true); - } - - @Deprecated - public boolean fastIsConstantDefined19(String internedName, boolean inherit) { - return isConstantDefined(internedName, inherit); - } - - @Deprecated - public RubyBoolean const_defined_p19(ThreadContext context, IRubyObject[] args) { - switch (args.length) { - case 1: - return const_defined_p(context, args[0]); - case 2: - return const_defined_p(context, args[0], args[1]); - } - - Arity.checkArgumentCount(context, args, 1, 2); - return null; // not reached - } - @Deprecated public static class ModuleKernelMethods { @Deprecated diff --git a/core/src/main/java/org/jruby/RubyNumeric.java b/core/src/main/java/org/jruby/RubyNumeric.java index 3defb61e0c7..d259eba5647 100644 --- a/core/src/main/java/org/jruby/RubyNumeric.java +++ b/core/src/main/java/org/jruby/RubyNumeric.java @@ -468,7 +468,8 @@ public static RubyFloat str2fnum(Ruby runtime, RubyString arg) { */ public static IRubyObject str2fnum(Ruby runtime, RubyString arg, boolean strict, boolean exception) { try { - double value = ConvertDouble.byteListToDouble19(arg.getByteList(), strict); + ByteList bytes = arg.getByteList(); + double value = ConvertDouble.byteListToDouble(bytes, strict); return RubyFloat.newFloat(runtime, value); } catch (NumberFormatException e) { if (strict) { @@ -806,11 +807,6 @@ public IRubyObject quo(ThreadContext context, IRubyObject other) { return RubyRational.numericQuo(context, this, other); } - @Deprecated - public final IRubyObject quo_19(ThreadContext context, IRubyObject other) { - return quo(context, other); - } - /** * MRI: num_div */ @@ -1763,24 +1759,4 @@ public IRubyObject truncate() { private static JavaSites.NumericSites sites(ThreadContext context) { return context.sites.Numeric; } - - @Deprecated - public static RubyFloat str2fnum19(Ruby runtime, RubyString arg, boolean strict) { - return str2fnum(runtime, arg, strict); - } - - @Deprecated - public final IRubyObject div19(ThreadContext context, IRubyObject other) { - return div(context, other); - } - - @Deprecated - public final IRubyObject divmod19(ThreadContext context, IRubyObject other) { - return divmod(context, other); - } - - @Deprecated - public final IRubyObject modulo19(ThreadContext context, IRubyObject other) { - return modulo(context, other); - } } diff --git a/core/src/main/java/org/jruby/RubyProc.java b/core/src/main/java/org/jruby/RubyProc.java index 52288d4278f..de19cf61d30 100644 --- a/core/src/main/java/org/jruby/RubyProc.java +++ b/core/src/main/java/org/jruby/RubyProc.java @@ -469,16 +469,6 @@ private static JavaSites.ProcSites sites(ThreadContext context) { return context.sites.Proc; } - @Deprecated - public final IRubyObject call19(ThreadContext context, IRubyObject[] args, Block block) { - return call(context, args, block); - } - - @Deprecated - public IRubyObject to_s19() { - return to_s(); - } - @Deprecated public final IRubyObject call(ThreadContext context, IRubyObject[] args, IRubyObject self, Block passedBlock) { return block.call(context, args, passedBlock); diff --git a/core/src/main/java/org/jruby/RubyProcess.java b/core/src/main/java/org/jruby/RubyProcess.java index ceca9e53f0b..11e04aa6527 100644 --- a/core/src/main/java/org/jruby/RubyProcess.java +++ b/core/src/main/java/org/jruby/RubyProcess.java @@ -1814,17 +1814,18 @@ public static IRubyObject pid(Ruby runtime) { return runtime.newFixnum(runtime.getPosix().getpid()); } - public static IRubyObject fork(ThreadContext context, IRubyObject recv, Block block) { - return RubyKernel.fork(context, recv, block); - } - @JRubyMethod(module = true, visibility = PRIVATE, notImplemented = true) public static IRubyObject _fork(ThreadContext context, IRubyObject recv, Block block) { throw context.runtime.newNotImplementedError("fork is not available on this platform"); } - @JRubyMethod(name = "fork", module = true, visibility = PRIVATE, notImplemented = true) + @Deprecated public static IRubyObject fork19(ThreadContext context, IRubyObject recv, Block block) { + return fork(context, recv, block); + } + + @JRubyMethod(name = "fork", module = true, visibility = PRIVATE, notImplemented = true) + public static IRubyObject fork(ThreadContext context, IRubyObject recv, Block block) { return RubyKernel.fork(context, recv, block); } diff --git a/core/src/main/java/org/jruby/RubyRandom.java b/core/src/main/java/org/jruby/RubyRandom.java index 331ea08b8e8..4395a13cbc6 100644 --- a/core/src/main/java/org/jruby/RubyRandom.java +++ b/core/src/main/java/org/jruby/RubyRandom.java @@ -324,11 +324,6 @@ public static IRubyObject srandCommon(ThreadContext context, IRubyObject recv, I return previousSeed; } - @Deprecated - public IRubyObject op_equal_19(ThreadContext context, IRubyObject obj) { - return op_equal(context, obj); - } - // c: random_equal @Override @JRubyMethod(name = "==") @@ -455,11 +450,6 @@ static RandomType tryGetRnd(ThreadContext context, IRubyObject obj) { } } - @Deprecated // not-used - public static IRubyObject randCommon19(ThreadContext context, IRubyObject recv, IRubyObject[] args) { - return randKernel(context, args); - } - @Deprecated static IRubyObject randKernel(ThreadContext context, IRubyObject[] args) { RandomType random = getDefaultRand(context); diff --git a/core/src/main/java/org/jruby/RubyRange.java b/core/src/main/java/org/jruby/RubyRange.java index 9e39998c1d6..edcc40929c5 100644 --- a/core/src/main/java/org/jruby/RubyRange.java +++ b/core/src/main/java/org/jruby/RubyRange.java @@ -574,11 +574,6 @@ public IRubyObject to_a(ThreadContext context, final Block block) { return RubyEnumerable.to_a(context, this); } - @Deprecated - public IRubyObject each19(ThreadContext context, final Block block) { - return each(context, block); - } - @JRubyMethod(name = "each") public IRubyObject each(final ThreadContext context, final Block block) { if (!block.isGiven()) { @@ -771,16 +766,6 @@ private static boolean bignumPositive(IRubyObject num) { return bigNum.signum() == 1; } - @Deprecated - public IRubyObject step19(ThreadContext context, IRubyObject step, Block block) { - return step(context, step, block); - } - - @Deprecated - public IRubyObject step19(ThreadContext context, Block block) { - return step(context, block); - } - @JRubyMethod(name = "step") public IRubyObject step(final ThreadContext context, final Block block) { return block.isGiven() ? stepCommon(context, RubyFixnum.one(context.runtime), block) : step(context, context.runtime.getNil(), block); @@ -972,11 +957,6 @@ private static IRubyObject stepSize(ThreadContext context, RubyRange self, IRuby return context.nil; } - @Deprecated - public IRubyObject include_p19(ThreadContext context, IRubyObject obj) { - return include_p(context, obj); - } - // framed for invokeSuper @JRubyMethod(name = {"include?", "member?"}, frame = true) public IRubyObject include_p(ThreadContext context, final IRubyObject obj) { diff --git a/core/src/main/java/org/jruby/RubyRational.java b/core/src/main/java/org/jruby/RubyRational.java index f9529d3506b..b3baf28510a 100644 --- a/core/src/main/java/org/jruby/RubyRational.java +++ b/core/src/main/java/org/jruby/RubyRational.java @@ -1038,11 +1038,6 @@ public IRubyObject op_mod(ThreadContext context, IRubyObject other) { return f_sub(context, this, f_mul(context, other, f_floor(context, f_div(context, this, other)))); } - @Deprecated - public IRubyObject op_mod19(ThreadContext context, IRubyObject other) { - return op_mod(context, other); - } - /** nurat_divmod * */ @@ -1054,11 +1049,6 @@ public IRubyObject op_divmod(ThreadContext context, IRubyObject other) { return context.runtime.newArray(val, f_sub(context, this, f_mul(context, other, val))); } - @Deprecated - public IRubyObject op_divmod19(ThreadContext context, IRubyObject other) { - return op_divmod(context, other); - } - /** nurat_rem * */ @@ -1666,11 +1656,6 @@ public IRubyObject op_ceil(ThreadContext context, IRubyObject n) { return ceil(context, n); } - @Deprecated - public IRubyObject op_idiv19(ThreadContext context, IRubyObject other) { - return idiv(context, other); - } - @Deprecated public IRubyObject op_idiv(ThreadContext context, IRubyObject other) { return idiv(context, other); diff --git a/core/src/main/java/org/jruby/RubyRegexp.java b/core/src/main/java/org/jruby/RubyRegexp.java index 6f168c08131..be219c90d39 100755 --- a/core/src/main/java/org/jruby/RubyRegexp.java +++ b/core/src/main/java/org/jruby/RubyRegexp.java @@ -155,7 +155,8 @@ private static Regex makeRegexp(Ruby runtime, ByteList bytes, RegexpOptions opti int p = bytes.getBegin(); return new Regex(bytes.getUnsafeBytes(), p, p + bytes.getRealSize(), options.toJoniOptions(), enc, Syntax.DEFAULT, runtime.getRegexpWarnings()); } catch (Exception e) { - RegexpSupport.raiseRegexpError19(runtime, bytes, enc, options, e.getMessage()); + String err = e.getMessage(); + RegexpSupport.raiseRegexpError(runtime, bytes, enc, options, err); return null; // not reached } } @@ -465,7 +466,7 @@ public static RubyString preprocessDRegexp(ThreadContext context, RegexpOptions for (int i = 0; i < args.length; i++) { RubyString str = args[i].convertToString(); regexpEnc = processDRegexpElement(context.runtime, options, regexpEnc, context.encodingHolder(), str); - string = string == null ? (RubyString) str.dup() : string.append19(str); + string = string == null ? (RubyString) str.dup() : string.append(str); } if (regexpEnc != null) string.setEncoding(regexpEnc); @@ -523,7 +524,7 @@ private static RubyString processElementIntoResult( Encoding[] fixedEnc) { RubyString str = arg0.convertToString(); regexpEnc = processDRegexpElement(runtime, options, regexpEnc, fixedEnc, str); - return processElementIntoResult(runtime, result == null ? str.strDup(runtime) : result.append19(str), arg1, arg2, arg3, arg4, options, regexpEnc, fixedEnc); + return processElementIntoResult(runtime, result == null ? str.strDup(runtime) : result.append(str), arg1, arg2, arg3, arg4, options, regexpEnc, fixedEnc); } private static RubyString processElementIntoResult( @@ -538,7 +539,7 @@ private static RubyString processElementIntoResult( Encoding[] fixedEnc) { RubyString str = arg0.convertToString(); regexpEnc = processDRegexpElement(runtime, options, regexpEnc, fixedEnc, str); - return processElementIntoResult(runtime, result == null ? str.strDup(runtime) : result.append19(str), arg1, arg2, arg3, options, regexpEnc, fixedEnc); + return processElementIntoResult(runtime, result == null ? str.strDup(runtime) : result.append(str), arg1, arg2, arg3, options, regexpEnc, fixedEnc); } private static RubyString processElementIntoResult( @@ -552,7 +553,7 @@ private static RubyString processElementIntoResult( Encoding[] fixedEnc) { RubyString str = arg0.convertToString(); regexpEnc = processDRegexpElement(runtime, options, regexpEnc, fixedEnc, str); - return processElementIntoResult(runtime, result == null ? str.strDup(runtime) : result.append19(str), arg1, arg2, options, regexpEnc, fixedEnc); + return processElementIntoResult(runtime, result == null ? str.strDup(runtime) : result.append(str), arg1, arg2, options, regexpEnc, fixedEnc); } private static RubyString processElementIntoResult( @@ -565,7 +566,7 @@ private static RubyString processElementIntoResult( Encoding[] fixedEnc) { RubyString str = arg0.convertToString(); regexpEnc = processDRegexpElement(runtime, options, regexpEnc, fixedEnc, str); - return processElementIntoResult(runtime, result == null ? str.strDup(runtime) : result.append19(str), arg1, options, regexpEnc, fixedEnc); + return processElementIntoResult(runtime, result == null ? str.strDup(runtime) : result.append(str), arg1, options, regexpEnc, fixedEnc); } private static RubyString processElementIntoResult( @@ -577,7 +578,7 @@ private static RubyString processElementIntoResult( Encoding[] fixedEnc) { RubyString str = arg0.convertToString(); regexpEnc = processDRegexpElement(runtime, options, regexpEnc, fixedEnc, str); - result = result == null ? str.strDup(runtime) : result.append19(str); + result = result == null ? str.strDup(runtime) : result.append(str); if (regexpEnc != null) result.setEncoding(regexpEnc); return result; } @@ -626,11 +627,6 @@ public static RubyString quote(ThreadContext context, IRubyObject recv, IRubyObj return RubyString.newStringShared(context.runtime, quote(str)); } - @Deprecated - public static IRubyObject quote19(ThreadContext context, IRubyObject recv, IRubyObject arg) { - return quote(context, recv, arg); - } - static ByteList quote(final RubyString str) { final ByteList bytes = str.getByteList(); final ByteList qBytes = quote(bytes, str.isAsciiOnly()); @@ -751,11 +747,6 @@ static ByteList quote(ByteList bs, boolean asciiOnly) { return result; } - @Deprecated - public static ByteList quote19(ByteList bs, boolean asciiOnly) { - return quote(bs, asciiOnly); - } - /** rb_reg_s_last_match / match_getter * */ @@ -873,11 +864,6 @@ public static IRubyObject union(ThreadContext context, IRubyObject recv, IRubyOb } } - @Deprecated - public static IRubyObject union19(ThreadContext context, IRubyObject recv, IRubyObject[] args) { - return union(context, recv, args); - } - /** rb_reg_init_copy */ @JRubyMethod(visibility = Visibility.PRIVATE) @@ -950,21 +936,6 @@ public IRubyObject initialize_m(IRubyObject arg0, IRubyObject arg1, IRubyObject return regexpInitializeString(arg0.convertToString(), newOptions); } - @Deprecated - public IRubyObject initialize_m19(IRubyObject arg) { - return initialize_m(arg); - } - - @Deprecated - public IRubyObject initialize_m19(IRubyObject arg0, IRubyObject arg1) { - return initialize_m(arg0, arg1); - } - - @Deprecated - public IRubyObject initialize_m19(IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { - return initialize_m(arg0, arg1, arg2); - } - private IRubyObject initializeByRegexp(RubyRegexp regexp) { // Clone and toggle flags since this is no longer a literal regular expression // but it did come from one. @@ -981,7 +952,7 @@ private RubyRegexp regexpInitializeString(RubyString str, RegexpOptions options) if (options.isEncodingNone()) { if (enc != ASCIIEncoding.INSTANCE) { if (str.scanForCodeRange() != StringSupport.CR_7BIT) { - RegexpSupport.raiseRegexpError19(metaClass.runtime, bytes, enc, options, "/.../n has a non escaped non ASCII character in non ASCII-8BIT script"); + RegexpSupport.raiseRegexpError(metaClass.runtime, bytes, enc, options, "/.../n has a non escaped non ASCII character in non ASCII-8BIT script"); } enc = ASCIIEncoding.INSTANCE; } @@ -998,14 +969,14 @@ public final RubyRegexp regexpInitialize(ByteList bytes, Encoding enc, RegexpOpt // FIXME: Something unsets this bit, but we aren't...be more permissive until we figure this out //if (isLiteral()) throw runtime.newSecurityError("can't modify literal regexp"); if (pattern != null) throw runtime.newTypeError("already initialized regexp"); - if (enc.isDummy()) RegexpSupport.raiseRegexpError19(runtime, bytes, enc, options, "can't make regexp with dummy encoding"); + if (enc.isDummy()) RegexpSupport.raiseRegexpError(runtime, bytes, enc, options, "can't make regexp with dummy encoding"); Encoding[]fixedEnc = new Encoding[]{null}; ByteList unescaped = RegexpSupport.preprocess(runtime, bytes, enc, fixedEnc, RegexpSupport.ErrorMode.RAISE); if (fixedEnc[0] != null) { if ((fixedEnc[0] != enc && options.isFixed()) || (fixedEnc[0] != ASCIIEncoding.INSTANCE && options.isEncodingNone())) { - RegexpSupport.raiseRegexpError19(runtime, bytes, enc, options, "incompatible character encoding"); + RegexpSupport.raiseRegexpError(runtime, bytes, enc, options, "incompatible character encoding"); } if (fixedEnc[0] != ASCIIEncoding.INSTANCE) { options.setFixed(true); @@ -1055,11 +1026,6 @@ public IRubyObject op_equal(ThreadContext context, IRubyObject other) { return RubyBoolean.newBoolean(context, str.equal(otherRegex.str) && options.equals(otherRegex.options)); } - @Deprecated - public IRubyObject op_match219(ThreadContext context) { - return op_match2(context); - } - @JRubyMethod(name = "~", reads = {LASTLINE}, writes = BACKREF) public IRubyObject op_match2(ThreadContext context) { Ruby runtime = context.runtime; @@ -1103,11 +1069,6 @@ public IRubyObject eqq(ThreadContext context, IRubyObject arg) { return context.fals; } - @Deprecated - public IRubyObject eqq19(ThreadContext context, IRubyObject arg) { - return eqq(context, arg); - } - // MRI: rb_reg_match @Override @@ -1379,12 +1340,8 @@ public final int length() { public IRubyObject inspect() { if (pattern == null) return anyToString(); Ruby runtime = metaClass.runtime; - return RubyString.newString(runtime, RegexpSupport.regexpDescription19(runtime, str, options, str.getEncoding())); - } - - @Deprecated - public IRubyObject inspect19() { - return inspect(); + Encoding enc = str.getEncoding(); + return RubyString.newString(runtime, RegexpSupport.regexpDescription(runtime, str, options, enc)); } private final static int EMBEDDABLE = RE_OPTION_MULTILINE|RE_OPTION_IGNORECASE|RE_OPTION_EXTENDED; @@ -1469,7 +1426,8 @@ public RubyString to_s() { if (!newOptions.isExtended()) result.append((byte)'x'); } result.append((byte)':'); - RegexpSupport.appendRegexpString19(runtime, result, bytes, p, len, str.getEncoding(), null); + Encoding enc = str.getEncoding(); + RegexpSupport.appendRegexpString(runtime, result, bytes, p, len, enc, null); result.append((byte)')'); return (RubyString) RubyString.newString(runtime, result, getEncoding()); @@ -1812,18 +1770,6 @@ public static void marshalTo(RubyRegexp regexp, MarshalStream output) throws jav output.writeByte(options); } - @Deprecated - public final int search19(ThreadContext context, RubyString str, int pos, boolean reverse) { - return search(context, str, pos, reverse); - } - - @Deprecated - public final int search19(ThreadContext context, RubyString str, int pos, boolean reverse, IRubyObject[] holder) { - int result = searchString(context, str, pos, reverse); - if (holder != null) holder[0] = context.getLocalMatchOrNil(); - return result; - } - @Deprecated public final int search(ThreadContext context, RubyString str, int pos, boolean reverse, IRubyObject[] holder) { int result = searchString(context, str, pos, reverse); @@ -1840,21 +1786,6 @@ public static IRubyObject getBackRef(ThreadContext context) { return context.getBackRef(); } - @Deprecated - public IRubyObject op_match19(ThreadContext context, IRubyObject str) { - return op_match(context, str); - } - - @Deprecated - public IRubyObject match_m19(ThreadContext context, IRubyObject str) { - return match_m(context, str, Block.NULL_BLOCK); - } - - @Deprecated - public IRubyObject match_m19(ThreadContext context, IRubyObject str, boolean useBackref, Block block) { - return matchCommon(context, str, 0, useBackref, block); - } - /** * Is the pattern itself a simple US-ASCII string which can be used in simple string searches and * can be used outside of the regexp engine? diff --git a/core/src/main/java/org/jruby/RubyString.java b/core/src/main/java/org/jruby/RubyString.java index 6db59571962..ea9710ba039 100644 --- a/core/src/main/java/org/jruby/RubyString.java +++ b/core/src/main/java/org/jruby/RubyString.java @@ -92,24 +92,7 @@ import static org.jruby.RubyEnumerator.enumeratorizeWithSize; import static org.jruby.anno.FrameField.BACKREF; import static org.jruby.runtime.Visibility.PRIVATE; -import static org.jruby.util.StringSupport.CR_7BIT; -import static org.jruby.util.StringSupport.CR_BROKEN; -import static org.jruby.util.StringSupport.CR_MASK; -import static org.jruby.util.StringSupport.CR_UNKNOWN; -import static org.jruby.util.StringSupport.CR_VALID; -import static org.jruby.util.StringSupport.MBCLEN_CHARFOUND_LEN; -import static org.jruby.util.StringSupport.MBCLEN_CHARFOUND_P; -import static org.jruby.util.StringSupport.MBCLEN_INVALID_P; -import static org.jruby.util.StringSupport.MBCLEN_NEEDMORE_P; -import static org.jruby.util.StringSupport.codeLength; -import static org.jruby.util.StringSupport.codePoint; -import static org.jruby.util.StringSupport.codeRangeScan; -import static org.jruby.util.StringSupport.encFastMBCLen; -import static org.jruby.util.StringSupport.isSingleByteOptimizable; -import static org.jruby.util.StringSupport.memsearch; -import static org.jruby.util.StringSupport.memchr; -import static org.jruby.util.StringSupport.nth; -import static org.jruby.util.StringSupport.offset; +import static org.jruby.util.StringSupport.*; /** * Implementation of Ruby String class @@ -355,11 +338,16 @@ final int subLength(int pos) { public final boolean eql(IRubyObject other) { RubyClass meta = this.metaClass; if (meta != meta.runtime.getString() || meta != other.getMetaClass()) return super.eql(other); - return eql19(other); + return eqlAndComparable(other); } - // rb_str_hash_cmp + @Deprecated private boolean eql19(IRubyObject other) { + return eqlAndComparable(other); + } + + // rb_str_hash_cmp + private boolean eqlAndComparable(IRubyObject other) { final RubyString otherString = (RubyString) other; return StringSupport.areComparable(this, otherString) && value.equal(otherString.value); } @@ -878,11 +866,6 @@ public final RubyString makeSharedString(Ruby runtime, int index, int len) { return makeShared(runtime, runtime.getString(), value, index, len); } - @Deprecated - public final RubyString makeSharedString19(Ruby runtime, int index, int len) { - return makeShared(runtime, runtime.getString(), value, index, len); - } - public final RubyString makeShared(Ruby runtime, int index, int len) { return makeShared(runtime, getType(), value, index, len); } @@ -902,16 +885,6 @@ public final RubyString makeShared(Ruby runtime, RubyClass meta, int index, int return shared; } - @Deprecated - public final RubyString makeShared19(Ruby runtime, int index, int len) { - return makeShared(runtime, value, index, len); - } - - @Deprecated - public final RubyString makeShared19(Ruby runtime, RubyClass meta, int index, int len) { - return makeShared(runtime, meta, value, index, len); - } - private RubyString makeShared(Ruby runtime, ByteList value, int index, int len) { return makeShared(runtime, getType(), value, index, len); } @@ -993,7 +966,12 @@ public final void modify() { value.invalidate(); } + @Deprecated public final void modify19() { + modifyAndClearCodeRange(); + } + + public final void modifyAndClearCodeRange() { modify(); clearCodeRange(); } @@ -1233,12 +1211,13 @@ public final IRubyObject plus_at() { return isFrozen() ? this.dup() : this; } - public IRubyObject op_plus(ThreadContext context, IRubyObject arg) { - return op_plus19(context, arg); + @Deprecated + public IRubyObject op_plus19(ThreadContext context, IRubyObject arg) { + return op_plus(context, arg); } @JRubyMethod(name = "+") - public IRubyObject op_plus19(ThreadContext context, IRubyObject arg) { + public IRubyObject op_plus(ThreadContext context, IRubyObject arg) { RubyString str = arg.convertToString(); Encoding enc = checkEncoding(str); long len = (long) value.getRealSize() + str.value.getRealSize(); @@ -1250,12 +1229,13 @@ public IRubyObject op_plus19(ThreadContext context, IRubyObject arg) { return resultStr; } - public IRubyObject op_mul(ThreadContext context, IRubyObject other) { - return op_mul19(context, other); + @Deprecated + public IRubyObject op_mul19(ThreadContext context, IRubyObject other) { + return op_mul(context, other); } @JRubyMethod(name = "*") - public IRubyObject op_mul19(ThreadContext context, IRubyObject other) { + public IRubyObject op_mul(ThreadContext context, IRubyObject other) { RubyString result = multiplyByteList(context, other); result.value.setEncoding(value.getEncoding()); result.copyCodeRangeForSubstr(this, value.getEncoding()); @@ -1414,9 +1394,15 @@ public final RubyString cat(byte[] str, int beg, int len) { return this; } - // // rb_str_buf_append against VALUE + @Deprecated public final RubyString cat19(RubyString str2) { - int str2_cr = cat19(str2.getByteList(), str2.getCodeRange()); + return catWithCodeRange(str2); + } + + // // rb_str_buf_append against VALUE + public final RubyString catWithCodeRange(RubyString str2) { + ByteList other = str2.getByteList(); + int str2_cr = catWithCodeRange(other, str2.getCodeRange()); str2.setCodeRange(str2_cr); @@ -1424,17 +1410,23 @@ public final RubyString cat19(RubyString str2) { } public final RubyString cat(ByteList other, int codeRange) { - cat19(other, codeRange); + catWithCodeRange(other, codeRange); return this; } - // rb_str_buf_append against ptr + @Deprecated public final int cat19(ByteList other, int codeRange) { + return catWithCodeRange(other, codeRange); + } + + // rb_str_buf_append against ptr + public final int catWithCodeRange(ByteList other, int codeRange) { return EncodingUtils.encCrStrBufCat(metaClass.runtime, this, other, other.getEncoding(), codeRange); } public final RubyString catString(String str) { - cat19(encodeBytelist(str, getEncoding()), CR_UNKNOWN); + ByteList other = encodeBytelist(str, getEncoding()); + catWithCodeRange(other, CR_UNKNOWN); return this; } @@ -1492,21 +1484,22 @@ public final RubyString catAscii(byte[] bytes, int ptr, int ptrLen) { return this; } - /** rb_str_replace_m - * - */ - public IRubyObject replace(IRubyObject other) { - return replace19(other); + @Deprecated + public IRubyObject replace19(IRubyObject other) { + return replace(other); } @JRubyMethod(name = "initialize_copy", visibility = Visibility.PRIVATE) @Override public RubyString initialize_copy(IRubyObject other) { - return replace19(other); + return replace(other); } + /** rb_str_replace_m + * + */ @JRubyMethod(name = "replace") - public RubyString replace19(IRubyObject other) { + public RubyString replace(IRubyObject other) { modifyCheck(); if (this == other) return this; setCodeRange(replaceCommon(other).getCodeRange()); // encoding doesn't have to be copied. @@ -1533,23 +1526,25 @@ public RubyString clear() { return this; } - public IRubyObject reverse(ThreadContext context) { - return reverse19(context); + @Deprecated + public IRubyObject reverse19(ThreadContext context) { + return reverse(context); } @JRubyMethod(name = "reverse") - public IRubyObject reverse19(ThreadContext context) { + public IRubyObject reverse(ThreadContext context) { RubyString str = strDup(context.runtime, context.runtime.getString()); - str.reverse_bang19(context); + str.reverse_bang(context); return str; } - public RubyString reverse_bang(ThreadContext context) { - return reverse_bang19(context); + @Deprecated + public RubyString reverse_bang19(ThreadContext context) { + return reverse_bang(context); } @JRubyMethod(name = "reverse!") - public RubyString reverse_bang19(ThreadContext context) { + public RubyString reverse_bang(ThreadContext context) { modifyCheck(); if (value.getRealSize() > 1) { modifyAndKeepCodeRange(); @@ -1639,7 +1634,7 @@ private IRubyObject initialize(ThreadContext context, IRubyObject arg0, RubyHash Ruby runtime = context.runtime; if (arg0 != null) { - replace19(arg0); + replace(arg0); } if (opts != null) { @@ -1659,16 +1654,6 @@ private IRubyObject initialize(ThreadContext context, IRubyObject arg0, RubyHash return this; } - @Deprecated - public IRubyObject initialize19(ThreadContext context, IRubyObject arg0) { - return initialize(context, arg0); - } - - @Deprecated - public IRubyObject casecmp19(ThreadContext context, IRubyObject other) { - return casecmp(context, other); - } - @JRubyMethod(name = "casecmp") public IRubyObject casecmp(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; @@ -1721,6 +1706,20 @@ public IRubyObject op_match(ThreadContext context, IRubyObject other) { if (other instanceof RubyString) throw context.runtime.newTypeError("type mismatch: String given"); return sites(context).op_match.call(context, other, other, this); } + @Deprecated + public IRubyObject match19(ThreadContext context, IRubyObject pattern) { + return match(context, pattern, Block.NULL_BLOCK); + } + + @Deprecated + public IRubyObject match19(ThreadContext context, IRubyObject pattern, IRubyObject pos, Block block) { + return match(context, pattern, pos, block); + } + + @Deprecated + public IRubyObject match19(ThreadContext context, IRubyObject[] args, Block block) { + return match(context, args, block); + } /** * String#match(pattern) @@ -1729,26 +1728,23 @@ public IRubyObject op_match(ThreadContext context, IRubyObject other) { * * @param pattern Regexp or String */ - public IRubyObject match(ThreadContext context, IRubyObject pattern) { - return match19(context, pattern, Block.NULL_BLOCK); - } @JRubyMethod(name = "match", writes = BACKREF) - public IRubyObject match19(ThreadContext context, IRubyObject pattern, Block block) { + public IRubyObject match(ThreadContext context, IRubyObject pattern, Block block) { RubyRegexp coercedPattern = getPattern(context.runtime, pattern); IRubyObject result = sites(context).match.call(context, coercedPattern, coercedPattern, this); return block.isGiven() && result != context.nil ? block.yield(context, result) : result; } @JRubyMethod(name = "match", writes = BACKREF) - public IRubyObject match19(ThreadContext context, IRubyObject pattern, IRubyObject pos, Block block) { + public IRubyObject match(ThreadContext context, IRubyObject pattern, IRubyObject pos, Block block) { RubyRegexp coercedPattern = getPattern(context.runtime, pattern); IRubyObject result = sites(context).match.call(context, coercedPattern, coercedPattern, this, pos); return block.isGiven() && result != context.nil ? block.yield(context, result) : result; } @JRubyMethod(name = "match", required = 1, rest = true, checkArity = false) - public IRubyObject match19(ThreadContext context, IRubyObject[] args, Block block) { + public IRubyObject match(ThreadContext context, IRubyObject[] args, Block block) { if (args.length < 1) { Arity.checkArgumentCount(context, args, 1, -1); } @@ -1768,48 +1764,52 @@ public IRubyObject match_p(ThreadContext context, IRubyObject pattern, IRubyObje return getPattern(context.runtime, pattern).matchP(context, this, RubyNumeric.num2int(pos)); } - public IRubyObject op_ge(ThreadContext context, IRubyObject other) { - return op_ge19(context, other); + @Deprecated + public IRubyObject op_ge19(ThreadContext context, IRubyObject other) { + return op_ge(context, other); } @JRubyMethod(name = ">=") - public IRubyObject op_ge19(ThreadContext context, IRubyObject other) { + public IRubyObject op_ge(ThreadContext context, IRubyObject other) { if (other instanceof RubyString && cmpIsBuiltin(context)) { return RubyBoolean.newBoolean(context, op_cmp((RubyString) other) >= 0); } return RubyComparable.op_ge(context, this, other); } - public IRubyObject op_gt(ThreadContext context, IRubyObject other) { - return op_gt19(context, other); + @Deprecated + public IRubyObject op_gt19(ThreadContext context, IRubyObject other) { + return op_gt(context, other); } @JRubyMethod(name = ">") - public IRubyObject op_gt19(ThreadContext context, IRubyObject other) { + public IRubyObject op_gt(ThreadContext context, IRubyObject other) { if (other instanceof RubyString && cmpIsBuiltin(context)) { return RubyBoolean.newBoolean(context, op_cmp((RubyString) other) > 0); } return RubyComparable.op_gt(context, this, other); } - public IRubyObject op_le(ThreadContext context, IRubyObject other) { - return op_le19(context, other); + @Deprecated + public IRubyObject op_le19(ThreadContext context, IRubyObject other) { + return op_le(context, other); } @JRubyMethod(name = "<=") - public IRubyObject op_le19(ThreadContext context, IRubyObject other) { + public IRubyObject op_le(ThreadContext context, IRubyObject other) { if (other instanceof RubyString && cmpIsBuiltin(context)) { return RubyBoolean.newBoolean(context, op_cmp((RubyString) other) <= 0); } return RubyComparable.op_le(context, this, other); } - public IRubyObject op_lt(ThreadContext context, IRubyObject other) { - return op_lt19(context, other); + @Deprecated + public IRubyObject op_lt19(ThreadContext context, IRubyObject other) { + return op_lt(context, other); } @JRubyMethod(name = "<") - public IRubyObject op_lt19(ThreadContext context, IRubyObject other) { + public IRubyObject op_lt(ThreadContext context, IRubyObject other) { if (other instanceof RubyString && cmpIsBuiltin(context)) { return RubyBoolean.newBoolean(context, op_cmp((RubyString) other) < 0); } @@ -1820,12 +1820,13 @@ private boolean cmpIsBuiltin(ThreadContext context) { return sites(context).cmp.isBuiltin(this); } - public IRubyObject str_eql_p(ThreadContext context, IRubyObject other) { - return str_eql_p19(context, other); + @Deprecated + public IRubyObject str_eql_p19(ThreadContext context, IRubyObject other) { + return str_eql_p(context, other); } @JRubyMethod(name = "eql?") - public IRubyObject str_eql_p19(ThreadContext context, IRubyObject other) { + public IRubyObject str_eql_p(ThreadContext context, IRubyObject other) { if (other instanceof RubyString) { RubyString otherString = (RubyString)other; if (StringSupport.areComparable(this, otherString) && value.equal(otherString.value)) return context.tru; @@ -1847,16 +1848,6 @@ private int caseMap(Ruby runtime, int flags, Encoding enc) { /** rb_str_upcase / rb_str_upcase_bang * */ - @Deprecated - public RubyString upcase19(ThreadContext context) { - return upcase(context); - } - - @Deprecated - public IRubyObject upcase_bang19(ThreadContext context) { - return upcase_bang(context); - } - @JRubyMethod(name = "upcase") public RubyString upcase(ThreadContext context) { RubyString str = strDup(context.runtime, context.runtime.getString()); @@ -1918,19 +1909,8 @@ private IRubyObject upcase_bang(ThreadContext context, int flags) { } /** rb_str_downcase / rb_str_downcase_bang - * - */ - - @Deprecated - public RubyString downcase19(ThreadContext context) { - return downcase(context); - } - - @Deprecated - public IRubyObject downcase_bang19(ThreadContext context) { - return downcase_bang(context); - } - + * + */ @JRubyMethod(name = "downcase") public RubyString downcase(ThreadContext context) { RubyString str = strDup(context.runtime, context.runtime.getString()); @@ -1994,16 +1974,6 @@ private IRubyObject downcase_bang(ThreadContext context, int flags) { /** rb_str_swapcase / rb_str_swapcase_bang * */ - @Deprecated - public RubyString swapcase19(ThreadContext context) { - return swapcase(context); - } - - @Deprecated - public IRubyObject swapcase_bang19(ThreadContext context) { - return swapcase_bang(context); - } - @JRubyMethod(name = "swapcase") public RubyString swapcase(ThreadContext context) { RubyString str = strDup(context.runtime, context.runtime.getString()); @@ -2053,18 +2023,8 @@ private IRubyObject swapcase_bang(ThreadContext context, int flags) { } /** rb_str_capitalize / rb_str_capitalize_bang - * - */ - @Deprecated - public IRubyObject capitalize19(ThreadContext context) { - return capitalize(context); - } - - @Deprecated - public IRubyObject capitalize_bang19(ThreadContext context) { - return capitalize_bang(context); - } - + * + */ @JRubyMethod(name = "capitalize") public RubyString capitalize(ThreadContext context) { RubyString str = strDup(context.runtime, context.runtime.getString()); @@ -2376,10 +2336,10 @@ public IRubyObject insert(ThreadContext context, IRubyObject indexArg, IRubyObje int index = RubyNumeric.num2int(indexArg); if (index == -1) { modifyCheck(); - return cat19(str); + return catWithCodeRange(str); } if (index < 0) index++; - replaceInternal19(index, 0, str); + strUpdate(context.runtime, index, 0, this, str); return this; } @@ -2413,11 +2373,6 @@ final RubyString inspect(final Ruby runtime) { return (RubyString) inspect(runtime, value); } - @Deprecated - public IRubyObject inspect19() { - return inspect(); - } - // MRI: rb_str_escape public static IRubyObject rbStrEscape(ThreadContext context, RubyString str) { Ruby runtime = context.runtime; @@ -2482,11 +2437,6 @@ else if (asciicompat && Encoding.isAscii(c) && (c < 0x7F && c > 31 /*ISPRINT(c)* return result; } - @Deprecated - public static IRubyObject inspect19(final Ruby runtime, ByteList byteList) { - return inspect(runtime, byteList); - } - @SuppressWarnings("ReferenceEquality") public static RubyString inspect(final Ruby runtime, ByteList byteList) { Encoding enc = byteList.getEncoding(); @@ -2595,11 +2545,6 @@ private RubyFixnum rubyLength(final Ruby runtime) { return runtime.newFixnum(strLength()); } - @Deprecated - public RubyFixnum length19() { - return getRuntime().newFixnum(strLength()); - } - @JRubyMethod(name = "bytesize") public RubyFixnum bytesize() { return getRuntime().newFixnum(value.getRealSize()); @@ -2630,7 +2575,7 @@ public char charAt(int offset) { @Override public CharSequence subSequence(int start, int end) { - IRubyObject subStr = substr19(getRuntime(), start, end - start); + IRubyObject subStr = substrEnc(getRuntime(), start, end - start); if (subStr.isNil()) { throw new StringIndexOutOfBoundsException("String index out of range: <" + start + ", " + end + ")"); } @@ -2671,23 +2616,18 @@ public RubyString append(IRubyObject other) { modifyCheck(); if (other instanceof RubyFloat) { - return cat19((RubyString) ((RubyFloat) other).to_s()); + return catWithCodeRange((RubyString) ((RubyFloat) other).to_s()); } else if (other instanceof RubySymbol) { - cat19(((RubySymbol) other).getBytes(), CR_UNKNOWN); + catWithCodeRange(((RubySymbol) other).getBytes(), CR_UNKNOWN); return this; } - return cat19(other.convertToString()); + return catWithCodeRange(other.convertToString()); } public RubyString append(RubyString other) { modifyCheck(); - return cat19(other); - } - - @Deprecated - public RubyString append19(IRubyObject other) { - return append(other); + return catWithCodeRange(other); } public RubyString appendAsDynamicString(IRubyObject other) { @@ -2700,19 +2640,13 @@ public RubyString appendAsDynamicString(IRubyObject other) { modifyCheck(); if (other instanceof RubyFloat) { - return cat19((RubyString) ((RubyFloat) other).to_s()); + return catWithCodeRange((RubyString) ((RubyFloat) other).to_s()); } else if (other instanceof RubySymbol) { - cat19(((RubySymbol) other).getBytes(), 0); + catWithCodeRange(((RubySymbol) other).getBytes(), 0); return this; } - return cat19(other.asString()); - } - - // NOTE: append(RubyString) should pbly just do the encoding aware cat - final RubyString append19(RubyString other) { - modifyCheck(); - return cat19(other); + return catWithCodeRange(other.asString()); } /** rb_str_concat @@ -2722,7 +2656,7 @@ final RubyString append19(RubyString other) { public RubyString concatSingle(ThreadContext context, IRubyObject other) { if (other instanceof RubyString) { // duplicated (default) return path - since its common - return append19((RubyString) other); + return append((RubyString) other); } if (other instanceof RubyFixnum) { long c = RubyNumeric.num2long(other); @@ -2740,11 +2674,11 @@ public RubyString concatSingle(ThreadContext context, IRubyObject other) { } if (other instanceof RubyFloat) { modifyCheck(); - return cat19((RubyString) ((RubyFloat) other).to_s()); + return catWithCodeRange((RubyString) ((RubyFloat) other).to_s()); } if (other instanceof RubySymbol) throw context.runtime.newTypeError("can't convert Symbol into String"); - return append19(other.convertToString()); + return append(other.convertToString()); } /** rb_str_concat @@ -2771,7 +2705,7 @@ public RubyString concat(ThreadContext context, IRubyObject[] objs) { tmp.concatSingle(context, obj); } - cat19(tmp); + catWithCodeRange(tmp); } return this; @@ -2781,11 +2715,6 @@ public RubyString concat(IRubyObject other) { return concat(metaClass.runtime.getCurrentContext(), other); } - @Deprecated - public RubyString concat19(ThreadContext context, IRubyObject other) { - return concat(context, other); - } - @SuppressWarnings("ReferenceEquality") private RubyString concatNumeric(Ruby runtime, int c) { Encoding enc = value.getEncoding(); @@ -2798,7 +2727,7 @@ private RubyString concatNumeric(Ruby runtime, int c) { throw runtime.newRangeError(c + " out of char range or invalid code point"); } - modify19(value.getRealSize() + cl); + modifyExpand(value.getRealSize() + cl); if (enc == USASCIIEncoding.INSTANCE) { if (c > 0xff) throw runtime.newRangeError(c + " out of char range"); @@ -2820,7 +2749,8 @@ private RubyString concatNumeric(Ruby runtime, int c) { */ @JRubyMethod public IRubyObject prepend(ThreadContext context, IRubyObject other) { - return replace19(other.convertToString().op_plus19(context, this)); + RubyString rubyString = other.convertToString(); + return replace(rubyString.op_plus(context, this)); } /** @@ -2839,7 +2769,7 @@ public IRubyObject prepend(ThreadContext context, IRubyObject[] objs) { tmp.concat(context, obj); } - replaceInternal19(0, 0, tmp); + strUpdate(runtime, 0, 0, this, tmp); } return this; @@ -2896,26 +2826,6 @@ public static RubyString stringValue(IRubyObject object) { return (RubyString) (object instanceof RubyString ? object : object.convertToString()); } - @Deprecated - public IRubyObject sub19(ThreadContext context, IRubyObject arg0, Block block) { - return sub(context, arg0, block); - } - - @Deprecated - public IRubyObject sub19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) { - return sub(context, arg0, arg1, block); - } - - @Deprecated - public IRubyObject sub_bang19(ThreadContext context, IRubyObject arg0, Block block) { - return sub_bang(context, arg0, block); - } - - @Deprecated - public IRubyObject sub_bang19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) { - return sub_bang(context, arg0, arg1, block); - } - /** rb_str_sub / rb_str_sub_bang * */ @@ -3126,7 +3036,7 @@ private RubyString subBangCommon(ThreadContext context, final int beg, final int if (replSize > plen) { modifyExpand(value.getRealSize() + replSize - plen); } else { - modify19(); + modifyAndClearCodeRange(); } final ByteList value = this.value; @@ -3169,26 +3079,6 @@ private Encoding subBangVerifyEncoding(ThreadContext context, final RubyString r return repl.value.getEncoding(); } - @Deprecated - public IRubyObject gsub19(ThreadContext context, IRubyObject arg0, Block block) { - return gsub(context, arg0, block); - } - - @Deprecated - public IRubyObject gsub19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) { - return gsub(context, arg0, arg1, block); - } - - @Deprecated - public IRubyObject gsub_bang19(ThreadContext context, IRubyObject arg0, Block block) { - return gsub_bang(context, arg0, block); - } - - @Deprecated - public IRubyObject gsub_bang19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) { - return gsub_bang(context, arg0, arg1, block); - } - @JRubyMethod(name = "gsub", writes = BACKREF) public IRubyObject gsub(ThreadContext context, IRubyObject arg0, Block block) { if (!block.isGiven()) return enumeratorize(context.runtime, this, "gsub", arg0); @@ -3316,7 +3206,7 @@ private IRubyObject gsubCommon(ThreadContext context, Block block, RubyString re int len = begz - offset; if (len != 0) dest.cat(spBytes, cp, len, str_enc); - dest.cat19(val); + dest.catWithCodeRange(val); offset = endz; if (begz == endz) { if (spLen <= endz) break; @@ -3408,7 +3298,7 @@ private IRubyObject gsubCommon(ThreadContext context, Block block, RubyString re int len = begz - offset; if (len != 0) dest.cat(spBytes, cp, len, str_enc); - dest.cat19(val); + dest.catWithCodeRange(val); offset = endz; if (begz == endz) { if (spLen <= endz) break; @@ -3490,16 +3380,6 @@ public IRubyObject byteindex(ThreadContext context, IRubyObject arg0, IRubyObjec return byteIndexCommon(context, arg0, pos); } - @Deprecated - public IRubyObject index19(ThreadContext context, IRubyObject arg0) { - return index(context, arg0); - } - - @Deprecated - public IRubyObject index19(ThreadContext context, IRubyObject arg0, IRubyObject arg1) { - return index(context, arg0, arg1); - } - private IRubyObject indexCommon(ThreadContext context, IRubyObject sub, int pos) { if (sub instanceof RubyRegexp) { if (pos > strLength()) return context.nil; @@ -3576,16 +3456,6 @@ private int strseqIndex(final RubyString sub, int offset, boolean inBytes) { return pos + offset; } - @Deprecated - public IRubyObject rindex19(ThreadContext context, IRubyObject arg0) { - return rindex(context, arg0); - } - - @Deprecated - public IRubyObject rindex19(ThreadContext context, IRubyObject arg0, IRubyObject arg1) { - return rindex(context, arg0, arg1); - } - /** rb_str_rindex_m * */ @@ -3735,7 +3605,7 @@ private IRubyObject byteARef(Ruby runtime, IRubyObject idx) { return obj; } - public final IRubyObject substr19(Ruby runtime, int beg, int len) { + public final IRubyObject substrEnc(Ruby runtime, int beg, int len) { if (len < 0) return runtime.getNil(); int length = value.getRealSize(); if (length == 0) len = 0; @@ -3752,11 +3622,11 @@ public final IRubyObject substr19(Ruby runtime, int beg, int len) { return makeSharedString(runtime, beg, len); } else { if (beg + len > length) len = length - beg; - return multibyteSubstr19(runtime, enc, len, beg, length); + return multibyteSubstr(runtime, enc, len, beg, length); } } - private IRubyObject multibyteSubstr19(Ruby runtime, Encoding enc, int len, int beg, int length) { + private IRubyObject multibyteSubstr(Ruby runtime, Encoding enc, int len, int beg, int length) { int p; int s = value.getBegin(); int end = s + length; @@ -3842,8 +3712,9 @@ private IRubyObject replaceInternal(int beg, int len, RubyString repl) { return this; } - private void replaceInternal19(int beg, int len, RubyString repl) { - StringSupport.replaceInternal19(getRuntime(), beg, len, this, repl); + @Deprecated + private void replaceInternal19(Ruby runtime, int beg, int len, RubyString repl) { + strUpdate(runtime, beg, len, this, repl); } /** rb_str_aref, rb_str_aref_m @@ -3862,7 +3733,7 @@ public IRubyObject op_aref(ThreadContext context, IRubyObject arg) { } else if (arg instanceof RubyRange) { int len = strLength(); int[] begLen = ((RubyRange) arg).begLenInt(len, 0); - return begLen == null ? context.nil : substr19(runtime, begLen[0], begLen[1]); + return begLen == null ? context.nil : substrEnc(runtime, begLen[0], begLen[1]); } else { StringSites sites = sites(context); if (RubyRange.isRangeLike(context, arg, sites.respond_to_begin, sites.respond_to_end)) { @@ -3870,7 +3741,7 @@ public IRubyObject op_aref(ThreadContext context, IRubyObject arg) { RubyRange range = RubyRange.rangeFromRangeLike(context, arg, sites.begin, sites.end, sites.exclude_end); int[] begLen = range.begLenInt(len, 0); - return begLen == null ? context.nil : substr19(runtime, begLen[0], begLen[1]); + return begLen == null ? context.nil : substrEnc(runtime, begLen[0], begLen[1]); } } return op_aref(runtime, RubyNumeric.num2int(arg)); @@ -3880,7 +3751,8 @@ public IRubyObject op_aref(ThreadContext context, IRubyObject arg) { public IRubyObject op_aref(ThreadContext context, IRubyObject arg1, IRubyObject arg2) { Ruby runtime = context.runtime; if (arg1 instanceof RubyRegexp) return subpat(context, (RubyRegexp) arg1, arg2); - return substr19(runtime, RubyNumeric.num2int(arg1), RubyNumeric.num2int(arg2)); + int beg = RubyNumeric.num2int(arg1); + return substrEnc(runtime, beg, RubyNumeric.num2int(arg2)); } @JRubyMethod @@ -4109,7 +3981,7 @@ private void strUpdate1(int beg, int len, RubyString val, int vbeg, int vlen) { } private IRubyObject op_aref(Ruby runtime, int idx) { - IRubyObject str = substr19(runtime, idx, 1); + IRubyObject str = substrEnc(runtime, idx, 1); return !str.isNil() && ((RubyString) str).value.getRealSize() == 0 ? runtime.getNil() : str; } @@ -4206,11 +4078,14 @@ public IRubyObject op_aset(ThreadContext context, IRubyObject arg0, IRubyObject int beg = StringSupport.index(this, orig, 0, checkEncoding(orig)); if (beg < 0) throw context.runtime.newIndexError("string not matched"); beg = subLength(beg); - replaceInternal19(beg, orig.strLength(), arg1.convertToString()); + int len = orig.strLength(); + RubyString repl = arg1.convertToString(); + strUpdate(context.runtime, beg, len, this, repl); return arg1; } else if (arg0 instanceof RubyRange) { int[] begLen = ((RubyRange) arg0).begLenInt(strLength(), 2); - replaceInternal19(begLen[0], begLen[1], arg1.convertToString()); + RubyString repl = arg1.convertToString(); + strUpdate(context.runtime, begLen[0], begLen[1], this, repl); return arg1; } else { StringSites sites = sites(context); @@ -4218,7 +4093,8 @@ public IRubyObject op_aset(ThreadContext context, IRubyObject arg0, IRubyObject RubyRange rng = RubyRange.rangeFromRangeLike(context, arg0, sites.begin, sites.end, sites.exclude_end); int[] begLen = rng.begLenInt(strLength(), 2); - replaceInternal19(begLen[0], begLen[1], arg1.convertToString()); + RubyString repl = arg1.convertToString(); + strUpdate(context.runtime, begLen[0], begLen[1], this, repl); return arg1; } @@ -4227,7 +4103,8 @@ public IRubyObject op_aset(ThreadContext context, IRubyObject arg0, IRubyObject } private IRubyObject op_aset(ThreadContext context, int idx, IRubyObject arg1) { - StringSupport.replaceInternal19(context.runtime, idx, 1, this, arg1.convertToString()); + RubyString repl = arg1.convertToString(); + strUpdate(context.runtime, idx, 1, this, repl); return arg1; } @@ -4240,27 +4117,17 @@ public IRubyObject op_aset(ThreadContext context, IRubyObject arg0, IRubyObject int len = RubyNumeric.num2int(arg1); checkLength(len); RubyString repl = arg2.convertToString(); - StringSupport.replaceInternal19(context.runtime, beg, len, this, repl); + strUpdate(context.runtime, beg, len, this, repl); } return arg2; } - @Deprecated - public IRubyObject slice_bang19(ThreadContext context, IRubyObject arg0) { - return slice_bang(context, arg0); - } - - @Deprecated - public IRubyObject slice_bang19(ThreadContext context, IRubyObject arg0, IRubyObject arg1) { - return slice_bang(context, arg0, arg1); - } - /** rb_str_slice_bang * */ @JRubyMethod(name = "slice!", writes = BACKREF) public IRubyObject slice_bang(ThreadContext context, IRubyObject arg0) { - IRubyObject result = op_aref19(context, arg0); + IRubyObject result = op_aref(context, arg0); if (result.isNil()) { modifyCheck(); // keep cr ? } else { @@ -4275,21 +4142,11 @@ public IRubyObject slice_bang(ThreadContext context, IRubyObject arg0, IRubyObje if (result.isNil()) { modifyCheck(); // keep cr ? } else { - op_aset19(context, arg0, arg1, RubyString.newEmptyString(context.runtime)); + op_aset(context, arg0, arg1, RubyString.newEmptyString(context.runtime)); } return result; } - @Deprecated - public IRubyObject succ19(ThreadContext context) { - return succ(context); - } - - @Deprecated - public IRubyObject succ_bang19() { - return succ_bang(); - } - @JRubyMethod(name = {"succ", "next"}) public IRubyObject succ(ThreadContext context) { Ruby runtime = context.runtime; @@ -4314,16 +4171,6 @@ public IRubyObject succ_bang() { return this; } - @Deprecated - public final IRubyObject upto19(ThreadContext context, IRubyObject end, Block block) { - return upto(context, end, block); - } - - @Deprecated - public final IRubyObject upto19(ThreadContext context, IRubyObject end, IRubyObject excl, Block block) { - return upto(context, end, excl, block); - } - /** rb_str_upto_m * */ @@ -4489,11 +4336,6 @@ final IRubyObject uptoEndless(ThreadContext context, Block block) { return this; } - @Deprecated - public final RubyBoolean include_p19(ThreadContext context, IRubyObject obj) { - return include_p(context, obj); - } - /** rb_str_include * */ @@ -4505,7 +4347,7 @@ public RubyBoolean include_p(ThreadContext context, IRubyObject obj) { @JRubyMethod public IRubyObject chr(ThreadContext context) { - return substr19(context.runtime, 0, 1); + return substrEnc(context.runtime, 0, 1); } @JRubyMethod @@ -4525,7 +4367,7 @@ public IRubyObject setbyte(ThreadContext context, IRubyObject index, IRubyObject IRubyObject w = v.modulo(context, (long)256); int b = RubyNumeric.num2int(w) & 0xff; - modify19(); + modifyAndClearCodeRange(); value.getUnsafeBytes()[normalizedIndex] = (byte)b; return val; } @@ -4550,16 +4392,6 @@ public IRubyObject to_i(IRubyObject arg0) { return stringToInum(base); } - @Deprecated - public IRubyObject to_i19() { - return to_i(); - } - - @Deprecated - public IRubyObject to_i19(IRubyObject arg0) { - return to_i(arg0); - } - /** rb_str_to_inum * */ @@ -4576,11 +4408,6 @@ public final IRubyObject stringToInum(int base) { return stringToInum(base, false); } - @Deprecated - public final IRubyObject stringToInum19(int base, boolean badcheck) { - return stringToInum(base, badcheck); - } - /** rb_str_oct * */ @@ -4589,11 +4416,6 @@ public IRubyObject oct(ThreadContext context) { return stringToInum(-8, false); } - @Deprecated - public IRubyObject oct19(ThreadContext context) { - return oct(context); - } - /** rb_str_hex * */ @@ -4602,11 +4424,6 @@ public IRubyObject hex(ThreadContext context) { return stringToInum(16, false); } - @Deprecated - public IRubyObject hex19(ThreadContext context) { - return hex(context); - } - /** rb_str_to_f * */ @@ -4615,24 +4432,6 @@ public IRubyObject to_f() { return RubyNumeric.str2fnum(getRuntime(), this, false); } - @Deprecated - public IRubyObject to_f19() { - return to_f(); - } - - /** rb_str_split_m - * - */ - - @Deprecated - public RubyArray split19(ThreadContext context) { return split(context); } - - @Deprecated - public RubyArray split19(ThreadContext context, IRubyObject arg0) { return split(context, arg0); } - - @Deprecated - public RubyArray split19(ThreadContext context, IRubyObject arg0, IRubyObject arg1) { return split(context, arg0, arg1); } - private void populateCapturesForSplit(Ruby runtime, RubyArray result, RubyMatchData match) { for (int i = 1; i < match.numRegs(); i++) { int beg = match.begin(i); @@ -4649,6 +4448,9 @@ public RubyArray split(ThreadContext context, IRubyObject arg0) { return splitCommon(context, arg0, 0); } + /** rb_str_split_m + * + */ @JRubyMethod(name = "split") public IRubyObject splitWithBlock(ThreadContext context, Block block) { return splitWithBlock(context, context.nil, block); @@ -4685,11 +4487,6 @@ public IRubyObject splitWithBlock(ThreadContext context, IRubyObject pattern, IR return this; } - @Deprecated - public RubyArray split19(IRubyObject spat, ThreadContext context, boolean useBackref) { - return splitCommon(context, spat, 0); - } - /** * Split for ext (Java) callers (does not write $~). * @param delimiter @@ -5551,13 +5348,6 @@ private RubyString justifyCommon(Ruby runtime, ByteList pad, int padCharLen, boo /** rb_str_ljust * */ - - @Deprecated - public IRubyObject ljust19(IRubyObject arg0) { return ljust(arg0); } - - @Deprecated - public IRubyObject ljust19(IRubyObject arg0, IRubyObject arg1) { return ljust(arg0, arg1); } - @JRubyMethod(name = "ljust") public IRubyObject ljust(IRubyObject arg0) { return justify(getRuntime(), arg0, 'l'); @@ -5571,13 +5361,6 @@ public IRubyObject ljust(IRubyObject arg0, IRubyObject arg1) { /** rb_str_rjust * */ - - @Deprecated - public IRubyObject rjust19(IRubyObject arg0) { return rjust(arg0); } - - @Deprecated - public IRubyObject rjust19(IRubyObject arg0, IRubyObject arg1) { return rjust(arg0, arg1); } - @JRubyMethod(name = "rjust") public IRubyObject rjust(IRubyObject arg0) { return justify(getRuntime(), arg0, 'r'); @@ -5591,13 +5374,6 @@ public IRubyObject rjust(IRubyObject arg0, IRubyObject arg1) { /** rb_str_center * */ - - @Deprecated - public IRubyObject center19(IRubyObject arg0) { return center(arg0); } - - @Deprecated - public IRubyObject center19(IRubyObject arg0, IRubyObject arg1) { return center(arg0, arg1); } - @JRubyMethod(name = "center") public IRubyObject center(IRubyObject arg0) { return justify(getRuntime(), arg0, 'c'); @@ -5662,10 +5438,12 @@ public IRubyObject rpartition(ThreadContext context, IRubyObject arg) { if (pos < 0) return rpartitionMismatch(runtime); } + int beg = pos + sep.strLength(); + int len = value.getRealSize(); return RubyArray.newArrayNoCopy(runtime, new IRubyObject[] { - substr19(runtime, 0, pos), + substrEnc(runtime, 0, pos), sep, - substr19(runtime, pos + sep.strLength(), value.getRealSize()) + substrEnc(runtime, beg, len) }); } @@ -5677,13 +5455,6 @@ private IRubyObject rpartitionMismatch(Ruby runtime) { /** rb_str_chop / rb_str_chop_bang * */ - - @Deprecated - public IRubyObject chop19(ThreadContext context) { return chop(context); } - - @Deprecated - public IRubyObject chop_bang19(ThreadContext context) { return chop_bang(context); } - @JRubyMethod(name = "chop") public IRubyObject chop(ThreadContext context) { Ruby runtime = context.runtime; @@ -5705,12 +5476,24 @@ public IRubyObject chop_bang(ThreadContext context) { return context.nil; } - public RubyString chomp(ThreadContext context) { - return chomp19(context); + @Deprecated + public RubyString chomp19(ThreadContext context) { + return chomp(context); } - public RubyString chomp(ThreadContext context, IRubyObject arg0) { - return chomp19(context, arg0); + @Deprecated + public RubyString chomp19(ThreadContext context, IRubyObject arg0) { + return chomp(context, arg0); + } + + @Deprecated + public IRubyObject chomp_bang19(ThreadContext context) { + return chomp_bang(context); + } + + @Deprecated + public IRubyObject chomp_bang19(ThreadContext context, IRubyObject arg0) { + return chomp_bang(context, arg0); } /** @@ -5723,30 +5506,22 @@ public RubyString chomp(ThreadContext context, IRubyObject arg0) { * If args.length>0 and args[0] is "" then removes trailing multiple LF or CRLF (but no CRs at * all(!)). */ - public IRubyObject chomp_bang(ThreadContext context) { - return chomp_bang19(context); - } - - public IRubyObject chomp_bang(ThreadContext context, IRubyObject arg0) { - return chomp_bang19(context, arg0); - } - @JRubyMethod(name = "chomp") - public RubyString chomp19(ThreadContext context) { + public RubyString chomp(ThreadContext context) { RubyString str = strDup(context.runtime, context.runtime.getString()); - str.chomp_bang19(context); + str.chomp_bang(context); return str; } @JRubyMethod(name = "chomp") - public RubyString chomp19(ThreadContext context, IRubyObject arg0) { + public RubyString chomp(ThreadContext context, IRubyObject arg0) { RubyString str = strDup(context.runtime, context.runtime.getString()); - str.chomp_bang19(context, arg0); + str.chomp_bang(context, arg0); return str; } @JRubyMethod(name = "chomp!") - public IRubyObject chomp_bang19(ThreadContext context) { + public IRubyObject chomp_bang(ThreadContext context) { modifyCheck(); Ruby runtime = context.runtime; if (value.getRealSize() == 0) return context.nil; @@ -5758,7 +5533,7 @@ public IRubyObject chomp_bang19(ThreadContext context) { } @JRubyMethod(name = "chomp!") - public IRubyObject chomp_bang19(ThreadContext context, IRubyObject arg0) { + public IRubyObject chomp_bang(ThreadContext context, IRubyObject arg0) { modifyCheck(); if (value.getRealSize() == 0) return context.nil; return chompBangCommon(context.runtime, arg0); @@ -5846,13 +5621,6 @@ private IRubyObject smartChopBangCommon(Ruby runtime) { /** rb_str_lstrip / rb_str_lstrip_bang * */ - - @Deprecated - public IRubyObject lstrip19(ThreadContext context) { return lstrip(context); } - - @Deprecated - public IRubyObject lstrip_bang19(ThreadContext context) { return lstrip_bang(context); } - @JRubyMethod(name = "lstrip") public IRubyObject lstrip(ThreadContext context) { RubyString str = strDup(context.runtime, context.runtime.getString()); @@ -5911,13 +5679,6 @@ private IRubyObject multiByteLStrip(ThreadContext context, Encoding enc, byte[]b /** rb_str_rstrip / rb_str_rstrip_bang * */ - - @Deprecated - public IRubyObject rstrip19(ThreadContext context) { return rstrip(context); } - - @Deprecated - public IRubyObject rstrip_bang19(ThreadContext context) { return rstrip_bang(context); } - @JRubyMethod(name = "rstrip") public IRubyObject rstrip(ThreadContext context) { RubyString str = strDup(context.runtime, context.runtime.getString()); @@ -5982,13 +5743,6 @@ private IRubyObject multiByteRStrip(ThreadContext context) { /** rb_str_strip / rb_str_strip_bang * */ - - @Deprecated - public IRubyObject strip19(ThreadContext context) { return strip(context); } - - @Deprecated - public IRubyObject strip_bang19(ThreadContext context) { return strip_bang(context); } - @JRubyMethod(name = "strip") public IRubyObject strip(ThreadContext context) { RubyString str = strDup(context.runtime, context.runtime.getString()); @@ -6000,21 +5754,12 @@ public IRubyObject strip(ThreadContext context) { public IRubyObject strip_bang(ThreadContext context) { modifyCheck(); - IRubyObject left = lstrip_bang19(context); - IRubyObject right = rstrip_bang19(context); + IRubyObject left = lstrip_bang(context); + IRubyObject right = rstrip_bang(context); return left == context.nil && right == context.nil ? context.nil : this; } - @Deprecated - public IRubyObject count19(ThreadContext context) { return count(context); } - - @Deprecated - public IRubyObject count19(ThreadContext context, IRubyObject arg) { return count(context, arg); } - - @Deprecated - public IRubyObject count19(ThreadContext context, IRubyObject[] args) { return count(context, args); } - @JRubyMethod(name = "count") public IRubyObject count(ThreadContext context) { throw context.runtime.newArgumentError("wrong number of arguments"); @@ -6147,36 +5892,6 @@ public IRubyObject delete_bang(ThreadContext context, IRubyObject[] args) { return this; } - @Deprecated - public IRubyObject delete19(ThreadContext context) { - return delete(context); - } - - @Deprecated - public IRubyObject delete19(ThreadContext context, IRubyObject arg) { - return delete(context, arg); - } - - @Deprecated - public IRubyObject delete19(ThreadContext context, IRubyObject[] args) { - return delete(context, args); - } - - @Deprecated - public IRubyObject delete_bang19(ThreadContext context) { - return delete_bang(context); - } - - @Deprecated - public IRubyObject delete_bang19(ThreadContext context, IRubyObject arg) { - return delete_bang(context, arg); - } - - @Deprecated - public IRubyObject delete_bang19(ThreadContext context, IRubyObject[] args) { - return delete_bang(context, args); - } - /** rb_str_squeeze / rb_str_squeeze_bang * */ @@ -6287,59 +6002,31 @@ public IRubyObject squeeze_bang(ThreadContext context, IRubyObject[] args) { } @Deprecated - public IRubyObject squeeze19(ThreadContext context) { - return squeeze(context); - } - - @Deprecated - public IRubyObject squeeze19(ThreadContext context, IRubyObject arg) { - return squeeze(context, arg); - } - - @Deprecated - public IRubyObject squeeze19(ThreadContext context, IRubyObject[] args) { - return squeeze(context, args); - } - - @Deprecated - public IRubyObject squeeze_bang19(ThreadContext context) { - return squeeze_bang(context); - } - - @Deprecated - public IRubyObject squeeze_bang19(ThreadContext context, IRubyObject arg) { - return squeeze_bang(context, arg); + public IRubyObject tr19(ThreadContext context, IRubyObject src, IRubyObject repl) { + return tr(context, src, repl); } @Deprecated - public IRubyObject squeeze_bang19(ThreadContext context, IRubyObject[] args) { - return squeeze_bang(context, args); + public IRubyObject tr_bang19(ThreadContext context, IRubyObject src, IRubyObject repl) { + return tr_bang(context, src, repl); } /** rb_str_tr / rb_str_tr_bang * */ - public IRubyObject tr(ThreadContext context, IRubyObject src, IRubyObject repl) { - return tr19(context, src, repl); - } - - public IRubyObject tr_bang(ThreadContext context, IRubyObject src, IRubyObject repl) { - return tr_bang19(context, src, repl); - } - @JRubyMethod(name = "tr") - public IRubyObject tr19(ThreadContext context, IRubyObject src, IRubyObject repl) { + public IRubyObject tr(ThreadContext context, IRubyObject src, IRubyObject repl) { RubyString str = strDup(context.runtime, context.runtime.getString()); - str.trTrans19(context, src, repl, false); + str.trTrans(context, src, repl, false); return str; } @JRubyMethod(name = "tr!") - public IRubyObject tr_bang19(ThreadContext context, IRubyObject src, IRubyObject repl) { - return trTrans19(context, src, repl, false); + public IRubyObject tr_bang(ThreadContext context, IRubyObject src, IRubyObject repl) { + return trTrans(context, src, repl, false); } - private IRubyObject trTrans19(ThreadContext context, IRubyObject src, IRubyObject repl, boolean sflag) { + private IRubyObject trTrans(ThreadContext context, IRubyObject src, IRubyObject repl, boolean sflag) { RubyString replStr = repl.convertToString(); ByteList replList = replStr.value; RubyString srcStr = src.convertToString(); @@ -6351,27 +6038,29 @@ private IRubyObject trTrans19(ThreadContext context, IRubyObject src, IRubyObjec return (ret == null) ? context.nil : (IRubyObject) ret; } - /** rb_str_tr_s / rb_str_tr_s_bang - * - */ - public IRubyObject tr_s(ThreadContext context, IRubyObject src, IRubyObject repl) { - return tr_s19(context, src, repl); + @Deprecated + public IRubyObject tr_s19(ThreadContext context, IRubyObject src, IRubyObject repl) { + return tr_s(context, src, repl); } - public IRubyObject tr_s_bang(ThreadContext context, IRubyObject src, IRubyObject repl) { - return tr_s_bang19(context, src, repl); + @Deprecated + public IRubyObject tr_s_bang19(ThreadContext context, IRubyObject src, IRubyObject repl) { + return tr_s_bang(context, src, repl); } + /** rb_str_tr_s / rb_str_tr_s_bang + * + */ @JRubyMethod(name = "tr_s") - public IRubyObject tr_s19(ThreadContext context, IRubyObject src, IRubyObject repl) { + public IRubyObject tr_s(ThreadContext context, IRubyObject src, IRubyObject repl) { RubyString str = strDup(context.runtime, context.runtime.getString()); - str.trTrans19(context, src, repl, true); + str.trTrans(context, src, repl, true); return str; } @JRubyMethod(name = "tr_s!") - public IRubyObject tr_s_bang19(ThreadContext context, IRubyObject src, IRubyObject repl) { - return trTrans19(context, src, repl, true); + public IRubyObject tr_s_bang(ThreadContext context, IRubyObject src, IRubyObject repl) { + return trTrans(context, src, repl, true); } /** rb_str_each_line @@ -6441,16 +6130,6 @@ public IRubyObject each_lineCommon(ThreadContext context, IRubyObject sep, Block return this; } - @Deprecated - public IRubyObject each_line19(ThreadContext context, Block block) { - return each_line(context, block); - } - - @Deprecated - public IRubyObject each_line19(ThreadContext context, IRubyObject arg, Block block) { - return each_line(context, arg, block); - } - @JRubyMethod(name = "lines") public IRubyObject lines(ThreadContext context, Block block) { return StringSupport.rbStrEnumerateLines(this, context, "lines", context.runtime.getGlobalVariables().get("$/"), block, true); @@ -6474,11 +6153,6 @@ public IRubyObject each_byte(ThreadContext context, Block block) { return enumerateBytes(context, "each_byte", block, false); } - @Deprecated - public IRubyObject each_byte19(ThreadContext context, Block block) { - return each_byte(context, block); - } - @JRubyMethod public IRubyObject bytes(ThreadContext context, Block block) { return enumerateBytes(context, "bytes", block, true); @@ -6494,16 +6168,6 @@ public IRubyObject chars(ThreadContext context, Block block) { return enumerateChars(context, "chars", block, true); } - @Deprecated - public IRubyObject each_char19(ThreadContext context, Block block) { - return each_char(context, block); - } - - @Deprecated - public IRubyObject chars19(ThreadContext context, Block block) { - return chars(context, block); - } - /** * A character size method suitable for lambda method reference implementation of {@link SizeFn#size(ThreadContext, IRubyObject, IRubyObject[])} * @@ -6746,11 +6410,6 @@ public RubySymbol intern() { return symbol; } - @Deprecated - public RubySymbol intern19() { - return intern(); - } - @JRubyMethod public IRubyObject ord(ThreadContext context) { final Ruby runtime = context.runtime; @@ -6890,28 +6549,28 @@ public IRubyObject encoding(ThreadContext context) { @JRubyMethod(name = "encode!") public IRubyObject encode_bang(ThreadContext context) { - modify19(); + modifyAndClearCodeRange(); return EncodingUtils.strTranscode(context, this, RubyString::updateFromTranscode); } @JRubyMethod(name = "encode!") public IRubyObject encode_bang(ThreadContext context, IRubyObject arg0) { - modify19(); + modifyAndClearCodeRange(); return EncodingUtils.strTranscode(context, arg0, this, RubyString::updateFromTranscode); } @JRubyMethod(name = "encode!") public IRubyObject encode_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1) { - modify19(); + modifyAndClearCodeRange(); return EncodingUtils.strTranscode(context, arg0, arg1, this, RubyString::updateFromTranscode); } @JRubyMethod(name = "encode!") public IRubyObject encode_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { - modify19(); + modifyAndClearCodeRange(); return EncodingUtils.strTranscode(context, arg0, arg1, arg2, this, RubyString::updateFromTranscode); } @@ -6956,7 +6615,7 @@ public IRubyObject force_encoding(ThreadContext context, IRubyObject enc) { private IRubyObject force_encoding(Encoding encoding) { modifyCheck(); - modify19(); + modifyAndClearCodeRange(); associateEncoding(encoding); clearCodeRange(); return this; @@ -7472,69 +7131,6 @@ public final RubyString strDup() { return strDup(getRuntime(), getMetaClass().getRealClass()); } - @Deprecated - public final void modify19(int length) { - modifyExpand(length); - } - - @Deprecated - public RubyArray split19(ThreadContext context, IRubyObject arg0, boolean useBackref) { - return split(context, arg0); - } - - @Deprecated - public IRubyObject lines20(ThreadContext context, Block block) { - return lines(context, block); - } - - @Deprecated - public IRubyObject lines20(ThreadContext context, IRubyObject arg, Block block) { - return lines(context, arg, block); - } - - @Deprecated - public IRubyObject dump19() { - return dump(); - } - - @Deprecated - public IRubyObject insert19(ThreadContext context, IRubyObject indexArg, IRubyObject stringArg) { - return insert(context, indexArg, stringArg); - } - - @Deprecated - public IRubyObject op_equal19(ThreadContext context, IRubyObject other) { - return op_equal(context, other); - } - - @Deprecated - public IRubyObject op_aref19(ThreadContext context, IRubyObject arg1, IRubyObject arg2) { - return op_aref(context, arg1, arg2); - } - - @Deprecated - public IRubyObject op_aref19(ThreadContext context, IRubyObject arg) { - return op_aref(context, arg); - } - - @Deprecated - public IRubyObject op_aset19(ThreadContext context, IRubyObject arg0, IRubyObject arg1) { - return op_aset(context, arg0, arg1); - } - - @Deprecated - public IRubyObject op_aset19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { - return op_aset(context, arg0, arg1, arg2); - } - - @Deprecated - public IRubyObject op_match19(ThreadContext context, IRubyObject other) { - return op_match(context, other); - } - - @Deprecated - public IRubyObject scan19(ThreadContext context, IRubyObject arg, Block block) { return scan(context, arg, block); } - @Deprecated // not used public RubyArray unpack(IRubyObject obj) { return Pack.unpack(getRuntime(), this.value, stringValue(obj).value); @@ -7544,7 +7140,7 @@ public RubyArray unpack(IRubyObject obj) { public IRubyObject encode_bang(ThreadContext context, IRubyObject[] args) { Arity.checkArgumentCount(context, args, 0, 2); - modify19(); + modifyAndClearCodeRange(); return EncodingUtils.strTranscode(context, args, this, RubyString::updateFromTranscode); } diff --git a/core/src/main/java/org/jruby/RubyStruct.java b/core/src/main/java/org/jruby/RubyStruct.java index 1907568acb5..1b4e7b4c9bb 100644 --- a/core/src/main/java/org/jruby/RubyStruct.java +++ b/core/src/main/java/org/jruby/RubyStruct.java @@ -346,7 +346,7 @@ public static IRubyObject newStruct(IRubyObject recv, IRubyObject arg0, IRubyObj @JRubyMethod public static IRubyObject members(IRubyObject recv, Block block) { - return RubyStruct.members19(recv, block); + return RubyStruct.members(recv, block); } @JRubyMethod @@ -557,11 +557,6 @@ public RubyArray members() { return members(classOf()); } - @Deprecated - public final RubyArray members19() { - return members(); - } - @JRubyMethod public IRubyObject select(ThreadContext context, Block block) { if (!block.isGiven()) { @@ -683,12 +678,12 @@ else if (first != '#') { } RubySymbol slot = (RubySymbol) member.eltInternal(i); if (slot.validLocalVariableName() || slot.validConstantName()) { - buffer.cat19(RubyString.objAsString(context, slot)); + buffer.catWithCodeRange(RubyString.objAsString(context, slot)); } else { - buffer.cat19(((RubyString) slot.inspect(context))); + buffer.catWithCodeRange(((RubyString) slot.inspect(context))); } buffer.cat('='); - buffer.cat19(inspect(context, values[i])); + buffer.catWithCodeRange(inspect(context, values[i])); } buffer.cat('>'); @@ -1012,11 +1007,6 @@ public int getIndex() { } } - @Deprecated - public static RubyArray members19(IRubyObject recv, Block block) { - return members(recv, block); - } - private static class EqlRecursive implements ThreadContext.RecursiveFunctionEx { static final EqlRecursive INSTANCE = new EqlRecursive(); diff --git a/core/src/main/java/org/jruby/RubySymbol.java b/core/src/main/java/org/jruby/RubySymbol.java index a06bdffe600..506b782b24f 100644 --- a/core/src/main/java/org/jruby/RubySymbol.java +++ b/core/src/main/java/org/jruby/RubySymbol.java @@ -460,11 +460,6 @@ final RubyString inspect(final Ruby runtime) { return RubyString.newString(runtime, result); } - @Deprecated - public IRubyObject inspect19(ThreadContext context) { - return inspect(context); - } - @Override public IRubyObject to_s() { return to_s(metaClass.runtime); @@ -556,9 +551,6 @@ public int compareTo(final IRubyObject that) { @JRubyMethod(name = { "to_sym", "intern" }) public IRubyObject to_sym() { return this; } - @Deprecated - public IRubyObject to_sym19() { return this; } - private RubyString newShared(Ruby runtime) { return RubyString.newStringShared(runtime, symbolBytes); } @@ -602,17 +594,17 @@ public IRubyObject op_match(ThreadContext context, IRubyObject other) { @JRubyMethod(name = "match") public IRubyObject match_m(ThreadContext context, IRubyObject other, Block block) { - return newShared(context.runtime).match19(context, other, block); + return newShared(context.runtime).match(context, other, block); } @JRubyMethod(name = "match") public IRubyObject match_m(ThreadContext context, IRubyObject other, IRubyObject pos, Block block) { - return newShared(context.runtime).match19(context, other, pos, block); + return newShared(context.runtime).match(context, other, pos, block); } @JRubyMethod(name = "match", required = 1, rest = true, checkArity = false) public IRubyObject match_m(ThreadContext context, IRubyObject[] args, Block block) { - return newShared(context.runtime).match19(context, args, block); + return newShared(context.runtime).match(context, args, block); } @JRubyMethod(name = "match?") diff --git a/core/src/main/java/org/jruby/RubyTime.java b/core/src/main/java/org/jruby/RubyTime.java index ece075817e7..d924a67aff2 100644 --- a/core/src/main/java/org/jruby/RubyTime.java +++ b/core/src/main/java/org/jruby/RubyTime.java @@ -615,15 +615,6 @@ private RubyTime adjustTimeZone(Ruby runtime, final DateTimeZone zone, boolean i return this; } - @Deprecated - public final RubyTime localtime19(ThreadContext context, IRubyObject[] args) { - switch(args.length) { - case 0: return localtime(context); - case 1: return localtime(context, args[0]); - } - throw new AssertionError(java.util.Arrays.toString(args)); - } - @JRubyMethod(name = {"gmt?", "utc?", "gmtime?"}) public RubyBoolean gmt() { return metaClass.runtime.newBoolean(isUTC()); @@ -675,15 +666,6 @@ else if (dtz == DateTimeZone.UTC) { return ((RubyTime) dup()).adjustTimeZone(runtime, dtz, false); } - @Deprecated - public RubyTime getlocal19(ThreadContext context, IRubyObject[] args) { - switch(args.length) { - case 0: return getlocal(context); - case 1: return getlocal(context, args[0]); - } - throw new AssertionError(java.util.Arrays.toString(args)); - } - @Deprecated public RubyString strftime(IRubyObject format) { return strftime(getRuntime().getCurrentContext(), format); @@ -786,11 +768,6 @@ public IRubyObject op_plus(ThreadContext context, IRubyObject other) { return opPlusMillis(context.runtime, adjustMillis); } - @Deprecated - public IRubyObject op_plus19(ThreadContext context, IRubyObject other) { - return op_plus(context, other); - } - private RubyTime opPlusMillis(final Ruby runtime, double adjustMillis) { long currentMillis = getTimeInMillis(); @@ -829,11 +806,6 @@ public IRubyObject op_minus(ThreadContext context, IRubyObject other) { return opMinus(context.runtime, RubyNumeric.num2dbl(context, numExact(context, other))); } - - @Deprecated - public IRubyObject op_minus19(ThreadContext context, IRubyObject other) { - return op_minus(context, other); - } private RubyTime opMinus(Ruby runtime, double other) { long adjustmentInNanos = (long) (other * 1000000000); @@ -934,11 +906,6 @@ public IRubyObject inspect() { return RubyString.newString(getRuntime(), builder.toString(), USASCIIEncoding.INSTANCE); } - @Deprecated - public final IRubyObject to_s19() { - return to_s(); - } - private DateTime getInspectDateTime() { if (isTzRelative) { // display format needs to invert the UTC offset if this object was diff --git a/core/src/main/java/org/jruby/embed/util/SystemPropertyCatcher.java b/core/src/main/java/org/jruby/embed/util/SystemPropertyCatcher.java index dcd94ee8755..00db5a184e5 100644 --- a/core/src/main/java/org/jruby/embed/util/SystemPropertyCatcher.java +++ b/core/src/main/java/org/jruby/embed/util/SystemPropertyCatcher.java @@ -256,19 +256,6 @@ public static List findLoadPaths() { return loadPaths; } - /** - * Checks that a given name is an appropriate configuration parameter to - * choose Ruby 1.9 mode. - * - * @param name a possible name that expresses Ruby 1.9. - * @return true is the given name is correct to choose Ruby 1.9 version. Otherwise, - * returns false. - */ - @Deprecated - public static boolean isRuby19(String name) { - return matches(name.toLowerCase(), "j?ruby1[\\._]?9"); - } - private static boolean matches(final String name, final String pattern) { Matcher matcher = Pattern.compile(pattern).matcher( name ); return matcher.matches(); diff --git a/core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java b/core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java index 6aafff7190c..b100eb338e9 100644 --- a/core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java +++ b/core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java @@ -1008,22 +1008,12 @@ public IRubyObject op_mod(ThreadContext context, IRubyObject other) { return new RubyBigDecimal(context.runtime, modulo).setResult(); } - @Deprecated - public IRubyObject op_mod19(ThreadContext context, IRubyObject arg) { - return op_mod(context, arg); - } - @Override @JRubyMethod(name = "remainder") public IRubyObject remainder(ThreadContext context, IRubyObject arg) { return remainderInternal(context, getVpValueWithPrec(context, arg, false), arg); } - @Deprecated - public IRubyObject remainder19(ThreadContext context, IRubyObject arg) { - return remainder(context, arg); - } - private IRubyObject remainderInternal(ThreadContext context, RubyBigDecimal val, IRubyObject arg) { if (isInfinity() || isNaN()) return getNaN(context.runtime); if (val == null) return callCoerced(context, sites(context).remainder, arg, true); @@ -1041,11 +1031,6 @@ public IRubyObject op_mul(ThreadContext context, IRubyObject arg) { return multImpl(context.runtime, val); } - @Deprecated - public IRubyObject op_mul19(ThreadContext context, IRubyObject arg) { - return op_mul(context, arg); - } - @JRubyMethod(name = "mult") public IRubyObject mult2(ThreadContext context, IRubyObject b, IRubyObject n) { final int mx = getPrecisionInt(context.runtime, n); @@ -1115,11 +1100,6 @@ private static IRubyObject handleFloatDomainError(Ruby runtime, String message, throw runtime.newFloatDomainError(message); } - @Deprecated - public IRubyObject mult219(ThreadContext context, IRubyObject b, IRubyObject n) { - return mult2(context, b, n); - } - // Calculate appropriate zero or infinity depending on exponent... private RubyBigDecimal newPowOfInfinity(ThreadContext context, RubyNumeric exp) { if (Numeric.f_negative_p(context, exp)) { @@ -1323,11 +1303,6 @@ public IRubyObject add2(ThreadContext context, IRubyObject b, IRubyObject digits return addInternal(context, getVpValueWithPrec(context, b, false), b, digits); } - @Deprecated - public IRubyObject add219(ThreadContext context, IRubyObject b, IRubyObject digits) { - return add2(context, b, digits); - } - private IRubyObject addInternal(ThreadContext context, RubyBigDecimal val, IRubyObject b, IRubyObject digits) { final Ruby runtime = context.runtime; int prec = getPositiveInt(context, digits); @@ -1410,21 +1385,11 @@ public IRubyObject op_minus(ThreadContext context, IRubyObject b) { return subInternal(context, getVpValueWithPrec(context, b, false), b, 0); } - @Deprecated - public IRubyObject op_minus19(ThreadContext context, IRubyObject b) { - return op_minus(context, b); - } - @JRubyMethod(name = "sub") public IRubyObject sub2(ThreadContext context, IRubyObject b, IRubyObject n) { return subInternal(context, getVpValueWithPrec(context, b, false), b, getPositiveInt(context, n)); } - @Deprecated - public IRubyObject sub219(ThreadContext context, IRubyObject b, IRubyObject n) { - return sub2(context, b, n); - } - private IRubyObject subInternal(ThreadContext context, RubyBigDecimal val, IRubyObject b, int prec) { if (val == null) return ((RubyBigDecimal)callCoerced(context, sites(context).op_minus, b, true)).setResult(prec); RubyBigDecimal res = subSpecialCases(context, val); @@ -1566,16 +1531,6 @@ private static RubyBigDecimal div2Impl(ThreadContext context, RubyNumeric a, Rub return new RubyBigDecimal(context.runtime, thiz.value.divide(that.value, mathContext)).setResult(ix); } - @Deprecated - public IRubyObject op_quo19(ThreadContext context, IRubyObject other) { - return op_quo(context, other); - } - - @Deprecated - public IRubyObject op_quo20(ThreadContext context, IRubyObject other) { - return op_quo(context, other); - } - // mri : BigDecimal_div3 @JRubyMethod(name = "div") public IRubyObject op_div(ThreadContext context, IRubyObject other) { @@ -1657,16 +1612,6 @@ private RubyBigDecimal divSpecialCases(ThreadContext context, RubyBigDecimal val return null; } - @Deprecated - public final IRubyObject op_div19(ThreadContext context, IRubyObject r) { - return op_div(context, r); - } - - @Deprecated - public final IRubyObject op_div19(ThreadContext context, IRubyObject other, IRubyObject digits) { - return op_div(context, other, digits); - } - private IRubyObject cmp(ThreadContext context, final IRubyObject arg, final char op) { final int e; RubyBigDecimal rb; @@ -2313,11 +2258,6 @@ public IRubyObject to_r(ThreadContext context) { return RubyRational.newInstance(context, RubyBignum.newBignum(context.runtime, numerator), RubyBignum.newBignum(context.runtime, denominator)); } - @Deprecated // not-used - public IRubyObject to_int19() { - return to_int(); - } - private static String removeTrailingZeroes(final String str) { int l = str.length(); while (l > 0 && str.charAt(l-1) == '0') l--; diff --git a/core/src/main/java/org/jruby/ext/date/RubyDate.java b/core/src/main/java/org/jruby/ext/date/RubyDate.java index 90ec12e50c8..886f9de406c 100644 --- a/core/src/main/java/org/jruby/ext/date/RubyDate.java +++ b/core/src/main/java/org/jruby/ext/date/RubyDate.java @@ -2406,7 +2406,7 @@ private static IRubyObject s3e(ThreadContext context, final RubyHash hash, int ep = skipDigits(y, s); if (ep != y.strLength()) { oy = y; y = d; - d = (RubyString) oy.substr19(context.runtime, bp, ep - bp); + d = (RubyString) oy.substrEnc(context.runtime, bp, ep - bp); } } diff --git a/core/src/main/java/org/jruby/ext/ripper/RubyRipper.java b/core/src/main/java/org/jruby/ext/ripper/RubyRipper.java index b5beab8510e..18f4d10f86d 100644 --- a/core/src/main/java/org/jruby/ext/ripper/RubyRipper.java +++ b/core/src/main/java/org/jruby/ext/ripper/RubyRipper.java @@ -371,7 +371,7 @@ public IRubyObject yydebug_set(ThreadContext context, IRubyObject arg) { public static IRubyObject dedent_string(ThreadContext context, IRubyObject self, IRubyObject _input, IRubyObject _width) { RubyString input = _input.convertToString(); int wid = _width.convertToInteger().getIntValue(); - input.modify19(); + input.modifyAndClearCodeRange(); int col = LexingCommon.dedent_string(input.getByteList(), wid); return context.runtime.newFixnum(col); } diff --git a/core/src/main/java/org/jruby/ext/set/RubySet.java b/core/src/main/java/org/jruby/ext/set/RubySet.java index 8420328d964..b49e344175e 100644 --- a/core/src/main/java/org/jruby/ext/set/RubySet.java +++ b/core/src/main/java/org/jruby/ext/set/RubySet.java @@ -1215,7 +1215,7 @@ private void inspectSet(final ThreadContext context, final RubyString str) { final RubyString s = inspect(context, elem); if ( notFirst ) str.cat((byte) ',').cat((byte) ' '); else str.setEncoding( s.getEncoding() ); notFirst = true; - str.cat19( s ); + str.catWithCodeRange(s); } str.cat((byte) '}'); diff --git a/core/src/main/java/org/jruby/ext/socket/RubyBasicSocket.java b/core/src/main/java/org/jruby/ext/socket/RubyBasicSocket.java index a78e23fbc41..08b3fbf517b 100644 --- a/core/src/main/java/org/jruby/ext/socket/RubyBasicSocket.java +++ b/core/src/main/java/org/jruby/ext/socket/RubyBasicSocket.java @@ -117,14 +117,14 @@ public static IRubyObject for_fd(ThreadContext context, IRubyObject _klass, IRub } @JRubyMethod(name = "do_not_reverse_lookup") - public IRubyObject do_not_reverse_lookup19(ThreadContext context) { + public IRubyObject do_not_reverse_lookup(ThreadContext context) { return RubyBoolean.newBoolean(context, doNotReverseLookup); } @JRubyMethod(name = "do_not_reverse_lookup=") - public IRubyObject set_do_not_reverse_lookup19(ThreadContext context, IRubyObject flag) { + public IRubyObject set_do_not_reverse_lookup(ThreadContext context, IRubyObject flag) { doNotReverseLookup = flag.isTrue(); - return do_not_reverse_lookup19(context); + return do_not_reverse_lookup(context); } @JRubyMethod(meta = true) diff --git a/core/src/main/java/org/jruby/ext/tempfile/Tempfile.java b/core/src/main/java/org/jruby/ext/tempfile/Tempfile.java index 11fcc1a4e72..29bfec06139 100644 --- a/core/src/main/java/org/jruby/ext/tempfile/Tempfile.java +++ b/core/src/main/java/org/jruby/ext/tempfile/Tempfile.java @@ -231,11 +231,6 @@ public IRubyObject size(ThreadContext context) { } } - @Deprecated - public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { - return open(context, recv, args, block); - } - @JRubyMethod(optional = 4, checkArity = false, meta = true, keywords = true) public static IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { RubyClass klass = (RubyClass) recv; diff --git a/core/src/main/java/org/jruby/ext/zlib/JZlibRubyGzipReader.java b/core/src/main/java/org/jruby/ext/zlib/JZlibRubyGzipReader.java index 187d4db7bd6..e7a3a09b7d7 100644 --- a/core/src/main/java/org/jruby/ext/zlib/JZlibRubyGzipReader.java +++ b/core/src/main/java/org/jruby/ext/zlib/JZlibRubyGzipReader.java @@ -91,7 +91,7 @@ public static JZlibRubyGzipReader newInstance(IRubyObject recv, IRubyObject[] ar } @JRubyMethod(name = "open", required = 1, optional = 1, checkArity = false, meta = true) - public static IRubyObject open19(final ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { + public static IRubyObject open(final ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { Arity.checkArgumentCount(context, args, 1, 2); Ruby runtime = recv.getRuntime(); @@ -143,7 +143,7 @@ public IRubyObject initialize(ThreadContext context, IRubyObject stream) { } @JRubyMethod(name = "initialize", required = 1, optional = 1, checkArity = false, visibility = PRIVATE) - public IRubyObject initialize19(ThreadContext context, IRubyObject[] args) { + public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { int argc = Arity.checkArgumentCount(context, args, 1, 2); Ruby runtime = context.runtime; @@ -484,45 +484,60 @@ public IRubyObject readchar() { } } - @JRubyMethod(name = "getbyte") + @Deprecated public IRubyObject getc() { + return getbyte(getRuntime().getCurrentContext()); + } + + @JRubyMethod(name = "getbyte") + public IRubyObject getbyte(ThreadContext context) { + Ruby runtime = context.runtime; + try { int value = bufferedStream.read(); - if (value == -1) return getRuntime().getNil(); + if (value == -1) return runtime.getNil(); position++; - return getRuntime().newFixnum(value); + return runtime.newFixnum(value); } catch (IOException ioe) { - throw getRuntime().newIOErrorFromException(ioe); + throw runtime.newIOErrorFromException(ioe); } } + @Deprecated public IRubyObject getbyte() { - return getc(); + return getbyte(getRuntime().getCurrentContext()); } - @JRubyMethod(name = "readbyte") + @Deprecated public IRubyObject readbyte() { - IRubyObject dst = getbyte(); + return readbyte(getRuntime().getCurrentContext()); + } + + @JRubyMethod(name = "readbyte") + public IRubyObject readbyte(ThreadContext context) { + IRubyObject dst = getbyte(context); if (dst.isNil()) { - throw getRuntime().newEOFError(); + throw context.runtime.newEOFError(); } return dst; } @JRubyMethod(name = "getc") - public IRubyObject getc_19() { + public IRubyObject getc(ThreadContext context) { + Ruby runtime = context.runtime; + try { int value = bufferedStream.read(); - if (value == -1) return getRuntime().getNil(); + if (value == -1) return runtime.getNil(); position++; // TODO: must handle encoding. Move encoding handling methods to util class from RubyIO and use it. // TODO: StringIO needs a love, too. - return getRuntime().newString(String.valueOf((char) (value & 0xFF))); + return runtime.newString(String.valueOf((char) (value & 0xFF))); } catch (IOException ioe) { - throw getRuntime().newIOErrorFromException(ioe); + throw runtime.newIOErrorFromException(ioe); } } diff --git a/core/src/main/java/org/jruby/ext/zlib/JZlibRubyGzipWriter.java b/core/src/main/java/org/jruby/ext/zlib/JZlibRubyGzipWriter.java index f2234d3e983..643639ef26c 100644 --- a/core/src/main/java/org/jruby/ext/zlib/JZlibRubyGzipWriter.java +++ b/core/src/main/java/org/jruby/ext/zlib/JZlibRubyGzipWriter.java @@ -79,7 +79,7 @@ public static JZlibRubyGzipWriter newInstance(IRubyObject recv, IRubyObject[] ar } @JRubyMethod(name = "open", required = 1, optional = 3, checkArity = false, meta = true) - public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { + public static IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { int argc = Arity.checkArgumentCount(context, args, 1, 4); Ruby runtime = recv.getRuntime(); @@ -96,11 +96,11 @@ public JZlibRubyGzipWriter(Ruby runtime, RubyClass type) { } public IRubyObject initialize(IRubyObject[] args) { - return initialize19(getRuntime().getCurrentContext(), args, Block.NULL_BLOCK); + return initialize(getRuntime().getCurrentContext(), args, Block.NULL_BLOCK); } @JRubyMethod(name = "initialize", rest = true, visibility = PRIVATE) - public IRubyObject initialize19(ThreadContext context, IRubyObject[] args, Block block) { + public IRubyObject initialize(ThreadContext context, IRubyObject[] args, Block block) { Ruby runtime = context.getRuntime(); IRubyObject opt = context.nil; diff --git a/core/src/main/java/org/jruby/ext/zlib/RubyGzipFile.java b/core/src/main/java/org/jruby/ext/zlib/RubyGzipFile.java index 91b0a7a830d..40114c5f5dd 100644 --- a/core/src/main/java/org/jruby/ext/zlib/RubyGzipFile.java +++ b/core/src/main/java/org/jruby/ext/zlib/RubyGzipFile.java @@ -78,12 +78,13 @@ static IRubyObject wrapBlock(ThreadContext context, RubyGzipFile instance, Block return instance; } - public static IRubyObject wrap(ThreadContext context, IRubyObject recv, IRubyObject io, Block block) { - return wrap19(context, recv, new IRubyObject[]{io}, block); + @Deprecated + public static IRubyObject wrap19(ThreadContext context, IRubyObject recv, IRubyObject io, Block block) { + return wrap(context, recv, new IRubyObject[]{io}, block); } @JRubyMethod(meta = true, name = "wrap", required = 1, optional = 1, checkArity = false) - public static IRubyObject wrap19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { + public static IRubyObject wrap(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { Ruby runtime = recv.getRuntime(); RubyGzipFile instance; diff --git a/core/src/main/java/org/jruby/ir/builder/IRBuilderAST.java b/core/src/main/java/org/jruby/ir/builder/IRBuilderAST.java index 10e16e99576..4ab3af97901 100644 --- a/core/src/main/java/org/jruby/ir/builder/IRBuilderAST.java +++ b/core/src/main/java/org/jruby/ir/builder/IRBuilderAST.java @@ -221,7 +221,7 @@ private Operand buildOperand(Variable result, Node node) throws NotCompilableExc case MATCH3NODE: return buildMatch3(result, (Match3Node) node); case MATCHNODE: return buildMatch(result, (MatchNode) node); case MODULENODE: return buildModule((ModuleNode) node); - case MULTIPLEASGNNODE: return buildMultipleAsgn19((MultipleAsgnNode) node); + case MULTIPLEASGNNODE: return buildMultipleAsgn((MultipleAsgnNode) node); case NEXTNODE: return buildNext((NextNode) node); case NTHREFNODE: return buildNthRef((NthRefNode) node); case NILNODE: return buildNil(); @@ -306,7 +306,7 @@ public Operand buildEncoding(EncodingNode node) { } // Non-arg masgn - public Operand buildMultipleAsgn19(MultipleAsgnNode multipleAsgnNode) { + public Operand buildMultipleAsgn(MultipleAsgnNode multipleAsgnNode) { Node valueNode = multipleAsgnNode.getValueNode(); Variable ret = getValueInTemporaryVariable(build(valueNode)); if (valueNode instanceof ArrayNode || valueNode instanceof ZArrayNode) { diff --git a/core/src/main/java/org/jruby/java/proxies/ArrayJavaProxy.java b/core/src/main/java/org/jruby/java/proxies/ArrayJavaProxy.java index f7c32da91ed..d5a6c4d0fb0 100644 --- a/core/src/main/java/org/jruby/java/proxies/ArrayJavaProxy.java +++ b/core/src/main/java/org/jruby/java/proxies/ArrayJavaProxy.java @@ -540,7 +540,7 @@ public RubyString inspect(ThreadContext context) { } else { buf.setEncoding(s.getEncoding()); } - buf.cat19(s); + buf.catWithCodeRange(s); } RubyStringBuilder.cat(runtime, buf, END_BRACKET); // ] } finally { diff --git a/core/src/main/java/org/jruby/java/proxies/MapJavaProxy.java b/core/src/main/java/org/jruby/java/proxies/MapJavaProxy.java index 5f2652e81de..028261ed5ce 100644 --- a/core/src/main/java/org/jruby/java/proxies/MapJavaProxy.java +++ b/core/src/main/java/org/jruby/java/proxies/MapJavaProxy.java @@ -41,7 +41,6 @@ import org.jruby.anno.JRubyMethod; import org.jruby.exceptions.RaiseException; import org.jruby.javasupport.JavaUtil; -import org.jruby.runtime.Arity; import org.jruby.runtime.Block; import org.jruby.runtime.ThreadContext; import org.jruby.runtime.Visibility; @@ -136,7 +135,7 @@ public IRubyObject inspect(ThreadContext context) { } else { try { runtime.registerInspecting(map); - buf.cat19(inspectHash(context)); + buf.catWithCodeRange(inspectHash(context)); } finally { runtime.unregisterInspecting(map); } @@ -860,11 +859,6 @@ public final RubyHash convertToHash() { return getOrCreateRubyHashMap(getRuntime()); } - @Deprecated - public IRubyObject op_aset19(ThreadContext context, IRubyObject key, IRubyObject value) { - return getOrCreateRubyHashMap(context.runtime).op_aset19(context, key, value); - } - @Deprecated public IRubyObject sort(ThreadContext context, Block block) { return getOrCreateRubyHashMap(context.runtime).sort(context, block); diff --git a/core/src/main/java/org/jruby/javasupport/ext/JavaLang.java b/core/src/main/java/org/jruby/javasupport/ext/JavaLang.java index 65aeea85427..976de652d9e 100644 --- a/core/src/main/java/org/jruby/javasupport/ext/JavaLang.java +++ b/core/src/main/java/org/jruby/javasupport/ext/JavaLang.java @@ -825,7 +825,7 @@ public static IRubyObject inspect(final ThreadContext context, final IRubyObject RubyString buf = inspectPrefix(context, self.getMetaClass()); RubyStringBuilder.cat(context.runtime, buf, SPACE); - buf.cat19(RubyString.newString(context.runtime, str).inspect()); + buf.catWithCodeRange(RubyString.newString(context.runtime, str).inspect()); RubyStringBuilder.cat(context.runtime, buf, GT); // > return buf; diff --git a/core/src/main/java/org/jruby/javasupport/ext/JavaUtil.java b/core/src/main/java/org/jruby/javasupport/ext/JavaUtil.java index 4b8e9222f95..018abb3ac7a 100644 --- a/core/src/main/java/org/jruby/javasupport/ext/JavaUtil.java +++ b/core/src/main/java/org/jruby/javasupport/ext/JavaUtil.java @@ -294,7 +294,7 @@ static void inspectElements(final ThreadContext context, final RubyString buf, f } else { buf.setEncoding(s.getEncoding()); } - buf.cat19(s); + buf.catWithCodeRange(s); } } diff --git a/core/src/main/java/org/jruby/runtime/Helpers.java b/core/src/main/java/org/jruby/runtime/Helpers.java index 571c757daf2..0734cff03f3 100644 --- a/core/src/main/java/org/jruby/runtime/Helpers.java +++ b/core/src/main/java/org/jruby/runtime/Helpers.java @@ -1946,15 +1946,6 @@ public static IRubyObject aValueSplat(IRubyObject value) { return array.getLength() == 1 ? array.first() : array; } - @Deprecated // not used - public static IRubyObject aValueSplat19(IRubyObject value) { - if (!(value instanceof RubyArray)) { - return value.getRuntime().getNil(); - } - - return (RubyArray) value; - } - @Deprecated // not used public static RubyArray splatValue(IRubyObject value) { if (value.isNil()) { @@ -1964,30 +1955,6 @@ public static RubyArray splatValue(IRubyObject value) { return arrayValue(value); } - @Deprecated // not used - public static RubyArray splatValue19(IRubyObject value) { - if (value.isNil()) { - return value.getRuntime().newEmptyArray(); - } - - return arrayValue(value); - } - - @Deprecated // not used - public static IRubyObject unsplatValue19(IRubyObject argsResult) { - if (argsResult instanceof RubyArray) { - RubyArray array = (RubyArray) argsResult; - - if (array.size() == 1) { - IRubyObject newResult = array.eltInternal(0); - if (!((newResult instanceof RubyArray) && ((RubyArray) newResult).size() == 0)) { - argsResult = newResult; - } - } - } - return argsResult; - } - @Deprecated // no longer used public static IRubyObject[] splatToArguments(IRubyObject value) { if (value.isNil()) { diff --git a/core/src/main/java/org/jruby/runtime/builtin/IRubyObject.java b/core/src/main/java/org/jruby/runtime/builtin/IRubyObject.java index c379b36c3bc..25ea8a01391 100644 --- a/core/src/main/java/org/jruby/runtime/builtin/IRubyObject.java +++ b/core/src/main/java/org/jruby/runtime/builtin/IRubyObject.java @@ -401,6 +401,7 @@ default List> getMarshalVariableList() { /** * @deprecated Use {@link #checkStringType()} instead. */ + @Deprecated default IRubyObject checkStringType19() { return checkStringType(); } diff --git a/core/src/main/java/org/jruby/specialized/RubyArrayOneObject.java b/core/src/main/java/org/jruby/specialized/RubyArrayOneObject.java index d4e3a938672..e30c1eab14e 100644 --- a/core/src/main/java/org/jruby/specialized/RubyArrayOneObject.java +++ b/core/src/main/java/org/jruby/specialized/RubyArrayOneObject.java @@ -1,6 +1,5 @@ package org.jruby.specialized; -import org.jcodings.Encoding; import org.jcodings.specific.USASCIIEncoding; import org.jruby.Ruby; import org.jruby.RubyArray; @@ -141,7 +140,7 @@ protected IRubyObject inspectAry(ThreadContext context) { RubyString s = inspect(context, value); EncodingUtils.encAssociateIndex(str, s.getEncoding()); - str.cat19(s); + str.catWithCodeRange(s); str.cat((byte) ']'); diff --git a/core/src/main/java/org/jruby/specialized/RubyArrayTwoObject.java b/core/src/main/java/org/jruby/specialized/RubyArrayTwoObject.java index 07410013519..187f3c3e891 100644 --- a/core/src/main/java/org/jruby/specialized/RubyArrayTwoObject.java +++ b/core/src/main/java/org/jruby/specialized/RubyArrayTwoObject.java @@ -1,6 +1,5 @@ package org.jruby.specialized; -import org.jcodings.Encoding; import org.jcodings.specific.USASCIIEncoding; import org.jruby.Ruby; import org.jruby.RubyArray; @@ -158,12 +157,12 @@ protected IRubyObject inspectAry(ThreadContext context) { RubyString s1 = inspect(context, car); RubyString s2 = inspect(context, cdr); EncodingUtils.encAssociateIndex(str, s1.getEncoding()); - str.cat19(s1); + str.catWithCodeRange(s1); ByteList bytes = str.getByteList(); bytes.append((byte) ',').append((byte) ' '); - str.cat19(s2); + str.catWithCodeRange(s2); str.cat((byte) ']'); diff --git a/core/src/main/java/org/jruby/util/ConvertBytes.java b/core/src/main/java/org/jruby/util/ConvertBytes.java index ea1402ef4a2..9f62362fe65 100644 --- a/core/src/main/java/org/jruby/util/ConvertBytes.java +++ b/core/src/main/java/org/jruby/util/ConvertBytes.java @@ -332,11 +332,6 @@ public static RubyInteger byteListToInum(Ruby runtime, ByteList str, int off, in return (RubyInteger) new ConvertBytes(runtime, str, off, end, base, badcheck).byteListToInum(true); } - @Deprecated - public static RubyInteger byteListToInum19(Ruby runtime, ByteList str, int base, boolean badcheck) { - return byteListToInum(runtime, str, base, badcheck); - } - private final static byte[] conv_digit = new byte[128]; private final static boolean[] digit = new boolean[128]; private final static boolean[] space = new boolean[128]; diff --git a/core/src/main/java/org/jruby/util/ConvertDouble.java b/core/src/main/java/org/jruby/util/ConvertDouble.java index db1f0f7f78b..cf4756100fb 100644 --- a/core/src/main/java/org/jruby/util/ConvertDouble.java +++ b/core/src/main/java/org/jruby/util/ConvertDouble.java @@ -29,11 +29,16 @@ package org.jruby.util; public class ConvertDouble { + @Deprecated + public static double byteListToDouble19(ByteList bytes, boolean strict) { + return byteListToDouble(bytes, strict); + } + /** * Converts supplied ByteList into a double. strict-mode will not like * extra text non-numeric text or multiple sequention underscores. */ - public static double byteListToDouble19(ByteList bytes, boolean strict) { + public static double byteListToDouble(ByteList bytes, boolean strict) { return new DoubleConverter().parse(bytes, strict, true); } diff --git a/core/src/main/java/org/jruby/util/IdUtil.java b/core/src/main/java/org/jruby/util/IdUtil.java index bff36876947..82b390b16cb 100644 --- a/core/src/main/java/org/jruby/util/IdUtil.java +++ b/core/src/main/java/org/jruby/util/IdUtil.java @@ -178,21 +178,6 @@ public static boolean isConstantInitial(ByteList byteList) { return false; } - @Deprecated - public static boolean isValidConstantName19(String id) { - return isValidConstantName(id); - } - - @Deprecated - public static boolean isNameCharacter19(char c) { - return isNameCharacter(c); - } - - @Deprecated - public static boolean isNameString19(String id, int start, int limit) { - return isNameString(id, start, limit); - } - // mri: rb_enc_symname_type (minus support for allowed_attrset). public static SymbolNameType determineSymbolNameType(Ruby runtime, ByteList data) { Encoding encoding = data.getEncoding(); diff --git a/core/src/main/java/org/jruby/util/Inspector.java b/core/src/main/java/org/jruby/util/Inspector.java index 1c194c373f9..5d716aed7a2 100644 --- a/core/src/main/java/org/jruby/util/Inspector.java +++ b/core/src/main/java/org/jruby/util/Inspector.java @@ -53,7 +53,8 @@ public static RubyString inspectPrefixTypeOnly(final ThreadContext context, fina RubyString name = RubyStringBuilder.types(context, type); // minimal: "#" RubyString buf = RubyString.newStringLight(context.runtime, 2 + name.length() + 3 + 8 + 1, USASCIIEncoding.INSTANCE); - buf.cat('#').cat('<').cat19(name); + RubyString rubyString = buf.cat('#').cat('<'); + rubyString.catWithCodeRange(name); return buf; } diff --git a/core/src/main/java/org/jruby/util/RegexpSupport.java b/core/src/main/java/org/jruby/util/RegexpSupport.java index 3e1dbb4c88e..1fa3604ddd9 100644 --- a/core/src/main/java/org/jruby/util/RegexpSupport.java +++ b/core/src/main/java/org/jruby/util/RegexpSupport.java @@ -175,7 +175,8 @@ private static int appendMBC(Ruby runtime, ByteList to, byte[] bytes, int p, Enc public static int raisePreprocessError(Ruby runtime, ByteList str, String err, ErrorMode mode) { switch (mode) { case RAISE: - raiseRegexpError19(runtime, str, str.getEncoding(), RegexpOptions.NULL_OPTIONS, err); + Encoding enc = str.getEncoding(); + raiseRegexpError(runtime, str, enc, RegexpOptions.NULL_OPTIONS, err); case PREPROCESS: throw runtime.newArgumentError("regexp preprocess failed: " + err); case DESC: @@ -184,32 +185,50 @@ public static int raisePreprocessError(Ruby runtime, ByteList str, String err, E return 0; } - // rb_enc_reg_raise + @Deprecated public static void raiseRegexpError19(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err) { + raiseRegexpError(runtime, bytes, enc, options, err); + } + + // rb_enc_reg_raise + public static void raiseRegexpError(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err) { // TODO: we loose encoding information here, fix it - throw runtime.newRegexpError(err + ": " + regexpDescription19(runtime, bytes, options, enc)); + throw runtime.newRegexpError(err + ": " + regexpDescription(runtime, bytes, options, enc)); } - // rb_enc_reg_error_desc + @Deprecated public static ByteList regexpDescription19(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc) { - return regexpDescription19(runtime, bytes.getUnsafeBytes(), bytes.getBegin(), bytes.getRealSize(), options, enc); + return regexpDescription(runtime, bytes, options, enc); } - private static ByteList regexpDescription19(Ruby runtime, byte[] s, int start, int len, RegexpOptions options, Encoding enc) { + // rb_enc_reg_error_desc + public static ByteList regexpDescription(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc) { + byte[] s = bytes.getUnsafeBytes(); + int start = bytes.getBegin(); + int len = bytes.getRealSize(); + return regexpDescription(runtime, s, start, len, options, enc); + } + + private static ByteList regexpDescription(Ruby runtime, byte[] s, int start, int len, RegexpOptions options, Encoding enc) { ByteList description = new ByteList(); description.setEncoding(enc); description.append((byte)'/'); Encoding resultEnc = runtime.getDefaultInternalEncoding(); if (resultEnc == null) resultEnc = runtime.getDefaultExternalEncoding(); - appendRegexpString19(runtime, description, s, start, len, enc, resultEnc); + appendRegexpString(runtime, description, s, start, len, enc, resultEnc); description.append((byte)'/'); appendOptions(description, options); if (options.isEncodingNone()) description.append((byte) 'n'); return description; } + @Deprecated public static void appendRegexpString19(Ruby runtime, ByteList to, byte[] bytes, int start, int len, Encoding enc, Encoding resEnc) { + appendRegexpString(runtime, to, bytes, start, len, enc, resEnc); + } + + public static void appendRegexpString(Ruby runtime, ByteList to, byte[] bytes, int start, int len, Encoding enc, Encoding resEnc) { int p = start; int end = p + len; boolean needEscape = false; diff --git a/core/src/main/java/org/jruby/util/RubyStringBuilder.java b/core/src/main/java/org/jruby/util/RubyStringBuilder.java index eb2028a2efd..ff2b74c34a4 100644 --- a/core/src/main/java/org/jruby/util/RubyStringBuilder.java +++ b/core/src/main/java/org/jruby/util/RubyStringBuilder.java @@ -175,7 +175,7 @@ public static String str(Ruby runtime, IRubyObject value, String message) { public static String str(Ruby runtime, String message, IRubyObject value) { RubyString buf = runtime.newString(message); - buf.cat19(value.asString()); + buf.catWithCodeRange(value.asString()); return buf.toString(); } @@ -183,7 +183,7 @@ public static String str(Ruby runtime, String message, IRubyObject value) { public static String str(Ruby runtime, String messageBegin, IRubyObject value, String messageEnd) { RubyString buf = runtime.newString(messageBegin); - buf.cat19(value.asString()); + buf.catWithCodeRange(value.asString()); cat(runtime, buf, messageEnd); return buf.toString(); @@ -193,7 +193,7 @@ public static String str(Ruby runtime, IRubyObject value, String message, IRubyO RubyString buf = (RubyString) value.asString().dup(); cat(runtime, buf, message); - buf.cat19(value2.asString()); + buf.catWithCodeRange(value2.asString()); return buf.toString(); } @@ -202,7 +202,7 @@ public static String str(Ruby runtime, IRubyObject value, String message, IRubyO RubyString buf = (RubyString) value.asString().dup(); cat(runtime, buf, message); - buf.cat19(value2.asString()); + buf.catWithCodeRange(value2.asString()); cat(runtime, buf, message2); return buf.toString(); @@ -211,9 +211,9 @@ public static String str(Ruby runtime, IRubyObject value, String message, IRubyO public static String str(Ruby runtime, String messageBegin, IRubyObject value, String messageMiddle, IRubyObject value2) { RubyString buf = runtime.newString(messageBegin); - buf.cat19(value.asString()); + buf.catWithCodeRange(value.asString()); cat(runtime, buf, messageMiddle); - buf.cat19(value2.asString()); + buf.catWithCodeRange(value2.asString()); return buf.toString(); } @@ -221,9 +221,9 @@ public static String str(Ruby runtime, String messageBegin, IRubyObject value, S public static String str(Ruby runtime, String messageBegin, IRubyObject value, String messageMiddle, IRubyObject value2, String messageEnd) { RubyString buf = runtime.newString(messageBegin); - buf.cat19(value.asString()); + buf.catWithCodeRange(value.asString()); cat(runtime, buf, messageMiddle); - buf.cat19(value2.asString()); + buf.catWithCodeRange(value2.asString()); cat(runtime, buf, messageEnd); return buf.toString(); @@ -233,11 +233,11 @@ public static String str(Ruby runtime, String messageBegin, IRubyObject value, S String messageMiddle2, IRubyObject value3, String messageEnd) { RubyString buf = runtime.newString(messageBegin); - buf.cat19(value.asString()); + buf.catWithCodeRange(value.asString()); cat(runtime, buf, messageMiddle); - buf.cat19(value2.asString()); + buf.catWithCodeRange(value2.asString()); cat(runtime, buf, messageMiddle2); - buf.cat19(value3.asString()); + buf.catWithCodeRange(value3.asString()); cat(runtime, buf, messageEnd); return buf.toString(); @@ -247,13 +247,13 @@ public static String str(Ruby runtime, String messageBegin, IRubyObject value, S String messageMiddle2, IRubyObject value3, String messageMiddle3, RubyString value4, String messageEnd) { RubyString buf = runtime.newString(messageBegin); - buf.cat19(value.asString()); + buf.catWithCodeRange(value.asString()); cat(runtime, buf, messageMiddle); - buf.cat19(value2); + buf.catWithCodeRange(value2); cat(runtime, buf, messageMiddle2); - buf.cat19(value3.asString()); + buf.catWithCodeRange(value3.asString()); cat(runtime, buf, messageMiddle3); - buf.cat19(value4); + buf.catWithCodeRange(value4); cat(runtime, buf, messageEnd); return buf.toString(); diff --git a/core/src/main/java/org/jruby/util/StringSupport.java b/core/src/main/java/org/jruby/util/StringSupport.java index 3d9239bf30f..abfa8c2beec 100644 --- a/core/src/main/java/org/jruby/util/StringSupport.java +++ b/core/src/main/java/org/jruby/util/StringSupport.java @@ -1166,13 +1166,6 @@ public static int strCount(ByteList str, Ruby runtime, boolean[] table, TrTables } } - /** - * @deprecated renamed to {@link #strCount(ByteList, Ruby, boolean[], TrTables, Encoding)} - */ - public static int countCommon19(ByteList str, Ruby runtime, boolean[] table, TrTables tables, Encoding enc) { - return strCount(str, runtime, table, tables, enc); - } - // MRI: rb_str_rindex public static int rindex(ByteList source, int sourceChars, int subChars, int pos, CodeRangeable subStringCodeRangeable, Encoding enc) { if (subStringCodeRangeable.scanForCodeRange() == CR_BROKEN) return -1; @@ -1884,8 +1877,18 @@ public static ByteList replaceInternal(int beg, int len, ByteListHolder source, return source.getByteList(); } - // MRI: rb_str_update, second half + @Deprecated public static void replaceInternal19(int beg, int len, CodeRangeable source, CodeRangeable repl) { + strUpdate(beg, len, source, repl); + } + + @Deprecated + public static void replaceInternal19(Ruby runtime, int beg, int len, RubyString source, RubyString repl) { + strUpdate(runtime, beg, len, source, repl); + } + + // MRI: rb_str_update, second half + public static void strUpdate(int beg, int len, CodeRangeable source, CodeRangeable repl) { Encoding enc = source.checkEncoding(repl); source.modify(); @@ -1909,7 +1912,7 @@ public static void replaceInternal19(int beg, int len, CodeRangeable source, Cod } // MRI: rb_str_update, first half - public static void replaceInternal19(Ruby runtime, int beg, int len, RubyString source, RubyString repl) { + public static void strUpdate(Ruby runtime, int beg, int len, RubyString source, RubyString repl) { if (len < 0) throw runtime.newIndexError("negative length " + len); int slen = strLengthFromRubyString(source, source.checkEncoding(repl)); @@ -1927,7 +1930,7 @@ public static void replaceInternal19(Ruby runtime, int beg, int len, RubyString len = slen - beg; } - replaceInternal19(beg, len, source, repl); + strUpdate(beg, len, source, repl); } public static boolean isAsciiOnly(CodeRangeable string) { @@ -2011,11 +2014,6 @@ public static int choppedLength(CodeRangeable str) { return p - beg; } - @Deprecated - public static int choppedLength19(CodeRangeable str, Ruby runtime) { - return choppedLength(str); - } - /** * rb_enc_compatible */ diff --git a/core/src/main/java/org/jruby/util/TypeConverter.java b/core/src/main/java/org/jruby/util/TypeConverter.java index d28125b2bf3..ee8411cdc3c 100644 --- a/core/src/main/java/org/jruby/util/TypeConverter.java +++ b/core/src/main/java/org/jruby/util/TypeConverter.java @@ -130,26 +130,6 @@ public static IRubyObject convertToType(ThreadContext context, IRubyObject obj, return val; } - @Deprecated // not-used - public static IRubyObject convertToType19(IRubyObject obj, RubyClass target, String convertMethod, boolean raise) { - return convertToType(obj, target, convertMethod, raise); - } - - @Deprecated // not-used - public static IRubyObject convertToType19(ThreadContext context, IRubyObject obj, RubyClass target, JavaSites.CheckedSites sites, boolean raise) { - return convertToType(context, obj, target, sites, raise); - } - - @Deprecated // not-used - public static IRubyObject convertToType19(IRubyObject obj, RubyClass target, String convertMethod) { - return convertToType(obj, target, convertMethod); - } - - @Deprecated // not-used - public static IRubyObject convertToType19(ThreadContext context, IRubyObject obj, RubyClass target, JavaSites.CheckedSites sites) { - return convertToType(context, obj, target, sites); - } - // MRI: rb_to_float - adjusted to handle also Java numbers (non RubyNumeric types) public static RubyFloat toFloat(Ruby runtime, IRubyObject obj) { if (obj instanceof RubyNumeric) return ((RubyNumeric) obj).convertToFloat(); @@ -257,16 +237,6 @@ public static IRubyObject convertToTypeWithCheck(ThreadContext context, IRubyObj return val; } - @Deprecated - public static IRubyObject convertToTypeWithCheck19(IRubyObject obj, RubyClass target, String convertMethod) { - return convertToTypeWithCheck(obj, target, convertMethod); - } - - @Deprecated - public static IRubyObject convertToTypeWithCheck19(ThreadContext context, IRubyObject obj, RubyClass target, JavaSites.CheckedSites sites) { - return convertToTypeWithCheck(context, obj, target, sites); - } - public static RaiseException newTypeError(IRubyObject obj, RubyClass target, String convertMethod, IRubyObject val) { return newTypeError(obj.getRuntime(), obj, target, convertMethod, val); } diff --git a/core/src/main/java/org/jruby/util/io/EncodingUtils.java b/core/src/main/java/org/jruby/util/io/EncodingUtils.java index 81d01d02561..0364816020a 100644 --- a/core/src/main/java/org/jruby/util/io/EncodingUtils.java +++ b/core/src/main/java/org/jruby/util/io/EncodingUtils.java @@ -400,7 +400,8 @@ public static RubyString newExternalStringWithEncoding(Ruby runtime, String stri /* when the conversion failed for some reason, just ignore the * default_internal and result in the given encoding as-is. */ try { - convertedString.cat19(encodeBytelist(string, encoding), CR_UNKNOWN); + ByteList other = encodeBytelist(string, encoding); + convertedString.catWithCodeRange(other, CR_UNKNOWN); } catch (org.jruby.exceptions.EncodingError.CompatibilityError ce) { return newString(runtime, string, encoding); } @@ -435,7 +436,8 @@ public static RubyString newExternalStringWithEncoding(Ruby runtime, ByteList by /* when the conversion failed for some reason, just ignore the * default_internal and result in the given encoding as-is. */ try { - convertedString.cat19(encodeBytelist(bytelist, encoding), CR_UNKNOWN); + ByteList other = encodeBytelist(bytelist, encoding); + convertedString.catWithCodeRange(other, CR_UNKNOWN); } catch (org.jruby.exceptions.EncodingError.CompatibilityError ce) { return newString(runtime, bytelist, encoding); } @@ -878,7 +880,7 @@ public static RubyString encodedDup(ThreadContext context, RubyString str, Encod // set to same superclass newstr.setMetaClass(str.getMetaClass()); } - newstr.modify19(); + newstr.modifyAndClearCodeRange(); return strEncodeAssociate(newstr, encindex); } diff --git a/core/src/test/java/org/jruby/test/TestMethodFactories.java b/core/src/test/java/org/jruby/test/TestMethodFactories.java index b10b8e8219a..a83b8bbfffd 100644 --- a/core/src/test/java/org/jruby/test/TestMethodFactories.java +++ b/core/src/test/java/org/jruby/test/TestMethodFactories.java @@ -145,25 +145,4 @@ public void testModuleMethodOwner() { assertEquals(mod.getSingletonClass(), rubyMethod.owner(runtime.getCurrentContext())); } - @SuppressWarnings("deprecation") - public static class VersionedMethods { - @JRubyMethod(name = "method", compat = CompatVersion.RUBY1_8) - public static IRubyObject method18(IRubyObject self) { - return self; - } - @JRubyMethod(name = "method", compat = CompatVersion.RUBY1_9) - public static IRubyObject method19(IRubyObject self) { - return self; - } - } - - // #1194: ClassFormatError with Nokogiri 1.6.0 - public void testVersionedMethods() { - RubyModule mod = runtime.defineModule("GH1194"); - - mod.defineAnnotatedMethods(VersionedMethods.class); - - assertNotNull(mod.searchMethod("method")); - } - }