Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of @ExperimentalUnsignedTypes on our declarations that levera… #1962

Merged
merged 4 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ buildscript {
ext.experimentalsInTestEnabled = ["-progressive", "-opt-in=kotlin.Experimental",
"-opt-in=kotlin.ExperimentalMultiplatform",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
"-opt-in=kotlinx.serialization.InternalSerializationApi",
"-opt-in=kotlin.ExperimentalUnsignedTypes"
"-opt-in=kotlinx.serialization.InternalSerializationApi"
]
ext.koverEnabled = property('kover.enabled') ?: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,26 +194,22 @@ public fun <K, V> MapSerializer(
* Returns serializer for [UInt].
*/
@ExperimentalSerializationApi
@ExperimentalUnsignedTypes
public fun UInt.Companion.serializer(): KSerializer<UInt> = UIntSerializer

/**
* Returns serializer for [ULong].
*/
@ExperimentalSerializationApi
@ExperimentalUnsignedTypes
public fun ULong.Companion.serializer(): KSerializer<ULong> = ULongSerializer

/**
* Returns serializer for [UByte].
*/
@ExperimentalSerializationApi
@ExperimentalUnsignedTypes
public fun UByte.Companion.serializer(): KSerializer<UByte> = UByteSerializer

/**
* Returns serializer for [UShort].
*/
@ExperimentalSerializationApi
@ExperimentalUnsignedTypes
public fun UShort.Companion.serializer(): KSerializer<UShort> = UShortSerializer
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import kotlinx.serialization.encoding.*

@PublishedApi
@ExperimentalSerializationApi
@ExperimentalUnsignedTypes
internal object UIntSerializer : KSerializer<UInt> {
override val descriptor: SerialDescriptor = InlinePrimitiveDescriptor("kotlin.UInt", Int.serializer())

Expand All @@ -26,7 +25,6 @@ internal object UIntSerializer : KSerializer<UInt> {

@PublishedApi
@ExperimentalSerializationApi
@ExperimentalUnsignedTypes
internal object ULongSerializer : KSerializer<ULong> {
override val descriptor: SerialDescriptor = InlinePrimitiveDescriptor("kotlin.ULong", Long.serializer())

Expand All @@ -41,7 +39,6 @@ internal object ULongSerializer : KSerializer<ULong> {

@PublishedApi
@ExperimentalSerializationApi
@ExperimentalUnsignedTypes
internal object UByteSerializer : KSerializer<UByte> {
override val descriptor: SerialDescriptor = InlinePrimitiveDescriptor("kotlin.UByte", Byte.serializer())

Expand All @@ -56,7 +53,6 @@ internal object UByteSerializer : KSerializer<UByte> {

@PublishedApi
@ExperimentalSerializationApi
@ExperimentalUnsignedTypes
internal object UShortSerializer : KSerializer<UShort> {
override val descriptor: SerialDescriptor = InlinePrimitiveDescriptor("kotlin.UShort", Short.serializer())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private object JsonLiteralSerializer : KSerializer<JsonLiteral> {
override val descriptor: SerialDescriptor =
PrimitiveSerialDescriptor("kotlinx.serialization.json.JsonLiteral", PrimitiveKind.STRING)

@OptIn(ExperimentalUnsignedTypes::class, ExperimentalSerializationApi::class)
@OptIn(ExperimentalSerializationApi::class)
override fun serialize(encoder: Encoder, value: JsonLiteral) {
verify(encoder)
if (value.isString) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ internal open class Composer(@JvmField internal val sb: JsonStringBuilder) {
fun printQuoted(value: String): Unit = sb.appendQuoted(value)
}

@ExperimentalUnsignedTypes
internal class ComposerForUnsignedNumbers(sb: JsonStringBuilder) : Composer(sb) {
override fun print(v: Int) {
return super.print(v.toUInt().toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import kotlin.jvm.*
/**
* [JsonDecoder] which reads given JSON from [AbstractJsonLexer] field by field.
*/
@OptIn(ExperimentalSerializationApi::class, ExperimentalUnsignedTypes::class)
@OptIn(ExperimentalSerializationApi::class)
qwwdfsad marked this conversation as resolved.
Show resolved Hide resolved
internal open class StreamingJsonDecoder(
final override val json: Json,
private val mode: WriteMode,
Expand Down Expand Up @@ -303,7 +303,6 @@ internal open class StreamingJsonDecoder(
}

@OptIn(ExperimentalSerializationApi::class)
@ExperimentalUnsignedTypes
internal class JsonDecoderForUnsignedTypes(
private val lexer: AbstractJsonLexer,
json: Json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import kotlinx.serialization.modules.*
import kotlin.native.concurrent.*

@ExperimentalSerializationApi
@OptIn(ExperimentalUnsignedTypes::class)
@SharedImmutable
private val unsignedNumberDescriptors = setOf(
UInt.serializer().descriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ private sealed class AbstractJsonTreeDecoder(
return this as? JsonLiteral ?: throw JsonDecodingException(-1, "Unexpected 'null' when $type was expected")
}

@OptIn(ExperimentalUnsignedTypes::class)
override fun decodeTaggedInline(tag: String, inlineDescriptor: SerialDescriptor): Decoder =
if (inlineDescriptor.isUnsignedNumber) JsonDecoderForUnsignedTypes(StringJsonLexer(getPrimitiveValue(tag).content), json)
else super.decodeTaggedInline(tag, inlineDescriptor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ private sealed class AbstractJsonTreeEncoder(
putElement(tag, JsonPrimitive(value.toString()))
}

@OptIn(ExperimentalUnsignedTypes::class)
override fun encodeTaggedInline(tag: String, inlineDescriptor: SerialDescriptor): Encoder =
if (inlineDescriptor.isUnsignedNumber) object : AbstractEncoder() {
override val serializersModule: SerializersModule = json.serializersModule
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
/*
* Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

@file:OptIn(ExperimentalUnsignedTypes::class)
/*
* Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2017-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.serialization.features.inline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
*/

@file:Suppress("INLINE_CLASSES_NOT_SUPPORTED", "SERIALIZER_NOT_FOUND")
@file:OptIn(ExperimentalUnsignedTypes::class)

/*
* Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.serialization.features.inline

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@file:Suppress("INLINE_CLASSES_NOT_SUPPORTED", "SERIALIZER_NOT_FOUND")
@file:OptIn(ExperimentalUnsignedTypes::class)
/*
* Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2017-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.serialization.features.inline
Expand Down