Skip to content

Backend generates useless companion class for inner objects #2680

Closed
@smarter

Description

@smarter

The following code:

object Outer {
  object Inner
}

generates the following files with scalac:

Outer.class  Outer$.class  Outer$Inner$.class

and the following files with Dotty:

Outer.class  Outer.hasTasty  Outer$.class  Outer$Inner.class  Outer$Inner$.class

The Outer.hasTasty is expected but the Outer$Inner.class isn't, it doesn't seem to contain much:

% cfr 'Outer$Inner.class'
/*
 * Decompiled with CFR 0_120.
 */
public final class Outer$Inner {
}

Could we avoid generating these companions? On case-insenstive filesystems they can be harmful: #2673 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions