Repository navigation
Conversation
Zero-sum deprecation cleanups for 10.0. Each replacement either is the body of the deprecated method, or uses the ThreadContext the caller already has. No new getCurrentContext() calls. - RubyNumeric#getLongValue() -> asLong(context) RubyModule#hashCode: the result of convertToInteger() is a Fixnum or Bignum; getLongValue() ended up in asLong(getCurrentContext()). - RubyFixnum#getLongValue() -> getValue() RubyBignum#float_eq: both return the value field. - RubyString.newStringShared(Ruby, byte[], Encoding) -> newStringShared(Ruby, byte[], 0, bytes.length, Encoding) RubyInteger.singleCharString: the deprecated method's body. - RubyString.newStringShared(Ruby, byte[], int, int) -> newStringShared(Ruby, byte[], int, int, ASCIIEncoding.INSTANCE) RubyRegexp#named_captures: the deprecated method's body. - new RubyString(Ruby, RubyClass, byte[]) -> RubyString.newString(Ruby, byte[]) MarshalDumper#writeEncoding: the class was stringClass(context), and newString(Ruby, byte[]) is that constructor with runtime.getString(). Drops the now-unused stringClass import. - RubyString#inspect() -> inspect(context) RubyTimeParser (two error messages): inspect() went through RubyBasicObject#inspect() to inspect(getCurrentContext()). Removes 7 deprecation warnings from core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Optional follow-up for review. org.jruby.api.Create.newString(context, byte[]) delegates to RubyString.newString(context.runtime, byte[]), so behavior is identical; this only uses the context-taking API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
@headius the last commit ( The first commit replaces the deprecated public static RubyString newString(ThreadContext context, byte[] bytes) {
return RubyString.newString(context.runtime, bytes);
}Either way the behavior is the same. The question is whether you'd rather have the cleanup move callers to the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First chunk of the deprecation cleanup discussed in #9810. Every change follows the zero-sum rule:
contextis already in scope (no newgetCurrentContext()), and the replacement behaves the same as the deprecated call.RubyNumeric#getLongValue()asLong(context)RubyModule#hashCodegetLongValue()isasLong(getCurrentContext());convertToInteger()returns a Fixnum or Bignum, both of which implementasLongRubyFixnum#getLongValue()getValue()RubyBignum#float_eqvaluefieldRubyString.newStringShared(Ruby, byte[], Encoding)newStringShared(Ruby, byte[], 0, bytes.length, Encoding)RubyInteger.singleCharStringRubyString.newStringShared(Ruby, byte[], int, int)newStringShared(Ruby, byte[], int, int, ASCIIEncoding.INSTANCE)RubyRegexp#named_capturesnew RubyString(Ruby, RubyClass, byte[])RubyString.newString(Ruby, byte[])MarshalDumper#writeEncodingstringClass(context);newStringcalls the same constructor withruntime.getString(). The constructor was deprecated in 1bda114 ("Deprecate all public String constructors") so callers go through factoriesRubyString#inspect()inspect(context)RubyTimeParser(2 error messages)inspect()reachesinspect(getCurrentContext())viaRubyBasicObject#inspect()Removes 7 deprecation warnings from
core, adds none. Checked with a full-Xlint:deprecation,removal -Xmaxwarnscompile, since the CI log stops at 100 warnings.mspec cion core marshal, regexp, time, module, integer andString#inspect: 3451 examples, 0 failures.Adding
@Deprecatedto overrides of deprecated methods will be a separate PR.🤖 Generated with Claude Code