Skip to content

Bump JRuby to 10.x#18755

Draft
jsvd wants to merge 27 commits intoelastic:mainfrom
jsvd:bump_jruby_10
Draft

Bump JRuby to 10.x#18755
jsvd wants to merge 27 commits intoelastic:mainfrom
jsvd:bump_jruby_10

Conversation

@jsvd
Copy link
Member

@jsvd jsvd commented Feb 9, 2026

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
  • /run exhaustive tests : Run the exhaustive tests Buildkite pipeline.

@mergify
Copy link
Contributor

mergify bot commented Feb 9, 2026

This pull request does not have a backport label. Could you fix it @jsvd? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.
  • If no backport is necessary, please add the backport-skip label

jsvd and others added 19 commits February 12, 2026 09:58
Update from JRuby 10.0.2.0 to 10.0.3.0 and fix all compilation
and test failures introduced by JRuby 10 and Ruby 3.4 changes.

Java fixes:
- RubyArray.op_plus no longer accepts ThreadContext parameter

Ruby 3.4 compatibility:
- Add observer gem dependency (removed from stdlib)
- Fix bundler platform detection for universal-java (no version suffix)
- Update artifact build tasks gem paths from 3.1.0 to 3.4.0

Test fixes for Ruby 3.4 behavior changes:
- TypeError message wording changed
- NoMethodError format uses single quotes instead of backticks
- Exception#error alias removed; use Gem::SourceFetchProblem wrapper
Migrate all deprecated JRuby 9.x API calls to their JRuby 10 equivalents
across 39 source files and 19 test files. The key changes are:

- RubyNumeric.num2int/num2dbl → Convert.toInt/toDouble(context, ...)
- RubyBoolean.newBoolean(runtime, b) → Convert.asBoolean(context, b)
- runtime.newArray()/newArray(int) → Create.newArray/allocArray(context, ...)
- RubyArray.append/push(obj) → append/push(context, obj)
- RubyArray.toJavaArray() → toJavaArray(context)
- RubyString.intern() → intern(context)
- RubyNumeric.getLongValue/getDoubleValue → asLong/asDouble(context)
- RubyModule.defineAnnotatedMethods → defineMethods(context, ...)
- RubyModule.defineAnnotatedConstants → defineConstants(context, ...)
- RubyModule.setConstant/defineConstant → setConstant/defineConstant(context, ...)
- RubyModule.defineOrGetModuleUnder(s) → defineOrGetModuleUnder(context, s, null, -1)
- Ruby.getOrCreateModule(s) → Define.defineModule(context, s)
- Ruby.getModule(s) → Access.getModule(context, s)
- Ruby.getClass(s) → Access.getClass(context, s)
- Ruby.defineClass(...) → Define.defineClass(context, ...)
- RubyBasicObject.to_s()/method(arg) → to_s(context)/method(context, arg, null)
- Java.getProxyClass(ruby, cls) → getProxyClass(context, cls)
- RubyTime.newTimeFromNanoseconds(ruby, n) → newTimeFromNanoseconds(context, n)

Re-enables -Werror in build.gradle now that all warnings are resolved.
- Add csv gem dependency (removed from Ruby 3.4 default gems)
- Replace File::exists? with File.exist? (removed in Ruby 3.4)
Add resolv, syntax_suggest, syslog, and tempfile to the dependency
license report, with corresponding NOTICE files.
Prepend vendored JRuby bin to PATH instead of appending, so the
vendored `gem` command is found before rbenv shims. This fixes
the `preparePluginTestFixtures` task failing with "rbenv: version
'jruby-10.0.3.0' is not installed" in CI environments where rbenv
is initialized.
Read JDK version from .ci/java-versions.properties instead of
hardcoding the default JDK path, which pointed to JDK 17. JRuby 10
class files require JDK 21 to compile against.
In Ruby 3.4 (JRuby 10), bigdecimal was removed from the default gems.
The integration tests have their own vendored gem environment, so
bigdecimal must be declared explicitly in the gemspec since jrjackson
depends on it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use getName() instead of getBaseName() in LoggableExt.java to get full qualified
  class names (e.g., 'LogStash::Filters::Grok' instead of just 'Grok')
- Fix exception type checking in Logstash.java to properly detect
  Bundler::ProductionError using getName()
- Update deprecation_log_spec.rb test pattern to match full logger name
  (deprecation.logstash.filters.ruby instead of deprecation.ruby)

This fixes the issue where JRuby 10 was truncating logger names, resulting
in only ~7 loggers in the monitoring API instead of ~70+ plugin-specific loggers.
jsvd added 7 commits February 12, 2026 11:42
Replace stored currentContext with getCurrentContext() at point of use to avoid null
reference exceptions when codecs are called from different threads.

Problem: NullPointerException - "Cannot invoke RubyThread.setErrorInfo() because
this.thread is null" when codec decode/encode methods are called from different
thread contexts. JRuby 10 stales the thread reference when context is reused across
threads.

Solution: Use RubyUtil.RUBY.getCurrentContext() at point of use in:
- decode() method: Get current context before creating Block
- encode() method: Get current context before calling Ruby methods
- cloneCodec() method: Pass current context to new instance

Fixes input/output Java plugin tests using Ruby codecs.
Remove wait_for_logstash and wait_for_rest_api calls for generator-based test.
The generator with count => 4 exits immediately, causing the REST API check to
timeout. Instead, just wait briefly for process completion before teardown.
Update regex patterns and skip parameters to match new logger names from JRuby 10 fix:
- pipeline_log_spec.rb: Update javapipeline logger name pattern to logstash.javapipeline
- monitoring_api_spec.rb: Add skip parameter for licensereader logger to all assertions
…tions

The licensechecker.licensereader logger has special logging behavior and should
be skipped in all logging level assertions, not just the initial checks.
Changed from setting only logger.deprecation.logstash to setting logger.deprecation,
which ensures all deprecation loggers (including deprecation.ruby) are set to ERROR
level after the JRuby 10 logger name changes.
…ctory

Add settings configuration to ensure logs are written to temp_dir for verification.
…path

The spawn_logstash call needs --path.settings to use the configured log directory,
unlike start_with_stdin which handles this automatically.
…erators

Check if log file exists before attempting to read, since generator-based tests
with fast completion may exit before logs are fully flushed to disk.
@jsvd
Copy link
Member Author

jsvd commented Feb 13, 2026

/run exhaustive tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants