From 83383ab9e5a818cd62209d9134c111998c4f1cf3 Mon Sep 17 00:00:00 2001 From: Michael Hoisie Date: Wed, 10 Mar 2021 13:03:55 -0800 Subject: [PATCH] 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 --- .../runtime/kotlin/jvm/internal/DefaultConstructorMarker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/stdlib/jvm/runtime/kotlin/jvm/internal/DefaultConstructorMarker.java b/libraries/stdlib/jvm/runtime/kotlin/jvm/internal/DefaultConstructorMarker.java index d55c76f5790..353c680c84f 100644 --- a/libraries/stdlib/jvm/runtime/kotlin/jvm/internal/DefaultConstructorMarker.java +++ b/libraries/stdlib/jvm/runtime/kotlin/jvm/internal/DefaultConstructorMarker.java @@ -5,6 +5,6 @@ package kotlin.jvm.internal; -final class DefaultConstructorMarker { +public final class DefaultConstructorMarker { private DefaultConstructorMarker() {} }