Skip to content

JRuby 9.2 with unified Integer raises ClassCastException #336

@headius

Description

@headius

We have been working on our Ruby 2.4 support for a release in the next couple months. Rubhy 2.4 unified Fixnum and Bignum into Integer, which means some APIs that only expected to get Fixnum or Bignum before might need to adapt to support both.

It appears that the JRuby extension has not been updated for that change yet. I get the following error in MRI's test_json.rb:

[ 3/32] TestJSON#test_big_integers = 0.01 s
  1) Error:
TestJSON#test_big_integers:
Java::JavaLang::ClassCastException: org.jruby.RubyBignum cannot be cast to org.jruby.RubyFixnum
    json.ext.Generator$2.generate(Generator.java:224)
    json.ext.Generator$4.generate(Generator.java:292)
    json.ext.Generator$4.generate(Generator.java:249)
    json.ext.Generator$Handler.generateNew(Generator.java:171)
    json.ext.Generator.generateJson(Generator.java:57)
    json.ext.GeneratorState.generate(GeneratorState.java:209)
    json.ext.GeneratorState$INVOKER$i$1$0$generate.call(GeneratorState$INVOKER$i$1$0$generate.gen)

Any place that assumes it will only receive Fixnums should probably be audited. I can help, but I assume this work was already done for the C ext, and the changes should be very similar for the Java ext.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions