Reputation: 1037
I have a JRuby project that is requiring a third-party .jar file containing several Java classes that I need to use. I am running into an issue where one of the classes is named Process which is conflicting with the top level Ruby Process module.
I have built a github repository with a minimal proof of concept that illustrates the issue: https://github.com/douglasmiller/process_test
Has anyone else encountered a similar issue? What can I do to resolve this?
Upvotes: 0
Views: 157
Reputation: 7166
similar to what you would do in Ruby to solve this - import it under a module (where it's used) or do not import it at all.
do not use java_import org.process_test.Process
and use org.process_test.Process::PROCESS_CONSTANT
directly
if you really want to import only import where it won't conflict :
module MyApp
java_import org.process_test.Process
# MyApp::Process != ::Process
class ProcessStuff
def initialize; puts Process::PROCESS_CONSTANT end
end
end
Upvotes: 1