Skip to content

LoadError with 'compiled' ruby files with JRuby9000 (using rescue) #3613

@gcristelli

Description

@gcristelli

Compiling Ruby code into a class file and trying to load it afterwards leads to "LoadError: use java_import to load normal classes" if it includes a rescue command.

test.rb

puts 'hello world' rescue nil

compiled and run with

jrubyc test.rb
jruby -e "load 'test.class'"

leads to

LoadError: test.class is not compiled Ruby; use java_import to load normal classes
   load at org/jruby/RubyKernel.java:955
  <top> at -e:1

This happens with the current 9.0.5.0 snapshot and all previous 9.0.x versions.

$ jruby -v
jruby 9.0.5.0-SNAPSHOT (2.2.3) 2016-01-22 d7aefef Java HotSpot(TM) 64-Bit Server VM 25.65-b01 on 1.8.0_65-b17 +jit [linux-amd64]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions