[1.9] Module hierarchy issues in const_defined? method
-------------------------------------------------------
Key: JRUBY-4197
URL: http://jira.codehaus.org/browse/JRUBY-4197
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules, Ruby 1.9
Reporter: David Calavera
This script seems to work fine at glance, but internally RubyModule uses a
different hierarchy. RubyModule uses getSuperClass() method internally that
returns ModuleA as the super class of Child rather than Parent. In Ruby 1.9
const_defined? returns true if the constant is defined in the parent class but
this desn't work in jruby due to this issue.
{code}
module ModuleA
CONST_A = :CONST_A
end
class Parent
CONST_P = :CONST_P
end
class Child < Parent
include ModuleA
end
puts 'INVOKING SUPERCLASS METHOD: ' + Child.superclass.name
puts "IS CONST DEFINED? #{Child.const_defined?(:CONST_P)}"
{code}
--
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