Skip to content

Refinement#import_methods always warns #8275

@jeremyevans

Description

@jeremyevans

Environment Information

Issue occurs on at least the following, and is likely independent of Java version and operating system:

jruby 9.4.7.0 (3.1.4) 2024-04-29 597ff08ac1 OpenJDK 64-Bit Server VM 17.0.11+9-1 on 17.0.11+9-1 +jit [x86_64-OpenBSD]
jruby 9.4.2.0 (3.1.0) 2023-03-08 90d2913fda OpenJDK 64-Bit Server VM 20.0.1+9-29 on 20.0.1+9-29 +jit [x86_64-mswin32]

Expected Behavior

I expect no output from:

$ jruby -e "Module.new{refine(Object){import_methods(Module.new)}}"

as CRuby produces no output.

Actual Behavior

JRuby warns:

-e:1: warning: #<Module:0x2094bf3d> has ancestors, but Refinement#import_methods doesn't import their methods

The warning isn't technically wrong, since all modules have themselves as ancestors, but the intent of the warning (and the implementation on CRuby) is to only warn when the argument to #import_methods has ancestors other than itself.

Found by examining the output of Sequel's specs on JRuby.

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