Caller mismatch within include/extend
-------------------------------------
Key: JRUBY-3958
URL: http://jira.codehaus.org/browse/JRUBY-3958
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.3.1
Environment: Mac OSX
Reporter: Simon Chiang
Assignee: Thomas E Enebo
Priority: Minor
Attachments: caller_test.rb
The JRuby caller does not match MRI Ruby 1.8.7 within extend and include. As
far as I can tell this is only an issue within those methods; normally the
caller appears to match MRI.
This is an example of the inconsistency:
module X
def self.extended(base)
base.instance_variable_set(:@extend_caller, caller.dup)
end
def self.included(base)
base.instance_variable_set(:@include_caller, caller.dup)
end
end
class A
extend X
end
puts A.instance_variable_get(:@extend_caller).inspect
class B
include X
end
puts B.instance_variable_get(:@include_caller).inspect
# % ruby caller_test.rb
# ["caller_test.rb:12:in `extend'", "caller_test.rb:12"]
# ["caller_test.rb:18:in `include'", "caller_test.rb:18"]
# % jruby caller_test.rb
# ["caller_test.rb:12", ":1"]
# ["caller_test.rb:18", ":1"]
I've attached a test for this example.
--
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