Fix for KT-16801: Accessors of @PublishedApi property gets mangled
#KT-16801 Fixed
This commit is contained in:
@@ -961,7 +961,7 @@ public class KotlinTypeMapper {
|
||||
|
||||
if (!(descriptor instanceof ConstructorDescriptor) &&
|
||||
descriptor.getVisibility() == Visibilities.INTERNAL &&
|
||||
!descriptor.getAnnotations().hasAnnotation(KotlinBuiltIns.FQ_NAMES.publishedApi)) {
|
||||
!DescriptorUtilsKt.isPublishedApi(descriptor)) {
|
||||
return name + "$" + NameUtils.sanitizeAsJavaIdentifier(moduleName);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,18 @@
|
||||
//WITH_REFLECT
|
||||
class A {
|
||||
@PublishedApi
|
||||
internal fun published() = "OK"
|
||||
internal fun published() = "O"
|
||||
|
||||
inline fun test() = published()
|
||||
@PublishedApi
|
||||
internal var publishedProp = "K"
|
||||
|
||||
inline fun test() = published() + publishedProp
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
val clazz = A::class.java
|
||||
if (clazz.getDeclaredMethod("published") == null) return "fail"
|
||||
return "OK"
|
||||
if (clazz.getDeclaredMethod("published") == null) return "fail 1"
|
||||
if (clazz.getDeclaredMethod("getPublishedProp") == null) return "fail 2"
|
||||
if (clazz.getDeclaredMethod("setPublishedProp", String::class.java) == null) return "fail 3"
|
||||
return A().test()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
@kotlin.Metadata
|
||||
public final class A {
|
||||
private @org.jetbrains.annotations.NotNull field publishedProp: java.lang.String
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getPublishedProp(): java.lang.String
|
||||
public final @kotlin.PublishedApi @org.jetbrains.annotations.NotNull method published(): java.lang.String
|
||||
public synthetic deprecated static @kotlin.PublishedApi method publishedProp$annotations(): void
|
||||
public final method setPublishedProp(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method test(): java.lang.String
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user