As of JRuby 9.3.0.0, linkage errors that would occur during java_import have become lazy, happening only after the import upon the first use of the class.
Using a modified version of the case from #799, the blah.Blah class can be java_imported without error, but eventually fails due to the missing blah.Foo class:
$ (chruby jruby-9.3.14.0 ; jruby -e 'java_import "blah.Blah"')
$ (chruby jruby-9.3.14.0 ; jruby -e 'java_import "blah.Blah"; Blah.new')
Unhandled Java exception: java.lang.NoClassDefFoundError: blah/Foo
java.lang.NoClassDefFoundError: blah/Foo
<clinit> at blah/Blah.java:5
I think this was probably a simple mistake in the porting of java_import from Ruby to Java in #6661 at the following line, which defers class initialization for this path:
5a8ef9f#diff-cabfd925021b0b615287200ad6cf2469755af74bf4dfd560ea31161b22fda59eR116
We probably should fix this to eagerly initialize java_import classes so that linkage errors show up sooner.
As of JRuby 9.3.0.0, linkage errors that would occur during
java_importhave become lazy, happening only after the import upon the first use of the class.Using a modified version of the case from #799, the
blah.Blahclass can bejava_imported without error, but eventually fails due to the missingblah.Fooclass:I think this was probably a simple mistake in the porting of
java_importfrom Ruby to Java in #6661 at the following line, which defers class initialization for this path:5a8ef9f#diff-cabfd925021b0b615287200ad6cf2469755af74bf4dfd560ea31161b22fda59eR116
We probably should fix this to eagerly initialize
java_importclasses so that linkage errors show up sooner.