Change in how Java method names are mapped to Ruby names
--------------------------------------------------------

                 Key: JRUBY-5540
                 URL: http://jira.codehaus.org/browse/JRUBY-5540
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.6RC2
         Environment: Mac OS 10.6, Java 1.6.0_22-b04-307-10M3261, JRuby 
1.6.0.RC2
            Reporter: Rich Drummond


In certain cases, JRuby 1.6.0.RC2 maps Java methods names to Ruby method names 
differently than earlier versions.

For example, consider this irb session in JRuby 1.5.5:

{code}
irb(main):001:0> require 'java'
=> true
irb(main):002:0> import javax.xml.transform.TransformerFactory
=> Java::JavaxXmlTransform::TransformerFactory
irb(main):003:0> t=TransformerFactory.new_instance
=> 
#<Java::ComSunOrgApacheXalanInternalXsltcTrax::TransformerFactoryImpl:0x2e19fc25>
irb(main):004:0> t.methods.sort.select{|x| x =~ /uri/}
=> ["get_uriresolver", "set_uriresolver", "uriresolver", "uriresolver="]
irb(main):005:0>
{code}


Now compare that to the same sequence of statements in irb in JRuby 1.6.0.RC2:

{code}
irb(main):001:0> require 'java'
=> true
irb(main):002:0> import javax.xml.transform.TransformerFactory
=> Java::JavaxXmlTransform::TransformerFactory
irb(main):003:0> t=TransformerFactory.new_instance
=> 
#<Java::ComSunOrgApacheXalanInternalXsltcTrax::TransformerFactoryImpl:0x20823c6d>
irb(main):004:0> t.methods.sort.select{|x| x =~ /uri/}
=> ["get_uri_resolver", "set_uri_resolver", "uri_resolver", "uri_resolver="]
{code}

Whereas in 1.5.5 the Java method setURIResolver became the Ruby method 
set_uriresolver; in 1.6.0.RC2 it becomes set_uri_resolver.

Perhaps this was an intentional change? (1.6.0.RC2's behaviour results in more 
readable method names in this case.) However, it will cause code that was 
depending on the old behaviour to break (like mine), so I thought it was worth 
pointing out.


-- 
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