Parcelize: Move back annotations from kotlinx.android.parcel, deprecate them

This commit is contained in:
Yan Zhulanow
2020-09-17 22:57:17 +09:00
parent 75a1323974
commit f0b93bf352
6 changed files with 157 additions and 0 deletions
@@ -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
@@ -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<T> : kotlinx.parcelize.Parceler<T>
@@ -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
@@ -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
@@ -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<T, P : @Suppress("DEPRECATION_ERROR") Parceler<in T>>
@@ -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<P : @Suppress("DEPRECATION_ERROR") Parceler<*>>