Skip to content

Conversation

headius
Copy link
Member

@headius headius commented Jun 26, 2024

This was originally done on purpose while working toward the possibility of lazy imports, but it's better for now to just let the class initialize and fail fast if there are linkage errors.

Fixes #8299

Resolves regression discussed in #799 that prevented consistent error messages for unlinkable classes.

This was originally done on purpose while working toward the
possibility of lazy imports, but it's better for now to just let
the class initialize and fail fast if there are linkage errors.

Fixes jruby#8299

Resolves regression discussed in jruby#799 that prevented consistent
error messages for unlinkable classes.
@headius headius added this to the JRuby 10.0.0.0 milestone Jun 26, 2024
@headius
Copy link
Member Author

headius commented Jun 26, 2024

New output for unlinkable java_import shows consistency with the method_missing and const_missing forms:

$ jruby -e 'java_import "blah.Blah"'
NameError: cannot link Java class blah.Blah (java.lang.NoClassDefFoundError: blah/Foo)
  java_import at org/jruby/javasupport/ext/Module.java:99
  java_import at uri:classloader:/jruby/java/core_ext/object.rb:3
       <main> at -e:1
$ jruby -e 'Java::blah.Blah'
NameError: cannot link Java class blah.Blah (java.lang.NoClassDefFoundError: blah/Foo)
  method_missing at org/jruby/javasupport/JavaPackage.java:253
          <main> at -e:1
$ jruby -e 'Java::blah::Blah'
NameError: cannot link Java class blah.Blah (java.lang.NoClassDefFoundError: blah/Foo)
  const_missing at org/jruby/javasupport/JavaPackage.java:126
         <main> at -e:1

@headius headius linked an issue Jun 26, 2024 that may be closed by this pull request
@headius headius merged commit 55b7eb3 into jruby:9.5-dev Jun 26, 2024
@headius headius deleted the eager_class_init branch November 22, 2024 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linkage errors from java_import are lazy

1 participant