From 725379c46466ca8b0b285ba90642b3aaba9c86c8 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Mon, 11 Mar 2024 23:17:33 -0500 Subject: [PATCH] Remove remaining "19" methods These methods were not deprecated before JRuby 10, so they were left in place for one additional "major" release. This deletes them. They are very low risk of causing compile or execution problems, but this safer approach gives any remaining users a full version cycle to switch to the long-available normal versions. See jruby/jruby#8143 for the original pass that removed already- deprecated methods. --- core/src/main/java/org/jruby/RubyArray.java | 10 -- core/src/main/java/org/jruby/RubyDir.java | 5 - core/src/main/java/org/jruby/RubyFile.java | 5 - .../src/main/java/org/jruby/RubyFileStat.java | 5 - .../main/java/org/jruby/RubyMatchData.java | 5 - core/src/main/java/org/jruby/RubyMath.java | 5 - core/src/main/java/org/jruby/RubyModule.java | 25 ---- core/src/main/java/org/jruby/RubyProcess.java | 5 - core/src/main/java/org/jruby/RubyString.java | 133 ------------------ .../java/org/jruby/ext/zlib/RubyGzipFile.java | 5 - .../jruby/runtime/builtin/IRubyObject.java | 8 -- .../java/org/jruby/util/ConvertDouble.java | 5 - .../java/org/jruby/util/RegexpSupport.java | 15 -- .../java/org/jruby/util/StringSupport.java | 10 -- 14 files changed, 241 deletions(-) diff --git a/core/src/main/java/org/jruby/RubyArray.java b/core/src/main/java/org/jruby/RubyArray.java index b991f3b5554..c9337edf2b2 100644 --- a/core/src/main/java/org/jruby/RubyArray.java +++ b/core/src/main/java/org/jruby/RubyArray.java @@ -2078,11 +2078,6 @@ 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 * */ @@ -2124,11 +2119,6 @@ public IRubyObject join(final ThreadContext context, IRubyObject sep) { return result; } - @Deprecated - public IRubyObject join19(ThreadContext context) { - return join(context); - } - @JRubyMethod(name = "join") public IRubyObject join(ThreadContext context) { return join(context, getDefaultSeparator(context.runtime)); diff --git a/core/src/main/java/org/jruby/RubyDir.java b/core/src/main/java/org/jruby/RubyDir.java index acb0ece3c56..2d521d56544 100644 --- a/core/src/main/java/org/jruby/RubyDir.java +++ b/core/src/main/java/org/jruby/RubyDir.java @@ -486,11 +486,6 @@ 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. */ diff --git a/core/src/main/java/org/jruby/RubyFile.java b/core/src/main/java/org/jruby/RubyFile.java index 5c6b62a5cbb..f09b5e552e2 100644 --- a/core/src/main/java/org/jruby/RubyFile.java +++ b/core/src/main/java/org/jruby/RubyFile.java @@ -1270,11 +1270,6 @@ public static IRubyObject readlink(ThreadContext context, IRubyObject recv, IRub } } - @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 truncate(ThreadContext context, IRubyObject recv, IRubyObject arg1, IRubyObject arg2) { diff --git a/core/src/main/java/org/jruby/RubyFileStat.java b/core/src/main/java/org/jruby/RubyFileStat.java index 11995b63ea5..e230b200ccd 100644 --- a/core/src/main/java/org/jruby/RubyFileStat.java +++ b/core/src/main/java/org/jruby/RubyFileStat.java @@ -142,11 +142,6 @@ private void setup(String filename, boolean lstat) { } } - @Deprecated - public IRubyObject initialize19(IRubyObject fname, Block unusedBlock) { - return initialize(fname, unusedBlock); - } - @JRubyMethod(name = "initialize", visibility = Visibility.PRIVATE) public IRubyObject initialize(IRubyObject fname, Block unusedBlock) { Ruby runtime = getRuntime(); diff --git a/core/src/main/java/org/jruby/RubyMatchData.java b/core/src/main/java/org/jruby/RubyMatchData.java index 146de383bf4..5d836939594 100644 --- a/core/src/main/java/org/jruby/RubyMatchData.java +++ b/core/src/main/java/org/jruby/RubyMatchData.java @@ -673,11 +673,6 @@ 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 * */ diff --git a/core/src/main/java/org/jruby/RubyMath.java b/core/src/main/java/org/jruby/RubyMath.java index 7f6dd6c5757..b3602ebbbe2 100644 --- a/core/src/main/java/org/jruby/RubyMath.java +++ b/core/src/main/java/org/jruby/RubyMath.java @@ -370,11 +370,6 @@ public static RubyFloat cbrt(ThreadContext context, IRubyObject recv, IRubyObjec return RubyFloat.newFloat(context.runtime, result); } - @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 hypot(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) { double valuea = RubyNumeric.num2dbl(context, x); diff --git a/core/src/main/java/org/jruby/RubyModule.java b/core/src/main/java/org/jruby/RubyModule.java index da29117273b..f4df06cdd17 100644 --- a/core/src/main/java/org/jruby/RubyModule.java +++ b/core/src/main/java/org/jruby/RubyModule.java @@ -3204,11 +3204,6 @@ protected void addMethodSymbols(Ruby runtime, Set seen, RubyArray ary, b }); } - @Deprecated - public RubyArray instance_methods19(IRubyObject[] args) { - return instance_methods(args); - } - @JRubyMethod(name = "instance_methods", optional = 1, checkArity = false) public RubyArray instance_methods(IRubyObject[] args) { Arity.checkArgumentCount(getRuntime(), args, 0, 1); @@ -3216,11 +3211,6 @@ public RubyArray instance_methods(IRubyObject[] args) { return instanceMethods(args, PRIVATE, false, true); } - @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_methods(IRubyObject[] args) { Arity.checkArgumentCount(getRuntime(), args, 0, 1); @@ -4018,11 +4008,6 @@ 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 * */ @@ -4039,11 +4024,6 @@ public IRubyObject class_variable_set(IRubyObject name, IRubyObject value) { return setClassVar(validateClassVariable(getRuntime(), name), value); } - @Deprecated - public IRubyObject class_variable_set19(IRubyObject name, IRubyObject value) { - return class_variable_set(name, value); - } - /** rb_mod_remove_cvar * */ @@ -4052,11 +4032,6 @@ public IRubyObject remove_class_variable(ThreadContext context, IRubyObject name return removeClassVariable(validateClassVariable(context.runtime, name)); } - @Deprecated - public IRubyObject remove_class_variable19(ThreadContext context, IRubyObject name) { - return remove_class_variable(context, name); - } - @JRubyMethod(name = "class_variables") public RubyArray class_variables(ThreadContext context) { Ruby runtime = context.runtime; diff --git a/core/src/main/java/org/jruby/RubyProcess.java b/core/src/main/java/org/jruby/RubyProcess.java index 11e04aa6527..46254f0ba14 100644 --- a/core/src/main/java/org/jruby/RubyProcess.java +++ b/core/src/main/java/org/jruby/RubyProcess.java @@ -1819,11 +1819,6 @@ public static IRubyObject _fork(ThreadContext context, IRubyObject recv, Block b throw context.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 = "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/RubyString.java b/core/src/main/java/org/jruby/RubyString.java index b2a81b38583..d9a85cf39eb 100644 --- a/core/src/main/java/org/jruby/RubyString.java +++ b/core/src/main/java/org/jruby/RubyString.java @@ -341,11 +341,6 @@ public final boolean eql(IRubyObject other) { return eqlAndComparable(other); } - @Deprecated - private boolean eql19(IRubyObject other) { - return eqlAndComparable(other); - } - // rb_str_hash_cmp private boolean eqlAndComparable(IRubyObject other) { final RubyString otherString = (RubyString) other; @@ -966,11 +961,6 @@ public final void modify() { value.invalidate(); } - @Deprecated - public final void modify19() { - modifyAndClearCodeRange(); - } - public final void modifyAndClearCodeRange() { modify(); clearCodeRange(); @@ -1211,11 +1201,6 @@ public final IRubyObject plus_at() { return isFrozen() ? this.dup() : this; } - @Deprecated - public IRubyObject op_plus19(ThreadContext context, IRubyObject arg) { - return op_plus(context, arg); - } - @JRubyMethod(name = "+") public IRubyObject op_plus(ThreadContext context, IRubyObject arg) { RubyString str = arg.convertToString(); @@ -1229,11 +1214,6 @@ public IRubyObject op_plus(ThreadContext context, IRubyObject arg) { return resultStr; } - @Deprecated - public IRubyObject op_mul19(ThreadContext context, IRubyObject other) { - return op_mul(context, other); - } - @JRubyMethod(name = "*") public IRubyObject op_mul(ThreadContext context, IRubyObject other) { RubyString result = multiplyByteList(context, other); @@ -1394,13 +1374,6 @@ public final RubyString cat(byte[] str, int beg, int len) { return this; } - // Needs to remain in place until StringIO has migrated to the new methods - // See https://github.com/ruby/stringio/issues/83 - @Deprecated - public final RubyString cat19(RubyString str2) { - return catWithCodeRange(str2); - } - // // rb_str_buf_append against VALUE public final RubyString catWithCodeRange(RubyString str2) { ByteList other = str2.getByteList(); @@ -1416,13 +1389,6 @@ public final RubyString cat(ByteList other, int codeRange) { return this; } - // Needs to remain in place until StringIO has migrated to the new methods - // See https://github.com/ruby/stringio/issues/83 - @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); @@ -1488,11 +1454,6 @@ public final RubyString catAscii(byte[] bytes, int ptr, int ptrLen) { return this; } - @Deprecated - public IRubyObject replace19(IRubyObject other) { - return replace(other); - } - @JRubyMethod(name = "initialize_copy", visibility = Visibility.PRIVATE) @Override public RubyString initialize_copy(IRubyObject other) { @@ -1530,11 +1491,6 @@ public RubyString clear() { return this; } - @Deprecated - public IRubyObject reverse19(ThreadContext context) { - return reverse(context); - } - @JRubyMethod(name = "reverse") public IRubyObject reverse(ThreadContext context) { RubyString str = strDup(context.runtime, context.runtime.getString()); @@ -1542,11 +1498,6 @@ public IRubyObject reverse(ThreadContext context) { return str; } - @Deprecated - public RubyString reverse_bang19(ThreadContext context) { - return reverse_bang(context); - } - @JRubyMethod(name = "reverse!") public RubyString reverse_bang(ThreadContext context) { modifyCheck(); @@ -1710,20 +1661,6 @@ 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) @@ -1768,11 +1705,6 @@ public IRubyObject match_p(ThreadContext context, IRubyObject pattern, IRubyObje return getPattern(context.runtime, pattern).matchP(context, this, RubyNumeric.num2int(pos)); } - @Deprecated - public IRubyObject op_ge19(ThreadContext context, IRubyObject other) { - return op_ge(context, other); - } - @JRubyMethod(name = ">=") public IRubyObject op_ge(ThreadContext context, IRubyObject other) { if (other instanceof RubyString && cmpIsBuiltin(context)) { @@ -1781,11 +1713,6 @@ public IRubyObject op_ge(ThreadContext context, IRubyObject other) { return RubyComparable.op_ge(context, this, other); } - @Deprecated - public IRubyObject op_gt19(ThreadContext context, IRubyObject other) { - return op_gt(context, other); - } - @JRubyMethod(name = ">") public IRubyObject op_gt(ThreadContext context, IRubyObject other) { if (other instanceof RubyString && cmpIsBuiltin(context)) { @@ -1794,11 +1721,6 @@ public IRubyObject op_gt(ThreadContext context, IRubyObject other) { return RubyComparable.op_gt(context, this, other); } - @Deprecated - public IRubyObject op_le19(ThreadContext context, IRubyObject other) { - return op_le(context, other); - } - @JRubyMethod(name = "<=") public IRubyObject op_le(ThreadContext context, IRubyObject other) { if (other instanceof RubyString && cmpIsBuiltin(context)) { @@ -1807,11 +1729,6 @@ public IRubyObject op_le(ThreadContext context, IRubyObject other) { return RubyComparable.op_le(context, this, other); } - @Deprecated - public IRubyObject op_lt19(ThreadContext context, IRubyObject other) { - return op_lt(context, other); - } - @JRubyMethod(name = "<") public IRubyObject op_lt(ThreadContext context, IRubyObject other) { if (other instanceof RubyString && cmpIsBuiltin(context)) { @@ -1824,11 +1741,6 @@ private boolean cmpIsBuiltin(ThreadContext context) { return sites(context).cmp.isBuiltin(this); } - @Deprecated - public IRubyObject str_eql_p19(ThreadContext context, IRubyObject other) { - return str_eql_p(context, other); - } - @JRubyMethod(name = "eql?") public IRubyObject str_eql_p(ThreadContext context, IRubyObject other) { if (other instanceof RubyString) { @@ -3732,11 +3644,6 @@ private IRubyObject replaceInternal(int beg, int len, RubyString repl) { return this; } - @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 * */ @@ -5496,26 +5403,6 @@ public IRubyObject chop_bang(ThreadContext context) { return context.nil; } - @Deprecated - public RubyString chomp19(ThreadContext context) { - return chomp(context); - } - - @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); - } - /** * rb_str_chomp_bang * @@ -6021,16 +5908,6 @@ public IRubyObject squeeze_bang(ThreadContext context, IRubyObject[] args) { return this; } - @Deprecated - public IRubyObject tr19(ThreadContext context, IRubyObject src, IRubyObject repl) { - return tr(context, src, repl); - } - - @Deprecated - public IRubyObject tr_bang19(ThreadContext context, IRubyObject src, IRubyObject repl) { - return tr_bang(context, src, repl); - } - /** rb_str_tr / rb_str_tr_bang * */ @@ -6058,16 +5935,6 @@ private IRubyObject trTrans(ThreadContext context, IRubyObject src, IRubyObject return (ret == null) ? context.nil : (IRubyObject) ret; } - @Deprecated - public IRubyObject tr_s19(ThreadContext context, IRubyObject src, IRubyObject repl) { - return tr_s(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 * */ 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 40114c5f5dd..45f2729c625 100644 --- a/core/src/main/java/org/jruby/ext/zlib/RubyGzipFile.java +++ b/core/src/main/java/org/jruby/ext/zlib/RubyGzipFile.java @@ -77,11 +77,6 @@ static IRubyObject wrapBlock(ThreadContext context, RubyGzipFile instance, Block } return instance; } - - @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 wrap(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { 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 25ea8a01391..84e8d73fb23 100644 --- a/core/src/main/java/org/jruby/runtime/builtin/IRubyObject.java +++ b/core/src/main/java/org/jruby/runtime/builtin/IRubyObject.java @@ -398,14 +398,6 @@ default List> getMarshalVariableList() { public Object getVariable(int index); public void setVariable(int index, Object value); - /** - * @deprecated Use {@link #checkStringType()} instead. - */ - @Deprecated - default IRubyObject checkStringType19() { - return checkStringType(); - } - /** * @param convertMethod * @param convertMethodIndex diff --git a/core/src/main/java/org/jruby/util/ConvertDouble.java b/core/src/main/java/org/jruby/util/ConvertDouble.java index cf4756100fb..fe56b1f0af7 100644 --- a/core/src/main/java/org/jruby/util/ConvertDouble.java +++ b/core/src/main/java/org/jruby/util/ConvertDouble.java @@ -29,11 +29,6 @@ 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. diff --git a/core/src/main/java/org/jruby/util/RegexpSupport.java b/core/src/main/java/org/jruby/util/RegexpSupport.java index 1fa3604ddd9..bd5eb1e8786 100644 --- a/core/src/main/java/org/jruby/util/RegexpSupport.java +++ b/core/src/main/java/org/jruby/util/RegexpSupport.java @@ -185,22 +185,12 @@ public static int raisePreprocessError(Ruby runtime, ByteList str, String err, E return 0; } - @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 + ": " + regexpDescription(runtime, bytes, options, enc)); } - @Deprecated - public static ByteList regexpDescription19(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc) { - return regexpDescription(runtime, bytes, options, enc); - } - // rb_enc_reg_error_desc public static ByteList regexpDescription(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc) { byte[] s = bytes.getUnsafeBytes(); @@ -223,11 +213,6 @@ private static ByteList regexpDescription(Ruby runtime, byte[] s, int start, int 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; diff --git a/core/src/main/java/org/jruby/util/StringSupport.java b/core/src/main/java/org/jruby/util/StringSupport.java index abfa8c2beec..9c0aef9f75b 100644 --- a/core/src/main/java/org/jruby/util/StringSupport.java +++ b/core/src/main/java/org/jruby/util/StringSupport.java @@ -1877,16 +1877,6 @@ public static ByteList replaceInternal(int beg, int len, ByteListHolder source, return source.getByteList(); } - @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);