Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fzhinkin opened this issue Jul 8, 2024 · 0 comments
Open
Labels
bug Something isn't working jvm

Comments

@fzhinkin
Copy link
Collaborator

fzhinkin commented Jul 8, 2024

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
}
@fzhinkin fzhinkin added bug Something isn't working jvm labels Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jvm
Projects
None yet
Development

No branches or pull requests

1 participant