Skip to content

warning: OpenStruct#define_singleton_method accesses caller method's state and should not be aliased  #7031

Closed

Description

@yamam

jruby 9.3.3.0 now shows the following warning.
It did not show up in jruby 9.3.2.0.

Environment Information

jruby 9.3.3.0 (2.6.8) 2022-01-19 b26de1f OpenJDK 64-Bit Server VM 11.0.13+8-Ubuntu-0ubuntu1.20.04 on 11.0.13+8-Ubuntu-0ubuntu1.20.04 +jit [linux-x86_64]

Expected Behavior
No warning is displayed.

Actual Behavior
The following warning is displayed.

uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/ostruct.rb:464: warning: OpenStruct#define_singleton_method accesses caller method's state and should not be aliased
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/ostruct.rb:468: warning: OpenStruct#block_given? accesses caller method's state and should not be aliased

Activity

  1. added this to the JRuby 9.3.4.0 milestone on Jan 26, 2022
  2. enebo commented on Jan 26, 2022

    @enebo
    Member

    Linking to ruby/ostruct#40 which references ruby/ostruct#30.

  3. headius commented on Mar 17, 2022

    @headius
    Member

    Fixed by #7055.

  4. yamam commented on Mar 23, 2022

    @yamam
    Author

    Thanks for the correction.
    I have confirmed that it works with 9.3.4.0, but I still have the following warning.

    $ java -cp . -jar ./jruby-complete-9.3.4.0.jar -vw -e 'require "ostruct"'                                                                                                                    
    jruby 9.3.4.0 (2.6.8) 2022-03-23 eff48c1ebf OpenJDK 64-Bit Server VM 11.0.14+9-Ubuntu-0ubuntu2.20.04 on 11.0.14+9-Ubuntu-0ubuntu2.20.04 +jit [x86_64-linux]
    uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/ostruct.rb:468: warning: OpenStruct#block_given? accesses caller method's state and should not be aliased
    
  5. headius commented on Mar 24, 2022

    @headius
    Member

    Unfortunately we are still waiting for ruby/ostruct#41 to get into an ostruct release. Once that happens you should be able to install it and eliminate the last warning.

    cc @marcandre

  6. headius commented on Mar 24, 2022

    @headius
    Member

    @yamam ostruct 0.5.4 has been released!

  7. added a commit that references this issue on Mar 24, 2022
  8. headius commented on Mar 31, 2022

    @headius
    Member

    And ostruct 0.5.5 has been released to fix one last issue (ruby/ostruct#45).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions