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

Internal constructor is listed in api #171

Open
kunyavskiy opened this issue Jan 22, 2024 · 2 comments
Open

Internal constructor is listed in api #171

kunyavskiy opened this issue Jan 22, 2024 · 2 comments
Assignees
Labels
bug Something isn't working jvm

Comments

@kunyavskiy
Copy link

For

public class TestBCV(
    public val d: Duration = Duration.ZERO
)

dump is

public final class TestBCV {
	public synthetic fun <init> (JILkotlin/jvm/internal/DefaultConstructorMarker;)V
	public synthetic fun <init> (JLkotlin/jvm/internal/DefaultConstructorMarker;)V
	public final fun getD-UwyO8pc ()J
}

If you make constructor internal like

public class TestBCV internal constructor(
    public val d: Duration = Duration.ZERO
)

Only one of the constructors disappears from the dump

public final class TestBCV {
	public synthetic fun <init> (JILkotlin/jvm/internal/DefaultConstructorMarker;)V
	public final fun getD-UwyO8pc ()J
}
@qwwdfsad qwwdfsad added the bug Something isn't working label Jan 23, 2024
@fzhinkin fzhinkin self-assigned this Jan 23, 2024
@qwwdfsad
Copy link
Member

qwwdfsad commented Jan 23, 2024

@fzhinkin while you are at it, please take a look at #73 and at https://youtrack.jetbrains.com/issue/KT-51073.

It seems like they have the same (or very similar) root cause, it may save you some time

@fzhinkin
Copy link
Collaborator

@qwwdfsad thanks! Indeed, it seems to be (almost) the same issue: public synthetic fun <init> (JILkotlin/jvm/internal/DefaultConstructorMarker;)V from the example above is indistinguishable from a method that would be generated for constructor(d: Duration, x: Int).

@fzhinkin fzhinkin added the jvm label Apr 9, 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

3 participants