defined? on metaclass hierarchy elements does not appear to search fully
------------------------------------------------------------------------

                 Key: JRUBY-4479
                 URL: http://jira.codehaus.org/browse/JRUBY-4479
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.5
            Reporter: Charles Oliver Nutter


Here's an example with a constant... there may be other cases, though methods 
appear to work:

{noformat}
class Foo
  BLAH = 1
  class << self
    def has_blah
      defined? self::BLAH
    end
  end
end

class Bar < Foo; end
p Bar.has_blah
p defined? Bar.has_blah
{noformat}

Should output "constant" followed by "method", but instead does nil and 
"method" on JRuby.

This prevents the session library from working due to the hierarchy of 
AbstractSession subclasses and the way it locates the "default_prog" on a 
per-class basis:

{noformat}
...
    class << self
      def default_prog
        return @default_prog if defined? @default_prog and @default_prog
        if defined? self::DEFAULT_PROG
          return @default_prog = self::DEFAULT_PROG 
        else
          @default_prog = ENV["SESSION_#{ self }_PROG"]
        end
        nil
      end
...
{noformat}

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