Parcelize: Use @Parcelize annotations from Android Extensions instead of the copied&deprecated ones (KT-42342, KT-43150)

Dex can't merge class files from both android-extensions-runtime and parcelize-runtime, so we have to keep only one copy of each class.
Instead of @Deprecated annotations, there are new diagnostics (without quick-fixes yet).
The goal is to allow simple usages (@Parcelize alone) but forbid kotlinx.android.synthetic.Parceler usage.
This commit is contained in:
Yan Zhulanow
2020-11-07 02:01:10 +09:00
parent fa42a6ba58
commit e83a3c3f27
36 changed files with 182 additions and 629 deletions
@@ -9,6 +9,7 @@ jvmTarget = "1.6"
dependencies {
compile(kotlinStdlib())
compile(project(":kotlin-android-extensions-runtime"))
compileOnly(commonDep("com.google.android", "android"))
}
@@ -1,25 +0,0 @@
/*
* 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
@@ -1,24 +0,0 @@
/*
* 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>
@@ -1,29 +0,0 @@
/*
* 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
@@ -1,26 +0,0 @@
/*
* 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
@@ -1,28 +0,0 @@
/*
* 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>>
@@ -1,25 +0,0 @@
/*
* 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") Parceler<*>>