java class objectId() overrides .object_id
------------------------------------------

                 Key: JRUBY-5090
                 URL: http://jira.codehaus.org/browse/JRUBY-5090
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.5
            Reporter: Xore Ander


I have a java class which inherits the static method objectId() from 
http://commons.apache.org/logging/apidocs/org/apache/commons/logging/impl/LogFactory.html

When I migrated my codebase from jruby 1.4 to 1.5, my app started breaking 
because a const_missing call ended up dying in 
activesupport/.../introspection.rb where it was polling .object_id of a variety 
of constants. It seems that the wrapper for SomeJavaClass maps .object_id to 
SomeJavaClass.objectId(arg1), and was dying in a 0 for 1 argument error.

JavaUtil.getRubyCasedName(...) seems to be involved, however, i believe i 
tracked down the core issue here:
http://github.com/jruby/jruby/commit/7c4139b5eb12ac5794b79a20fe37e8f2877d6da4
in
-        RESERVED_NAMES.put("object_id", new AssignedName("object_id", 
Priority.RESERVED));

It's not clear to me why "object_id" would be removed from RESERVED_NAMES but 
"__id__" was not. Was this change made in error? Should object_id have been 
added to STATIC_RESERVED_NAMES and/or INSTANCE_RESERVED_NAMES? (my case deals 
with STATIC, but I can see this affecting INSTANCEs as well)

I fixed the regression locally by reverting the one line of the change
+        RESERVED_NAMES.put("object_id", new AssignedName("object_id", 
Priority.RESERVED));


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