Skip to content

Use java_import instead of import#10

Open
perlun wants to merge 1 commit intodekellum:devfrom
perlun:patch-1
Open

Use java_import instead of import#10
perlun wants to merge 1 commit intodekellum:devfrom
perlun:patch-1

Conversation

@perlun
Copy link
Copy Markdown

@perlun perlun commented Jun 12, 2016

The import statement is apparently deprecated: https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby#using-a-java-class-without-the-full-path-name, so this would be the recommended approach these days I'd guess.

The `import` statement is apparently deprecated: https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby#using-a-java-class-without-the-full-path-name, so this would be the recommended approach these days I'd guess.
@perlun
Copy link
Copy Markdown
Author

perlun commented Jul 10, 2016

@dekellum - could this be merged?

@dekellum
Copy link
Copy Markdown
Owner

If JRuby's import is deprecated, it doesn't so much as issue a warning that I can find. Without any demonstrated problem, I'm disinclined to change this for only one of the many rjack and related gems which currently use import. Thanks for pointing this out, but I intend to leave this open to be potentially resolved in a uniform way in the future.

@perlun
Copy link
Copy Markdown
Author

perlun commented Jul 12, 2016

Hi,

From the page I linked:

Note: For older scripts where import was used we have deprecated that for java_import to not conflict with rake.

JRUBY-3171 has more information, but unfortunately the Codehaus services are shutdown since a few years so I cannot give you the link. But funnily enough, you wrote about it 8 years ago:

However, there is an unfortunate incompatibility with JRuby and Rake both currently defining Object::import (JRUBY-3171). There is a simple workaround: Include an alternative ruby include that just defines version constants without any java imports. In this case its lib/jetty/base.rb, which defines VERSION and JETTY_VERSION in the Jetty module.

This is the conflicting method in Rake: http://apidock.com/ruby/Rake/DSL/import, which is why the JRuby people started moving away from import to jruby_import instead.

(I'm fine with you wanting to fix this in a more uniform way. Thanks for letting us know.)

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.

2 participants