binary-compatibility-validator icon indicating copy to clipboard operation
binary-compatibility-validator copied to clipboard

Internal constructor is listed in api

Open kunyavskiy opened this issue 1 year ago • 2 comments

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
}

kunyavskiy avatar Jan 22 '24 23:01 kunyavskiy