casting null support
--------------------

                 Key: JRUBY-3865
                 URL: http://jira.codehaus.org/browse/JRUBY-3865
             Project: JRuby
          Issue Type: New Feature
          Components: Java Integration
            Reporter: Scott Cytacki


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to