From f0b93bf352b66af41da84d8f8098dfe28e8b841a Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Thu, 17 Sep 2020 22:57:17 +0900 Subject: [PATCH] Parcelize: Move back annotations from kotlinx.android.parcel, deprecate them --- .../kotlinx/android/parcel/IgnoredOnParcel.kt | 25 ++++++++++++++++ .../src/kotlinx/android/parcel/Parceler.kt | 24 +++++++++++++++ .../src/kotlinx/android/parcel/Parcelize.kt | 29 +++++++++++++++++++ .../src/kotlinx/android/parcel/RawValue.kt | 26 +++++++++++++++++ .../kotlinx/android/parcel/TypeParceler.kt | 28 ++++++++++++++++++ .../src/kotlinx/android/parcel/WriteWith.kt | 25 ++++++++++++++++ 6 files changed, 157 insertions(+) create mode 100644 plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/IgnoredOnParcel.kt create mode 100644 plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/Parceler.kt create mode 100644 plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/Parcelize.kt create mode 100644 plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/RawValue.kt create mode 100644 plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/TypeParceler.kt create mode 100644 plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/WriteWith.kt diff --git a/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/IgnoredOnParcel.kt b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/IgnoredOnParcel.kt new file mode 100644 index 00000000000..3d0d4af0e9a --- /dev/null +++ b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/IgnoredOnParcel.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package kotlinx.android.parcel + +/** + * The property annotated with [IgnoredOnParcel] will not be stored into parcel. + */ +@Target(AnnotationTarget.PROPERTY) +@Retention(AnnotationRetention.SOURCE) +@Deprecated("Use kotlinx.parcelize.IgnoredOnParcel instead.", ReplaceWith("kotlinx.parcelize.IgnoredOnParcel")) +annotation class IgnoredOnParcel \ No newline at end of file diff --git a/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/Parceler.kt b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/Parceler.kt new file mode 100644 index 00000000000..469d0beebf6 --- /dev/null +++ b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/Parceler.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@file:Suppress("unused") +package kotlinx.android.parcel + +/** + * The base interface for custom [Parcelize] serializers. + */ +@Deprecated("Use kotlinx.parcelize.Parceler instead.", ReplaceWith("kotlinx.parcelize.Parceler")) +interface Parceler : kotlinx.parcelize.Parceler \ No newline at end of file diff --git a/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/Parcelize.kt b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/Parcelize.kt new file mode 100644 index 00000000000..16e09d77ae7 --- /dev/null +++ b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/Parcelize.kt @@ -0,0 +1,29 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package kotlinx.android.parcel + +/** + * Instructs the Kotlin compiler to generate `writeToParcel()`, `describeContents()` [android.os.Parcelable] methods, + * as well as a `CREATOR` factory class automatically. + * + * The annotation is applicable only to classes that implements [android.os.Parcelable] (directly or indirectly). + * Note that only the primary constructor properties will be serialized. + */ +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.BINARY) +@Deprecated("Use kotlinx.parcelize.Parcelize instead.", ReplaceWith("kotlinx.parcelize.Parcelize")) +annotation class Parcelize \ No newline at end of file diff --git a/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/RawValue.kt b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/RawValue.kt new file mode 100644 index 00000000000..df3a15e8a3c --- /dev/null +++ b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/RawValue.kt @@ -0,0 +1,26 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package kotlinx.android.parcel + +/** + * Write the corresponding property value with [android.os.Parcel.writeValue]. + * Serialization may fail at runtime, depending on actual property value type. + */ +@Target(AnnotationTarget.TYPE) +@Retention(AnnotationRetention.BINARY) +@Deprecated("Use kotlinx.parcelize.RawValue instead.", ReplaceWith("kotlinx.parcelize.RawValue")) +annotation class RawValue \ No newline at end of file diff --git a/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/TypeParceler.kt b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/TypeParceler.kt new file mode 100644 index 00000000000..b3c57ab9f28 --- /dev/null +++ b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/TypeParceler.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package kotlinx.android.parcel + +import kotlinx.parcelize.Parceler + +/** + * Specifies what [Parceler] should be used for a particular type [T]. + */ +@Retention(AnnotationRetention.SOURCE) +@Repeatable +@Target(AnnotationTarget.CLASS, AnnotationTarget.PROPERTY) +@Deprecated("Use kotlinx.parcelize.TypeParceler instead.", ReplaceWith("kotlinx.parcelize.TypeParceler")) +annotation class TypeParceler> \ No newline at end of file diff --git a/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/WriteWith.kt b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/WriteWith.kt new file mode 100644 index 00000000000..f247e8864bd --- /dev/null +++ b/plugins/parcelize/parcelize-runtime/src/kotlinx/android/parcel/WriteWith.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package kotlinx.android.parcel + +/** + * Specifies what [Parceler] should be used for the annotated type. + */ +@Retention(AnnotationRetention.SOURCE) +@Target(AnnotationTarget.TYPE) +@Deprecated("Use kotlinx.parcelize.WriteWith instead.", ReplaceWith("kotlinx.parcelize.WriteWith")) +annotation class WriteWith

> \ No newline at end of file