FileTest methods not showing up in File.singleton_methods ---------------------------------------------------------
Key: JRUBY-5276 URL: http://jira.codehaus.org/browse/JRUBY-5276 Project: JRuby Issue Type: Bug Components: Core Classes/Modules Affects Versions: JRuby 1.5.6 Environment: "jruby 1.5.6 (ruby 1.8.7 patchlevel 249) (2010-12-24 6586) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [x86_64-java]" Reporter: rubyfan1 File.directory? and other singleton methods don't show up in JRuby in File.singleton_methods(false), but do in MRI 1.8.7. The methods work, they just aren't visible. I found this when I was doing some metaprogramming with the File class. > irb >> RUBY_DESCRIPTION => "ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]" >> File.open("/tmp/187_methods", "w") do |file| ?> file.write(File.singleton_methods(false).sort.join(",")); ?> end => 411 >> quit > ./jirb irb(main):001:0> irb_methods = File.read("/tmp/187_methods").split(",") => ["atime", "basename", "blockdev?", "chardev?", "chmod", "chown", "ctime", "delete", "directory?", "dirname", "executable?", "executable_real?", "exist?", "exists?", "expand_path", "extname", "file?", "fnmatch", "fnmatch?", "ftype", "grpowned?", "identical?", "join", "lchmod", "lchown", "link", "lstat", "mtime", "owned?", "pipe?", "readable?", "readable_real?", "readlink", "rename", "setgid?", "setuid?", "size", "size?", "socket?", "split", "stat", "sticky?", "symlink", "symlink?", "truncate", "umask", "unlink", "utime", "writable?", "writable_real?", "zero?"] irb(main):002:0> irb_methods.each do |method| irb(main):003:1* unless (File.singleton_methods(false).include?(method)) irb(main):004:2> puts "missing #{method}, respond_to? #{File.respond_to?(method)}"; irb(main):005:2* end irb(main):006:1> end missing blockdev?, respond_to? true missing chardev?, respond_to? true missing directory?, respond_to? true missing executable?, respond_to? true missing executable_real?, respond_to? true missing exist?, respond_to? true missing exists?, respond_to? true missing file?, respond_to? true missing grpowned?, respond_to? true missing identical?, respond_to? true missing owned?, respond_to? true missing pipe?, respond_to? true missing readable?, respond_to? true missing readable_real?, respond_to? true missing setgid?, respond_to? true missing setuid?, respond_to? true missing size, respond_to? true missing size?, respond_to? true missing socket?, respond_to? true missing sticky?, respond_to? true missing symlink?, respond_to? true missing writable?, respond_to? true missing writable_real?, respond_to? true missing zero?, respond_to? true => ["atime", "basename", "blockdev?", "chardev?", "chmod", "chown", "ctime", "delete", "directory?", "dirname", "executable?", "executable_real?", "exist?", "exists?", "expand_path", "extname", "file?", "fnmatch", "fnmatch?", "ftype", "grpowned?", "identical?", "join", "lchmod", "lchown", "link", "lstat", "mtime", "owned?", "pipe?", "readable?", "readable_real?", "readlink", "rename", "setgid?", "setuid?", "size", "size?", "socket?", "split", "stat", "sticky?", "symlink", "symlink?", "truncate", "umask", "unlink", "utime", "writable?", "writable_real?", "zero?"] irb(main):007:0> irb(main):008:0* File.singleton_methods(false).sort.each do |method| irb(main):009:1* unless (irb_methods.include?(method)) irb(main):010:2> puts "extra #{method}"; irb(main):011:2* end irb(main):012:1> end => ["atime", "basename", "chmod", "chown", "ctime", "delete", "dirname", "expand_path", "extname", "fnmatch", "fnmatch?", "ftype", "join", "lchmod", "lchown", "link", "lstat", "mtime", "readlink", "rename", "split", "stat", "symlink", "truncate", "umask", "unlink", "utime"] irb(main):013:0> RUBY_DESCRIPTION => "jruby 1.5.6 (ruby 1.8.7 patchlevel 249) (2010-12-24 6586) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [x86_64-java]" -- 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