Skip to content

RUBY-3947 Use RubyFixnum.newFixnum instead of the constructor - #377

Merged
comandeo-mongo merged 2 commits into
mongodb:masterfrom
stefanlew-tractive:RUBY-3947-fixnum-factory
Oct 15, 2026
Merged

comandeo-mongo merged 2 commits into
mongodb:masterfrom
stefanlew-tractive:RUBY-3947-fixnum-factory

Conversation

@stefanlew-tractive

@stefanlew-tractive stefanlew-tractive commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Replace all seven direct RubyFixnum constructor calls in ByteBuf.java
with RubyFixnum.newFixnum(...).

JRuby 10.1 made RubyFixnum abstract as part of its
LongFixnum/ShortFixnum implementation. Direct construction now raises
Java::JavaLang::InstantiationError. The existing factory returns the
appropriate concrete implementation and is also available on older JRuby
versions.

Testing

BSON’s test suite passes on JRuby 10.0.5.0 and 10.1.2.0 with JDK 21.

References

@comandeo-mongo
comandeo-mongo merged commit df6c74a into mongodb:master Oct 15, 2026
52 checks passed
@comandeo-mongo comandeo-mongo added the bug Fixes a bug, with no new features or broken compatibility label Oct 15, 2026
johnnyshields added a commit to johnnyshields/delayed_job_mongoid that referenced this pull request Nov 14, 2026
bson 5.2.0's Java extension instantiates org.jruby.RubyFixnum, which
JRuby 10.1 made abstract: every BSON serialization raises
java.lang.InstantiationError. The fix is merged upstream
(mongodb/bson-ruby#377) but not released yet; bson main passes its
suite on JRuby 10.1.3 (7354 examples, 0 failures).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes a bug, with no new features or broken compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants