Skip to content

JRuby unable to find methods unless jar is in boot classpath #4266

@jmiettinen

Description

@jmiettinen

Environment

  • JRuby 9.1.5.0 or 1.7.23 on OS X (Darwin jmiettinen.local 14.5.0 Darwin Kernel Version 14.5.0: Sun Sep 25 22:07:15 PDT 2016; root:xnu-2782.50.9~1/RELEASE_X86_64 x86_64)
  • No gems, no JAVA_OPTS
  • To reproduce, clone test-case repository and run run.sh which runs both failing and succeeding case.
  • JRuby-complete-jar is used to run org.jruby.Main which then runs a JRuby-script calling a few Java-classes.

Expected Behavior

When running a simple script with just having JRuby in the classpath, not in boot classpath, I would expect the JRuby to correctly resolve Java-methods and call them.

So in that case, the script should print out results of two different builder implementations:

SimpleClassImpl/5
SimpleClassImpl/5
BrokenClassImpl/5
BrokenClassImpl/5

Actual Behavior

What actually happens is that calls succeed when the target Java-class is publicly visible, the calls succeed, but JRuby cannot find the target when implementor of the method is package-private.

SimpleClassImpl/5
SimpleClassImpl/5
NoMethodError: undefined method `set_value' for #<Java::FiRelex::BrokenClass::Builder:0x6fa0450e>
  <main> at src/main/ruby/test.rb:9

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions