Skip to content

Outer scope's visibility is not considered when dumping const vals #252

Open
@fzhinkin

Description

@fzhinkin

When dumping static final fields generated for const vals declared inside a companion object, BCV ignores the companion's visibility.

Consider the following classes:

class A private constructor() {
    internal companion object { const val x: Int = 0 } 
}

class B private constructor() {
    private companion object { const val y: Int = 0 } 
}

class C private constructor() {
    @PrivateApi // registered as nonPublicMarker
    companion object { const val z: Int = 0 }
}

In the first two cases, properties are effectively private. In the last case, we kindly ask BCV to treat a companion object as private. However, an ABI dump for all three classes will include fields backing corresponding properties:

public final class cases/companions/A {
	public static final field x I
}

public final class cases/companions/B {
	public static final field y I
}

public final class cases/companions/C {
	public static final field z I
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjvm

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions