Skip to content

Commit 9c78a7b

Browse files
timofey-soloninSpace Team
authored and
Space Team
committed
Promote ExtrasProperty.kt deprecation to errors
^KT-62643
1 parent dd97e16 commit 9c78a7b

File tree

2 files changed

+58
-22
lines changed

2 files changed

+58
-22
lines changed

libraries/tools/kotlin-tooling-core/src/main/kotlin/org/jetbrains/kotlin/tooling/core/ExtrasProperty.kt

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,52 @@ interface ExtrasLazyProperty<Receiver : HasMutableExtras, T> : ExtrasProperty<T>
9292
DEPRECATED APIs
9393
*/
9494

95-
@Deprecated("Scheduled for removal in Kotlin 2.2")
96-
@Suppress("DEPRECATION")
95+
@Deprecated(
96+
"Scheduled for removal in Kotlin 2.3",
97+
level = DeprecationLevel.ERROR,
98+
)
99+
@Suppress("DEPRECATION_ERROR")
97100
val <T : Any> Extras.Key<T>.readProperty get() = extrasReadProperty(this)
98101

99-
@Deprecated("Scheduled for removal in Kotlin 2.2")
100-
@Suppress("DEPRECATION")
102+
@Deprecated(
103+
"Scheduled for removal in Kotlin 2.3",
104+
level = DeprecationLevel.ERROR,
105+
)
106+
@Suppress("DEPRECATION_ERROR")
101107
fun <T : Any> Extras.Key<T>.factoryProperty(factory: () -> T) = extrasFactoryProperty(this, factory)
102108

103-
@Deprecated("Scheduled for removal in Kotlin 2.2")
104-
@Suppress("DEPRECATION")
109+
@Deprecated(
110+
"Scheduled for removal in Kotlin 2.3",
111+
level = DeprecationLevel.ERROR,
112+
)
113+
@Suppress("DEPRECATION_ERROR")
105114
fun <Receiver : HasMutableExtras, T : Any> Extras.Key<Optional<T>>.nullableLazyProperty(factory: Receiver.() -> T?) =
106115
extrasNullableLazyProperty(this, factory)
107116

108-
@Deprecated("Scheduled for removal in Kotlin 2.2")
109-
@Suppress("DEPRECATION")
117+
@Deprecated(
118+
"Scheduled for removal in Kotlin 2.3",
119+
level = DeprecationLevel.ERROR,
120+
)
121+
@Suppress("DEPRECATION_ERROR")
110122
fun <T : Any> extrasReadProperty(key: Extras.Key<T>): ExtrasReadOnlyProperty<T> = object : ExtrasReadOnlyProperty<T> {
111123
override val key: Extras.Key<T> = key
112124
}
113125

114-
@Deprecated("Scheduled for removal in Kotlin 2.2")
115-
@Suppress("DEPRECATION")
126+
@Deprecated(
127+
"Scheduled for removal in Kotlin 2.3",
128+
level = DeprecationLevel.ERROR,
129+
)
130+
@Suppress("DEPRECATION_ERROR")
116131
fun <T : Any> extrasFactoryProperty(key: Extras.Key<T>, factory: () -> T) = object : ExtrasFactoryProperty<T> {
117132
override val key: Extras.Key<T> = key
118133
override val factory: () -> T = factory
119134
}
120135

121-
@Deprecated("Scheduled for removal in Kotlin 2.2")
122-
@Suppress("DEPRECATION")
136+
@Deprecated(
137+
"Scheduled for removal in Kotlin 2.3",
138+
level = DeprecationLevel.ERROR,
139+
)
140+
@Suppress("DEPRECATION_ERROR")
123141
fun <Receiver : HasMutableExtras, T : Any> extrasNullableLazyProperty(
124142
key: Extras.Key<Optional<T>>, factory: Receiver.() -> T?,
125143
): NullableExtrasLazyProperty<Receiver, T> =
@@ -128,24 +146,36 @@ fun <Receiver : HasMutableExtras, T : Any> extrasNullableLazyProperty(
128146
override val factory: Receiver.() -> T? = factory
129147
}
130148

131-
@Deprecated("Scheduled for removal in Kotlin 2.2")
132-
@Suppress("DEPRECATION", "UNUSED")
149+
@Deprecated(
150+
"Scheduled for removal in Kotlin 2.3",
151+
level = DeprecationLevel.ERROR,
152+
)
153+
@Suppress("DEPRECATION_ERROR", "UNUSED")
133154
inline fun <reified T : Any> extrasReadProperty(name: String? = null) =
134155
extrasReadProperty(extrasKeyOf<T>(name))
135156

136157

137-
@Deprecated("Scheduled for removal in Kotlin 2.2")
138-
@Suppress("DEPRECATION", "UNUSED")
158+
@Deprecated(
159+
"Scheduled for removal in Kotlin 2.3",
160+
level = DeprecationLevel.ERROR,
161+
)
162+
@Suppress("DEPRECATION_ERROR", "UNUSED")
139163
inline fun <reified T : Any> extrasFactoryProperty(name: String? = null, noinline factory: () -> T) =
140164
extrasFactoryProperty(extrasKeyOf(name), factory)
141165

142-
@Deprecated("Scheduled for removal in Kotlin 2.2")
143-
@Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
166+
@Deprecated(
167+
"Scheduled for removal in Kotlin 2.3",
168+
level = DeprecationLevel.ERROR,
169+
)
170+
@Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith")
144171
inline fun <Receiver : HasMutableExtras, reified T : Any> extrasNullableLazyProperty(
145172
name: String? = null, noinline factory: Receiver.() -> T?,
146173
) = extrasNullableLazyProperty(extrasKeyOf(name), factory)
147174

148-
@Deprecated("Scheduled for removal in Kotlin 2.2")
175+
@Deprecated(
176+
"Scheduled for removal in Kotlin 2.3",
177+
level = DeprecationLevel.ERROR,
178+
)
149179
interface ExtrasReadOnlyProperty<T : Any> : ExtrasProperty<T>, ReadOnlyProperty<HasExtras, T?> {
150180
override fun getValue(thisRef: HasExtras, property: KProperty<*>): T? {
151181
return thisRef.extras[key]
@@ -157,7 +187,10 @@ interface ExtrasReadOnlyProperty<T : Any> : ExtrasProperty<T>, ReadOnlyProperty<
157187
}
158188
}
159189

160-
@Deprecated("Scheduled for removal in Kotlin 2.2")
190+
@Deprecated(
191+
"Scheduled for removal in Kotlin 2.3",
192+
level = DeprecationLevel.ERROR,
193+
)
161194
interface ExtrasFactoryProperty<T : Any> : ExtrasProperty<T>, ReadWriteProperty<HasMutableExtras, T> {
162195
val factory: () -> T
163196

@@ -170,7 +203,10 @@ interface ExtrasFactoryProperty<T : Any> : ExtrasProperty<T>, ReadWriteProperty<
170203
}
171204
}
172205

173-
@Deprecated("Scheduled for removal in Kotlin 2.2")
206+
@Deprecated(
207+
"Scheduled for removal in Kotlin 2.3",
208+
level = DeprecationLevel.ERROR,
209+
)
174210
interface NullableExtrasLazyProperty<Receiver : HasMutableExtras, T : Any> : ExtrasProperty<Optional<T>>, ReadOnlyProperty<Receiver, T?> {
175211
val factory: Receiver.() -> T?
176212

libraries/tools/kotlin-tooling-core/src/test/kotlin/org/jetbrains/kotlin/tooling/core/ExtrasPropertyTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.tooling.core
88
import java.util.concurrent.atomic.AtomicInteger
99
import kotlin.test.*
1010

11-
@Suppress("DEPRECATION")
11+
@Suppress("DEPRECATION_ERROR")
1212
class ExtrasPropertyTest {
1313

1414
class Subject : HasMutableExtras {

0 commit comments

Comments
 (0)