Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby 1.4
-
Component/s: Java Integration
-
Labels:None
-
Number of attachments :
Description
When calling methods in java from jruby where the same method has multiple signatures, it would be useful to have a way to pass a "typed" null object.
For example if I have 2 methods in java:
doSomething(Frame f, int i)
doSomething(Component c, int i)
and I want to make sure I call the second method but with a null component then in java I do this:
obj.doSomething((Component)null, 0)
But in jruby I haven't found a convinient way to do this. My current solution is to use reflection something like this:
method = obj.java_class.declared_method(:doSomething, Component, int)
method.invoke( obj, Java.primitive_to_java(nil), 0 )
If instead there was something like a null method on wrapped java classes this would be much nicer:
obj.doSomething(Component.null, 0)
The null method could return an special object that the jruby Java method finding code could use to find the correct method in java.
Issue Links
- duplicates
-
JRUBY-558
Integration method matching needs more help with nulls
-