Skip to content

Reverse aliasing warns when it should not #9450

@headius

Description

@headius

A form of reverse aliasing (returning a method name back to its original target method after previously aliasing it) found in Rails 8.0's redefine_method.rb produces warnings when apparently it should not.

/Users/headius/work/rails/activesupport/lib/active_support/testing/time_helpers.rb:62: warning: method redefined; discarding old new
/Users/headius/work/rails/activesupport/lib/active_support/testing/time_helpers.rb:181: warning: previous definition of new was here
/Users/headius/work/rails/activesupport/lib/active_support/testing/time_helpers.rb:62: warning: method redefined; discarding old today
/Users/headius/work/rails/activesupport/lib/active_support/testing/time_helpers.rb:190: warning: previous definition of today was here
/Users/headius/work/rails/activesupport/lib/active_support/testing/time_helpers.rb:62: warning: method redefined; discarding old now

This seems to have something to do with a hack from rails/rails#29233 that re-aliases the same alias so it can go back without a warning. However this does not appear to work properly in JRuby.

I attempted to fix this in #9447 but it has not yet solved the issue.

Can be reproduced by running the Rails ActiveRecord suite for ARJDBC as described in #9449.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions