Make kotlin.jvm.internal.DefaultConstructorMarker public

DefaultConstructorMarker is used as a marker to ensure that a
constructor is unique for companion objects. Prior to this change,
DefaultConstructorMarker was package private.

Being package private worked when calling the
DefaultConstructorMarker-marked constsructor using `invokespecial`,
likely because the JVM may not perform strict access checks in this
situation.

However, when access checks are performed, trying to call a
DefaultConstructorMarker-marked constructor will fail. This could happen
if the constructor was called using reflection or the MethodHandle API.
These APIs may be used by tools that perform bytecode instrumentation
on Kotlin JVM bytecode, such as Robolectric. It also caused problems
when using ByteBuddy validation.

Fixes https://youtrack.jetbrains.com/issue/KT-20869
This commit is contained in:
Michael Hoisie
2021-03-10 13:03:55 -08:00
committed by Alexander Udalov
parent 78ed758704
commit 83383ab9e5
@@ -5,6 +5,6 @@
package kotlin.jvm.internal;
final class DefaultConstructorMarker {
public final class DefaultConstructorMarker {
private DefaultConstructorMarker() {}
}