Skip to content

Commit

Permalink
Use @PublishedApi annotation on functions called from plugin-generate…
Browse files Browse the repository at this point in the history
…d code (#2705)

Since these functions can be called from other modules, they should have this annotation to satisfy a compiler visibility checker.

Fixes #2703
  • Loading branch information
sandwwraith authored Jun 5, 2024
1 parent c487e78 commit fbd0734
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions core/api/kotlinx-serialization-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,12 @@ public final class kotlinx/serialization/internal/EnumSerializer : kotlinx/seria
public fun toString ()Ljava/lang/String;
}

public final class kotlinx/serialization/internal/EnumsKt {
public static final fun createAnnotatedEnumSerializer (Ljava/lang/String;[Ljava/lang/Enum;[Ljava/lang/String;[[Ljava/lang/annotation/Annotation;[Ljava/lang/annotation/Annotation;)Lkotlinx/serialization/KSerializer;
public static final fun createMarkedEnumSerializer (Ljava/lang/String;[Ljava/lang/Enum;[Ljava/lang/String;[[Ljava/lang/annotation/Annotation;)Lkotlinx/serialization/KSerializer;
public static final fun createSimpleEnumSerializer (Ljava/lang/String;[Ljava/lang/Enum;)Lkotlinx/serialization/KSerializer;
}

public final class kotlinx/serialization/internal/FloatArrayBuilder : kotlinx/serialization/internal/PrimitiveArrayBuilder {
public synthetic fun build$kotlinx_serialization_core ()Ljava/lang/Object;
}
Expand Down
3 changes: 3 additions & 0 deletions core/api/kotlinx-serialization-core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ final fun <#A: kotlin/Any?> (kotlinx.serialization/BinaryFormat).kotlinx.seriali
final fun <#A: kotlin/Any?> kotlinx.serialization.builtins/ListSerializer(kotlinx.serialization/KSerializer<#A>): kotlinx.serialization/KSerializer<kotlin.collections/List<#A>> // kotlinx.serialization.builtins/ListSerializer|ListSerializer(kotlinx.serialization.KSerializer<0:0>){0§<kotlin.Any?>}[0]
final fun <#A: kotlin/Any?> kotlinx.serialization.builtins/SetSerializer(kotlinx.serialization/KSerializer<#A>): kotlinx.serialization/KSerializer<kotlin.collections/Set<#A>> // kotlinx.serialization.builtins/SetSerializer|SetSerializer(kotlinx.serialization.KSerializer<0:0>){0§<kotlin.Any?>}[0]
final fun <#A: kotlin/Any?> kotlinx.serialization.internal/InlinePrimitiveDescriptor(kotlin/String, kotlinx.serialization/KSerializer<#A>): kotlinx.serialization.descriptors/SerialDescriptor // kotlinx.serialization.internal/InlinePrimitiveDescriptor|InlinePrimitiveDescriptor(kotlin.String;kotlinx.serialization.KSerializer<0:0>){0§<kotlin.Any?>}[0]
final fun <#A: kotlin/Enum<#A>> kotlinx.serialization.internal/createAnnotatedEnumSerializer(kotlin/String, kotlin/Array<#A>, kotlin/Array<kotlin/String?>, kotlin/Array<kotlin/Array<kotlin/Annotation>?>, kotlin/Array<kotlin/Annotation>?): kotlinx.serialization/KSerializer<#A> // kotlinx.serialization.internal/createAnnotatedEnumSerializer|createAnnotatedEnumSerializer(kotlin.String;kotlin.Array<0:0>;kotlin.Array<kotlin.String?>;kotlin.Array<kotlin.Array<kotlin.Annotation>?>;kotlin.Array<kotlin.Annotation>?){0§<kotlin.Enum<0:0>>}[0]
final fun <#A: kotlin/Enum<#A>> kotlinx.serialization.internal/createMarkedEnumSerializer(kotlin/String, kotlin/Array<#A>, kotlin/Array<kotlin/String?>, kotlin/Array<kotlin/Array<kotlin/Annotation>?>): kotlinx.serialization/KSerializer<#A> // kotlinx.serialization.internal/createMarkedEnumSerializer|createMarkedEnumSerializer(kotlin.String;kotlin.Array<0:0>;kotlin.Array<kotlin.String?>;kotlin.Array<kotlin.Array<kotlin.Annotation>?>){0§<kotlin.Enum<0:0>>}[0]
final fun <#A: kotlin/Enum<#A>> kotlinx.serialization.internal/createSimpleEnumSerializer(kotlin/String, kotlin/Array<#A>): kotlinx.serialization/KSerializer<#A> // kotlinx.serialization.internal/createSimpleEnumSerializer|createSimpleEnumSerializer(kotlin.String;kotlin.Array<0:0>){0§<kotlin.Enum<0:0>>}[0]
final fun kotlinx.serialization.builtins/BooleanArraySerializer(): kotlinx.serialization/KSerializer<kotlin/BooleanArray> // kotlinx.serialization.builtins/BooleanArraySerializer|BooleanArraySerializer(){}[0]
final fun kotlinx.serialization.builtins/ByteArraySerializer(): kotlinx.serialization/KSerializer<kotlin/ByteArray> // kotlinx.serialization.builtins/ByteArraySerializer|ByteArraySerializer(){}[0]
final fun kotlinx.serialization.builtins/CharArraySerializer(): kotlinx.serialization/KSerializer<kotlin/CharArray> // kotlinx.serialization.builtins/CharArraySerializer|CharArraySerializer(){}[0]
Expand Down
9 changes: 3 additions & 6 deletions core/commonMain/src/kotlinx/serialization/internal/Enums.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,15 @@ internal class EnumDescriptor(
}
}

@OptIn(ExperimentalSerializationApi::class)
@InternalSerializationApi
@PublishedApi
internal fun <T : Enum<T>> createSimpleEnumSerializer(serialName: String, values: Array<T>): KSerializer<T> {
return EnumSerializer(serialName, values)
}

/**
* The function has a bug (#2121) and should not be used by new (1.8.20+) plugins. It is preserved for backward compatibility with previously compiled enum classes.
*/
@OptIn(ExperimentalSerializationApi::class)
@InternalSerializationApi
@PublishedApi
internal fun <T : Enum<T>> createMarkedEnumSerializer(
serialName: String,
values: Array<T>,
Expand All @@ -78,8 +76,7 @@ internal fun <T : Enum<T>> createMarkedEnumSerializer(
return EnumSerializer(serialName, values, descriptor)
}

@OptIn(ExperimentalSerializationApi::class)
@InternalSerializationApi
@PublishedApi
internal fun <T : Enum<T>> createAnnotatedEnumSerializer(
serialName: String,
values: Array<T>,
Expand Down

0 comments on commit fbd0734

Please sign in to comment.