Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.5
-
Fix Version/s: JRuby 1.6.6, JRuby 1.7.0.pre1
-
Component/s: Java Integration
-
Labels:None
-
Patch Submitted:Yes
-
Number of attachments :
Description
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));
Charlie,
Do you remember the rationale for this change? Restoring "object_id" method as reserved does not seem to fail any existing test.