Skip to content

Class with prepended module is its own superclass #3276

@martinsvalin

Description

@martinsvalin

When a class has prepended a module, the superclass is reported as itself.

module M; end
class C
  prepend M
end

C.superclass
# => C (in JRuby 9.0.0.0)
# => Object (in MRI 2.2.3)

I had a look here: https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyClass.java#L1119

It looks as though we are walking up the inheritance chain and returning the first non-module we find.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions