{"action":"created","issue":{"url":"https://api.github.com/repos/jruby/jruby/issues/540","labels_url":"https://api.github.com/repos/jruby/jruby/issues/540/labels{/name}","comments_url":"https://api.github.com/repos/jruby/jruby/issues/540/comments","events_url":"https://api.github.com/repos/jruby/jruby/issues/540/events","html_url":"https://github.com/jruby/jruby/issues/540","id":11137653,"number":540,"title":"Inconsistency between MRI and JRuby when private methods are called and method_missing is present","user":{"login":"jvshahid","id":297621,"avatar_url":"https://avatars.githubusercontent.com/u/297621?v=3","gravatar_id":"","url":"https://api.github.com/users/jvshahid","html_url":"https://github.com/jvshahid","followers_url":"https://api.github.com/users/jvshahid/followers","following_url":"https://api.github.com/users/jvshahid/following{/other_user}","gists_url":"https://api.github.com/users/jvshahid/gists{/gist_id}","starred_url":"https://api.github.com/users/jvshahid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvshahid/subscriptions","organizations_url":"https://api.github.com/users/jvshahid/orgs","repos_url":"https://api.github.com/users/jvshahid/repos","events_url":"https://api.github.com/users/jvshahid/events{/privacy}","received_events_url":"https://api.github.com/users/jvshahid/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jruby/jruby/labels/core","name":"core","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2013-02-19T01:10:51Z","updated_at":"2015-05-05T23:50:22Z","closed_at":null,"body":"```ruby\r\n#!/usr/bin/env ruby\r\nclass Foo\r\n  def method_missing name\r\n    super\r\n  end\r\n  private\r\n  def foo\r\n    'foo'\r\n  end\r\nend\r\n\r\nFoo.new.foo\r\n```\r\n\r\nthis code will generate an exception with different messages under MRI and JRuby.\r\n\r\nMRI:\r\n```\r\n/home/jvshahid/foo.rb:4:in `method_missing': private method `foo' called for #<Foo:0x00000001eed260> (NoMethodError)\r\n\tfrom /home/jvshahid/foo.rb:14:in `<main>'\r\n```\r\n\r\nJRuby:\r\n```\r\nNoMethodError: undefined method `foo' for #<Foo:0x64e137c0>\r\n  method_missing at org/jruby/RubyBasicObject.java:1652\r\n  method_missing at /home/jvshahid/foo.rb:4\r\n          (root) at /home/jvshahid/foo.rb:12\r\n```\r\n\r\nNotice that JRuby's exception doesn't mention that the method we're trying to access is private. This cause three specs to fail in rails since unfortunately they rely on the wording of the exception."},"comment":{"url":"https://api.github.com/repos/jruby/jruby/issues/comments/99263545","html_url":"https://github.com/jruby/jruby/issues/540#issuecomment-99263545","issue_url":"https://api.github.com/repos/jruby/jruby/issues/540","id":99263545,"user":{"login":"rjnienaber","id":521795,"avatar_url":"https://avatars.githubusercontent.com/u/521795?v=3","gravatar_id":"","url":"https://api.github.com/users/rjnienaber","html_url":"https://github.com/rjnienaber","followers_url":"https://api.github.com/users/rjnienaber/followers","following_url":"https://api.github.com/users/rjnienaber/following{/other_user}","gists_url":"https://api.github.com/users/rjnienaber/gists{/gist_id}","starred_url":"https://api.github.com/users/rjnienaber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjnienaber/subscriptions","organizations_url":"https://api.github.com/users/rjnienaber/orgs","repos_url":"https://api.github.com/users/rjnienaber/repos","events_url":"https://api.github.com/users/rjnienaber/events{/privacy}","received_events_url":"https://api.github.com/users/rjnienaber/received_events","type":"User","site_admin":false},"created_at":"2015-05-05T23:50:22Z","updated_at":"2015-05-05T23:50:22Z","body":"Still present in 1.7.20 and HEAD:\r\n\r\n```\r\n----------\r\nruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-darwin14.0.0]\r\n/tmp/test.rb:4:in `method_missing': private method `foo' called for #<Foo:0x007f90a392a7d0> (NoMethodError)\r\n\tfrom /tmp/test.rb:12:in `<main>'\r\n----------\r\njruby 1.7.20 (1.9.3p551) 2015-05-04 3086e6a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_05-b13 +jit [darwin-x86_64]\r\nNoMethodError: undefined method `foo' for #<Foo:0x3551a94>\r\n  method_missing at org/jruby/RubyBasicObject.java:1498\r\n  method_missing at /tmp/test.rb:4\r\n          (root) at /tmp/test.rb:12\r\n==========\r\nruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]\r\n/tmp/test.rb:4:in `method_missing': private method `foo' called for #<Foo:0x007fb25480aa08> (NoMethodError)\r\n\tfrom /tmp/test.rb:12:in `<main>'\r\n----------\r\njruby 9.0.0.0-SNAPSHOT (2.2.2) 2015-05-05 c0d9bc3 Java HotSpot(TM) 64-Bit Server VM 25.5-b02 on 1.8.0_05-b13 +jit [darwin-x86_64]\r\nNoMethodError: undefined method `foo' for #<Foo:0x6eebc39e>\r\n  method_missing at org/jruby/RubyBasicObject.java:1606\r\n  method_missing at /tmp/test.rb:4\r\n           <top> at /tmp/test.rb:12\r\n----------\r\n```"}}