Method#owner returns wrong implementation module #4262

Closed
etehtsea opened this Issue Nov 2, 2016 · 4 comments

Projects

None yet

2 participants

@etehtsea
Contributor
etehtsea commented Nov 2, 2016 edited

Kernel#method used in examples but it seems that both methods are relying on implementationModule variable.

JRuby master (actually proper implementation called in RubyIO):

>> s0.method(:inspect)
=> #<Method: UNIXSocket(Kernel)#inspect>

MRI:

[17] pry(main)> s0.method(:inspect)
=> #<Method: UNIXSocket(IO)#inspect>
@headius
Member
headius commented Nov 2, 2016

You sure you're on master HEAD? I'm pretty sure I just fixed this for freerange/mocha#274 in #4250.

@etehtsea
Contributor
etehtsea commented Nov 2, 2016

@headius seems to be another issue. I've got the same result on 9.1.5.0 and b0abc53.

@headius
Member
headius commented Nov 2, 2016

I don't think this is related to Method#owner. I think this is due to IO not defining its own inspect method. Instead, it just overrides the Java impl. As a result, the only inspect in any method table is the one from Kernel.

$ jruby -rsocket -e 'p UNIXSocket.instance_method(:inspect).owner'
Kernel

If I modify RubyIO to actually define inspect as a Ruby method, then it matches your result:

$ jruby -rsocket -e 'p UNIXSocket.instance_method(:inspect).owner'
IO

I'll go ahead with that fix.

@headius headius added this to the JRuby 9.1.6.0 milestone Nov 2, 2016
@headius headius closed this in fa6a300 Nov 2, 2016
@etehtsea
Contributor
etehtsea commented Nov 3, 2016

@headius you are right, I missed that. Thank you!

@eregon eregon added a commit that referenced this issue Nov 27, 2016
@eregon eregon Squashed 'spec/ruby/' changes from a2e5952..852254a
852254a Fixed setting ThreadGroup for signal handler Thread.
0efde43 Fix flock spec: it only applies on Solaris and needs some setup
29b472c Split an example to get guards outside the example
4859bbb [Truffle] Compile c specs with extconf make
621ce1b spawn.rb: Pass PATH variable to started process.
7727dac setuid_spec.rb: Set execute bit before setting setuid bit on Solaris.
78a81b4 Handle no supplementary groups in grpowned? specs
8901448 Solaris returns -1 on rdev on ordinary files; update test to use /dev/zfs on Solaris.
30ae2c3 Fix UDPSocket.new spec, Solaris reports a different error on unknown protocol family.
8b352c3 Move Solaris File#flock specs in a different describe
9cd374e [Truffle] Show command if compilation fails.
4fc62b4 Improve Thread::Backtrace::Location#label specs
6fb234b Add spec for remove_method against cloned singleton.
9755210 Add spec for replacing singleton method in a cloned singleton.
327594e Add specs for UNIXSocket#inspect
5e79514 Add spec for IO#inspect's owner. See jruby/jruby#4262
51f80aa /regexp/.source should not display escape characters
7bda8e3 Require squiggly_heredoc only in examples so they can easily be tagged and the file be loaded
389f951 use SEPARATOR and ALT_SEPARATOR in File.basename
c594305 Fix File.dirname on Windows (including UNC)
5a15ff7 fix File.dirname with backslashes in unix
4ba6827 No TypeError on dup (#360)
3f3b283 Home directory is taken from system (#359)
913edd4 Merge pull request #357 from eregon/share_delete
85b1e0e Add spec for File::SHARE_DELETE
b61fdb5 Make sure all spawn specs with minimal environment have a successful exit status
71152a1 Always disable rubygems for spawn specs with minimal environment
b182988 Fix spec to use absolute path in unlink specs
5c33417 Use paths inside the temp directory for the unlink spec
3a1b57c Restrict testing with Ruby 2.3 64-bit on AppVeyor
772254d Add spec for File::TMPFILE
e1ea963 Add spec for define_method and define_singleton_method requiring an explicit block
66daf29 Merge pull request #355 from ruby/shugo/fix-unsetenv_others_on_icc
74b4241 Add --disable-gems if CC is icc.
be0bf17 Merge pull request #354 from nobu/fix-complex_equal_value
43b176b The result of `==` should be truthy or falsy
22ee32d The result of `==` should be truthy or falsy
2aea831 Try fixing Process.groups by ignoring the primary group id
97f987f Fix Process#groups spec
27960d0 Merge pull request #352 from ruby/revert-351-did_you_mean_spec
dabb1fe Revert "DidYouMean specs for ruby 2.3"
0c53f4c Fix fixture path on windows
b6ddea7 Add debug_info.rb fixture
a0e55db Add spec to test frozen string debug generation
0391aea Add String#+@ in conjunction  with freeze-magic-comment spec
a6edbbf Merge pull request #351 from mjago/did_you_mean_spec
2d79878 Fix Ruby Version
e075552 DidYouMean specs for ruby 2.3
3ce9295 Merge pull request #350 from mjago/aix_invalid_syslog_constants
9757670 As with solaris avoid testing aix unknown syslog constants
d152cba Fix Ruby version.
7783c4c Module#include and Module#prepend don't accept no-arguments in 2.4.
5eb8b40 Require round-to-nearest-even behavior for Ruby 2.4+ (#322)
39f89d8 Merge pull request #348 from nobu/bug/fork-feature-fix
45efa58 Check fork feature by respond_to?
fe4673a Merge pull request #347 from mjago/fix_remaining_encodings
b53a488 Fix encoding in optional/capi/string_spec.rb
abfba52 Fix encoding in optional/capi/encoding_spec.rb
c43ea57 Fix encoding in library/zlib/inflate/set_dictionary_spec.rb
1c54447 Fix encoding in library/socket/socket/gethostbyname_spec.rb
8113f43 Fix encoding in library/openssl/shared/constants.rb
1551379 Fix encoding in language/string_spec.rb
c5d6ec9 Fix encoding in language/regexp/escapes_spec.rb
9631f02 Fix encoding in language/regexp/encoding_spec.rb
8dfae6c Fix encoding in core/time/_load_spec.rb
c3f1719 Fix encoding in core/time/_dump_spec.rb
99af163 Fix encoding in core/symbol/casecmp_spec.rb
854f7b2 Fix encoding in core/string/valid_encoding_spec.rb
182b382 Fix encoding in core/string/unicode_normalize_spec.rb
738584e Fix encoding in core/string/squeeze_spec.rb
b12b094 Fix encoding in core/string/slice_spec.rb
cd5ced3 Fix encoding in core/string/shared/succ.rb
bf3d210 Fix encoding in core/string/shared/eql.rb
1ddfd79 Fix encoding in core/string/shared/encode.rb
990e4bc Fix encoding in core/string/shared/each_codepoint_without_block.rb

git-subtree-dir: spec/ruby
git-subtree-split: 852254a3371e3ce3e3007c49d0c23cf615e0409b
d454687
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment