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

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 committed Jun 5, 2024
1 parent c487e78 commit 457c834
Showing 1 changed file with 3 additions and 6 deletions.
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 457c834

Please sign in to comment.