-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
JRuby warns whenever a core method that accesses the caller's frame gets aliased, since we use the name of the method to detect that a frame should be pushed.
However current OpenStruct versions are aliasing several critical builtin methods that it should not, resulting in warnings on JRuby:
$ jruby -we 'require "ostruct"'
/Users/headius/projects/jruby/lib/ruby/stdlib/ostruct.rb:446: warning: OpenStruct#define_singleton_method accesses caller method's state and should not be aliased
/Users/headius/projects/jruby/lib/ruby/stdlib/ostruct.rb:446: warning: OpenStruct#!~ accesses caller method's state and should not be aliased
/Users/headius/projects/jruby/lib/ruby/stdlib/ostruct.rb:446: warning: OpenStruct#=~ accesses caller method's state and should not be aliased
/Users/headius/projects/jruby/lib/ruby/stdlib/ostruct.rb:446: warning: OpenStruct#instance_exec accesses caller method's state and should not be aliased
/Users/headius/projects/jruby/lib/ruby/stdlib/ostruct.rb:446: warning: OpenStruct#instance_eval accesses caller method's state and should not be aliased
We warn because aliasing very frequently involves wrapping the original method with a new pure-Ruby method, breaking the framing requirements of the aliased original.
define_singleton_methodaccesses the caller frame for visibility.!~and=~access the caller frame for the backref frame-local$~.instance_execandinstance_evalcapture the caller frame for use as a parent frame for the eval.
I believe OpenStruct should not be aliasing these methods.
Metadata
Metadata
Assignees
Labels
No labels