Skip to content

Calling super() in a reopened Java subclass method triggers NPE in IRRuntimeHelpers.javaProxySuper #6968

@ikaronen-relex

Description

@ikaronen-relex

Here's one more regression between JRuby 9.2.19.0 and 9.3.2.0 involving reopened Java classes (but this time no constructors):

describe "JRuby Java inheritance with JRuby #{JRUBY_VERSION}" do
  class Java::Test::JRubyInheritanceTestThreeSubclass
    def foo(s)
      super(s + 'baz')
    end
  end

  it 'calls method defined in Java superclass of reopened class with super()' do
    obj = Java::Test::JRubyInheritanceTestThreeSubclass.new
    expect(obj.foo('bar')).to eq('foobarbaz')
  end
end
package test;

public class JRubyInheritanceTestThree {
    public JRubyInheritanceTestThree() {}

    public String foo(String s) {
        return "foo" + s;
    }
}
package test;

public class JRubyInheritanceTestThreeSubclass extends JRubyInheritanceTestThree {
}

RSpec output under JRuby 9.2.19.0:

JRuby Java inheritance with JRuby 9.2.19.0
  calls method defined in Java superclass of reopened class with super()

Finished in 0.02122 seconds (files took 0.36372 seconds to load)
1 example, 0 failures

RSpec output under JRuby 9.3.2.0:

JRuby Java inheritance with JRuby 9.3.2.0
  calls method defined in Java superclass of reopened class with super() (FAILED - 1)

Failures:

  1) JRuby Java inheritance with JRuby 9.3.2.0 calls method defined in Java superclass of reopened class with super()
     Failure/Error: Unable to find org.jruby.ir.runtime.IRRuntimeHelpers.javaProxySuper(IRRuntimeHelpers.java to read failed line
     Java::JavaLang::NullPointerException:
     # org.jruby.ir.runtime.IRRuntimeHelpers.javaProxySuper(IRRuntimeHelpers.java:1244)
     # org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:1204)
     # org.jruby.ir.instructions.InstanceSuperInstr.interpret(InstanceSuperInstr.java:131)
     # org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:361)
     # org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
...
     # org.jruby.Main.main(Main.java:207)

Finished in 0.02579 seconds (files took 0.36036 seconds to load)
1 example, 1 failure

Failed examples:

rspec  # JRuby Java inheritance with JRuby 9.3.2.0 calls method defined in Java superclass of reopened class with super()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions