Skip to content

Ignore empty kwrest in Data subtypes' constructors#9215

Merged
headius merged 1 commit intojruby:masterfrom
headius:data_new_empty_kwrest
Feb 10, 2026
Merged

Ignore empty kwrest in Data subtypes' constructors#9215
headius merged 1 commit intojruby:masterfrom
headius:data_new_empty_kwrest

Conversation

@headius
Copy link
Member

@headius headius commented Feb 4, 2026

When passing empty kwrest into a method, hasKeyword will be true but there will not actually be any keyword hash in the argument list. We need to also check for "empty" keywords before proceeding to use any incoming kwargs hash.

Fixes #9214

When passing empty kwrest into a method, `hasKeyword` will be true
but there will not actually be any keyword hash in the argument
list. We need to also check for "empty" keywords before proceeding
to use any incoming kwargs hash.

Fixes jruby#9214
@headius headius force-pushed the data_new_empty_kwrest branch from 3da9634 to 7cccb7e Compare February 5, 2026 04:03
@headius headius marked this pull request as ready for review February 10, 2026 18:04
@headius headius merged commit 4db0c8a into jruby:master Feb 10, 2026
79 checks passed
@headius headius deleted the data_new_empty_kwrest branch February 10, 2026 18:04
headius added a commit to headius/jruby that referenced this pull request Feb 10, 2026
This expands the fix from jruby#9215 to Struct and creats a
new utility method for checking that keywords were passed AND were
non-empty.

Fixes jruby#9224.
rossroberts-toast added a commit to rossroberts-toast/elasticgraph that referenced this pull request Mar 24, 2026
Upgrades JRuby CI builds from 10.0 to 10.0.4.0 and setup-ruby from
v1.288.0 to v1.295.0 across all workflow files.

JRuby patches updated for 10.0.4.0 compatibility:

- Remove the `< 10.0.4.0` version gate so patches remain active.
- Remove Bug 1 (Data.new splat forwarding) — fixed upstream in
  10.0.4.0 (jruby/jruby#9215, jruby/jruby#9225).
- Keep Bug 2 (Data#to_h/deconstruct on subclasses) — still needed,
  now applied via a Data.define hook since JRuby 10.0.4.0 defines
  to_h directly on each Data.define subclass.
- Work around a new JRuby 10.0.4.0 bug where `include`-ing a module
  in a Data.define block causes subclass instances to have nil fields
  in certain call patterns. Fix by defining instance methods directly
  in the Data.define block instead of using `include InstanceMethods`.
myronmarston pushed a commit to block/elasticgraph that referenced this pull request Mar 25, 2026
* Upgrade to JRuby 10.0.4.0 and setup-ruby v1.295.0

Upgrades JRuby CI builds from 10.0 to 10.0.4.0 and setup-ruby from
v1.288.0 to v1.295.0 across all workflow files.

JRuby patches updated for 10.0.4.0 compatibility:

- Remove the `< 10.0.4.0` version gate so patches remain active.
- Remove Bug 1 (Data.new splat forwarding) — fixed upstream in
  10.0.4.0 (jruby/jruby#9215, jruby/jruby#9225).
- Keep Bug 2 (Data#to_h/deconstruct on subclasses) — still needed,
  now applied via a Data.define hook since JRuby 10.0.4.0 defines
  to_h directly on each Data.define subclass.
- Work around a new JRuby 10.0.4.0 bug where `include`-ing a module
  in a Data.define block causes subclass instances to have nil fields
  in certain call patterns. Fix by defining instance methods directly
  in the Data.define block instead of using `include InstanceMethods`.

* remove specific version pin

* add jruby issue number

* remove unneeded jruby_patches file and unused module InstanceMethods

* remove require deleted jruby patch file
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.

Data.define single-attribute class rejects positional arguments

1 participant