Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby 1.6RC3
-
Component/s: Application Error, HelpWanted, Intro
-
Labels:None
-
Environment:
-
Number of attachments :
Description
The 'public_instance_methods' method reports different results for MRI and JRuby when running within Rake. Even though they report the same ancestors of self's class, the methods differ.
In particular, methods from FileUtils are not listed in public_instance_methods from MRI but they are in JRuby.
Reproduced with this code in a Rakefile, then run with Rake 0.7.3 on both:
class << self
p ancestors
p public_instance_methods
end
MRI gives this:
[Object, RakeFileUtils, FileUtils, FileUtils::StreamUtils_, Kernel]
["methods", "instance_eval", "dup", "require_gem", "instance_variables", "instance_of?", "extend", "eql?", "taguri", "id", "hash", "singleton_methods", "include", "taguri=", "taint", "instance_variable_get", "frozen?", "kind_of?", "method", "to_a", "display", "type", "protected_methods", "public", "instance_variable_set", "is_a?", "respond_to?", "to_s", "to_yaml", "object_id", "class", "private_methods", "==", "tainted?", "require", "__id__", "===", "untaint", "nil?", "to_yaml_style", "inspect", "send", "=~", "clone", "public_methods", "private", "__send__", "freeze", "equal?", "to_yaml_properties", "gem"]
While JRuby gives this:
["public", "include", "private", "to_s", "java_kind_of?", "to_yaml_node", "file", "multitask", "taguri", "desc", "namespace", "timeout", "Rational", "to_yaml_properties", "include_class", "task", "directory", "file_create", "import", "rule", "to_yaml", "to_yaml_style", "sh", "chmod", "ln_s", "mv", "symlink", "install", "nowrite", "safe_unlink", "rm_f", "copy", "ln", "mkpath", "cp_r", "mkdir", "mkdir_p", "chdir", "move", "rmdir", "chown_R", "ln_sf", "cp", "chown", "ruby", "link", "remove", "rm", "rmtree", "chmod_R", "rm_r", "cd", "makedirs", "verbose", "touch", "when_writing", "rm_rf", "split_all", "fu_world_writable?", "safe_ln", "object_id", "frozen?", "eql?", "=~", "methods", "to_a", "tainted?", "javax", "trap", "taint", "public_methods", "dup", "method", "==", "singleton_methods", "is_a?", "instance_eval", "equal?", "instance_variable_get", "com", "instance_of?", "hash", "inspect", "java", "org", "__id__", "clone", "__send__", "id", "instance_variable_set", "send", "gem", "untaint", "class", "protected_methods", "kind_of?", "require_gem", "instance_variables", "display", "extend", "freeze", "private_methods", "nil?", "type", "===", "instance_exec", "require", "respond_to?"]
I have a problem with Needle 1.3.0 breaking because of this. In a more complex situation, it tries to call 'undef_method' on a method returned by 'public_instance_methods', but that method isn't "there", causing an error. (But it works in the simpler situation above).
Issue Links
- is related to
-
JRUBY-2247
Object#methods is incorrect in some cases
-
Sorry, the JRuby output should be this (first line was missing above):
[Object, RakeFileUtils, FileUtils, FileUtils::StreamUtils_, Kernel]
["public", "include", "private", "to_s", "java_kind_of?", "to_yaml_node", "file", "multitask", "taguri", "desc", "namespace", "timeout", "Rational", "to_yaml_properties", "include_class", "task", "directory", "file_create", "import", "rule", "to_yaml", "to_yaml_style", "sh", "chmod", "ln_s", "mv", "symlink", "install", "nowrite", "safe_unlink", "rm_f", "copy", "ln", "mkpath", "cp_r", "mkdir", "mkdir_p", "chdir", "move", "rmdir", "chown_R", "ln_sf", "cp", "chown", "ruby", "link", "remove", "rm", "rmtree", "chmod_R", "rm_r", "cd", "makedirs", "verbose", "touch", "when_writing", "rm_rf", "split_all", "fu_world_writable?", "safe_ln", "object_id", "frozen?", "eql?", "=~", "methods", "to_a", "tainted?", "javax", "trap", "taint", "public_methods", "dup", "method", "==", "singleton_methods", "is_a?", "instance_eval", "equal?", "instance_variable_get", "com", "instance_of?", "hash", "inspect", "java", "org", "__id__", "clone", "__send__", "id", "instance_variable_set", "send", "gem", "untaint", "class", "protected_methods", "kind_of?", "require_gem", "instance_variables", "display", "extend", "freeze", "private_methods", "nil?", "type", "===", "instance_exec", "require", "respond_to?"]