Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.5
-
Fix Version/s: JRuby 1.7.0.pre2
-
Component/s: Java Integration
-
Labels:None
-
Environment:Linux 2.6.32-35-generic #78-Ubuntu SMP Tue Oct 11 16:11:24 UTC 2011 x86_64 GNU/Linux
-
Number of attachments :
Description
For a Java method that accepts a java.lang.Number.
public static void testMethod(Number number)
Calling that method with a Ruby Fixnum literal will not work with the following error:
testMethod(100)
TypeError: could not coerce Fixnum to class java.lang.Number
Can you try testMethod(100.to_java)? See https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby.