Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Java Integration
-
Labels:None
Description
When I give a java method a Ruby file: File.new('/home/leon/test.txt')
which expects as java File. I get the following error:
TypeError: expected [java.io.File]; got: [org.jruby.RubyFile]; error: argument type mismatch
Would it be possible to do an automatic conversion here?
We have been talking about a conversion method (for consideration in later releases) toJava() and toJava(Class class) [in Java] which can pass underlying Java lightweight. With this method we can very quickly do Ruby->Java conversion and in the case of toJava(Class) it will make it possible to do:
This will all happen under the covers and will magically work in our Java integration layer. So if you pass a Ruby file to something which expects a Java File it will end up calling toJava(java.io.File) on it. This is being considered as just a piece of some major work which will be happening in Java Integreation during our next major development cycle.