Increase deprecation level for previously deprecated API

- unsupported common exceptions
- common 'synchronized'
- jquery API
- experimental kotlin.time API
- js Math object
- DefaultAsserter constructor-like fun
This commit is contained in:
Ilya Gorbunov
2020-06-19 00:12:58 +03:00
parent 67044f22ed
commit e9c4f531eb
15 changed files with 65 additions and 48 deletions

View File

@@ -3,6 +3,8 @@
* You can drag'n'drop them as well as the logo. Doubleclick to add
* more creatures but be careful. They may be watching you!
*/
@file:Suppress("DEPRECATION_ERROR")
package creatures
import jquery.*

View File

@@ -3,6 +3,7 @@ This example is based on example from html5 canvas2D docs:
http://www.w3.org/TR/2dcontext/
Note that only a subset of the api is supported for now.
*/
@file:Suppress("DEPRECATION_ERROR")
package fancylines

View File

@@ -1,6 +1,8 @@
/*
This shows simple text floating around.
*/
@file:Suppress("DEPRECATION_ERROR")
package hello
import jquery.*

View File

@@ -2,6 +2,8 @@
* In this example you can see a crossroads. Traffic light change color by timer,
* but you can change it manually using controls at the right part of screen.
*/
@file:Suppress("DEPRECATION_ERROR")
package traffic
import jquery.*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -22,8 +22,11 @@ object DefaultAsserter : Asserter {
}
}
@Deprecated("DefaultAsserter is an object now, constructor call is not required anymore",
ReplaceWith("DefaultAsserter", "kotlin.test.DefaultAsserter"))
@Deprecated(
"DefaultAsserter is an object now, constructor call is not required anymore",
ReplaceWith("DefaultAsserter", "kotlin.test.DefaultAsserter"),
DeprecationLevel.ERROR
)
@kotlin.js.JsName("DefaultAsserterConstructor")
@Suppress("FunctionName")
fun DefaultAsserter(): DefaultAsserter = DefaultAsserter

View File

@@ -93,7 +93,7 @@ public expect open class ArithmeticException : RuntimeException {
constructor(message: String?)
}
@Deprecated("This exception type is not supposed to be thrown or caught in common code and will be removed from kotlin-stdlib-common soon.")
@Deprecated("This exception type is not supposed to be thrown or caught in common code and will be removed from kotlin-stdlib-common soon.", level = DeprecationLevel.ERROR)
public expect open class NoWhenBranchMatchedException : RuntimeException {
constructor()
constructor(message: String?)
@@ -101,7 +101,7 @@ public expect open class NoWhenBranchMatchedException : RuntimeException {
constructor(cause: Throwable?)
}
@Deprecated("This exception type is not supposed to be thrown or caught in common code and will be removed from kotlin-stdlib-common soon.")
@Deprecated("This exception type is not supposed to be thrown or caught in common code and will be removed from kotlin-stdlib-common soon.", level = DeprecationLevel.ERROR)
public expect class UninitializedPropertyAccessException : RuntimeException {
constructor()
constructor(message: String?)

View File

@@ -60,11 +60,8 @@ public expect fun Float.Companion.fromBits(bits: Int): Float
// From concurrent.kt
// TODO: promote to error? Otherwise it gets to JVM part
//@Deprecated("Use Volatile annotation from kotlin.jvm package", ReplaceWith("kotlin.jvm.Volatile"), level = DeprecationLevel.WARNING)
//public typealias Volatile = kotlin.jvm.Volatile
@Deprecated("Synchronization on any object is not supported on every platform and will be removed from the common standard library soon.")
@Deprecated("Synchronization on any object is not supported on every platform and will be removed from the common standard library soon.", level = DeprecationLevel.ERROR)
@Suppress("NO_ACTUAL_FOR_EXPECT")
public expect inline fun <R> synchronized(lock: Any, block: () -> R): R

View File

@@ -1,9 +1,14 @@
@file: Suppress("DEPRECATION")
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file: Suppress("DEPRECATION_ERROR")
package jquery
import org.w3c.dom.Element
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public external class JQuery() {
public fun addClass(className: String): JQuery
public fun addClass(f: (Int, String) -> String): JQuery
@@ -44,7 +49,7 @@ public external class JQuery() {
public fun `val`(): String?
}
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
open public external class MouseEvent() {
public val pageX: Double
public val pageY: Double
@@ -52,26 +57,26 @@ open public external class MouseEvent() {
public fun isDefaultPrevented(): Boolean
}
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public external class MouseClickEvent() : MouseEvent {
public val which: Int
}
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
@JsName("$")
public external fun jq(selector: String): JQuery
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
@JsName("$")
public external fun jq(selector: String, context: Element): JQuery
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
@JsName("$")
public external fun jq(callback: () -> Unit): JQuery
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
@JsName("$")
public external fun jq(obj: JQuery): JQuery
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
@JsName("$")
public external fun jq(el: Element): JQuery
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
@JsName("$")
public external fun jq(): JQuery

View File

@@ -1,4 +1,9 @@
@file: Suppress("DEPRECATION")
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file: Suppress("DEPRECATION_ERROR")
package jquery.ui
@@ -6,32 +11,32 @@ package jquery.ui
import jquery.JQuery
import kotlin.js.Json
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public inline fun JQuery.buttonset(): JQuery = asDynamic().buttonset()
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public inline fun JQuery.dialog(): JQuery = asDynamic().dialog()
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public inline fun JQuery.dialog(params: Json): JQuery = asDynamic().dialog(params)
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public inline fun JQuery.dialog(mode: String, param: String): Any? = asDynamic().dialog(mode, param)
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public inline fun JQuery.dialog(mode: String): JQuery = asDynamic().dialog(mode)
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public inline fun JQuery.dialog(mode: String, param: String, value: Any?): JQuery = asDynamic().dialog(mode, param, value)
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public inline fun JQuery.button(): JQuery = asDynamic().button()
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public inline fun JQuery.accordion(): JQuery = asDynamic().accordion()
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public inline fun JQuery.draggable(params: Json): JQuery = asDynamic().draggable(params)
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.")
@Deprecated("Use declarations from 'https://bintray.com/kotlin/js-externals/kotlin-js-jquery' package instead.", level = DeprecationLevel.ERROR)
public inline fun JQuery.selectable(): JQuery = asDynamic().selectable()

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -8,11 +8,11 @@ package kotlin.js
/**
* Exposes the JavaScript [Math object](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Math) to Kotlin.
*/
@Deprecated("Use top-level functions from kotlin.math package instead.", level = DeprecationLevel.WARNING)
@Deprecated("Use top-level functions from kotlin.math package instead.", level = DeprecationLevel.ERROR)
public external object Math {
@Deprecated("Use kotlin.math.PI instead.", ReplaceWith("PI", "kotlin.math.PI"), level = DeprecationLevel.ERROR)
public val PI: Double
@Deprecated("Use Random.nextDouble instead", ReplaceWith("kotlin.random.Random.nextDouble()", "kotlin.random.Random"), level = DeprecationLevel.WARNING)
@Deprecated("Use Random.nextDouble instead", ReplaceWith("kotlin.random.Random.nextDouble()", "kotlin.random.Random"), level = DeprecationLevel.ERROR)
public fun random(): Double
@Deprecated("Use kotlin.math.abs instead.", ReplaceWith("abs(value)", "kotlin.math.abs"), level = DeprecationLevel.ERROR)
public fun abs(value: Double): Double
@@ -95,13 +95,13 @@ public external object Math {
/**
* Returns the smaller of two values.
*/
@Suppress("DEPRECATION")
@Suppress("DEPRECATION_ERROR")
@Deprecated("Use minOf or kotlin.math.min instead", ReplaceWith("minOf(a, b)"), level = DeprecationLevel.ERROR)
public fun Math.min(a: Long, b: Long): Long = if (a <= b) a else b
/**
* Returns the greater of two values.
*/
@Suppress("DEPRECATION")
@Suppress("DEPRECATION_ERROR")
@Deprecated("Use maxOf or kotlin.math.max instead", ReplaceWith("maxOf(a, b)"), level = DeprecationLevel.ERROR)
public fun Math.max(a: Long, b: Long): Long = if (a >= b) a else b

View File

@@ -1,8 +1,8 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("DEPRECATION", "DEPRECATION_ERROR")
@file:Suppress("DEPRECATION_ERROR")
package kotlin.math

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -59,7 +59,7 @@ public actual fun Int.countOneBits(): Int {
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@Suppress("DEPRECATION")
@Suppress("DEPRECATION_ERROR")
@kotlin.internal.InlineOnly
public actual inline fun Int.countLeadingZeroBits(): Int = kotlin.js.Math.clz32(this)

View File

@@ -118,10 +118,10 @@ private class AdjustedTimeMark(val mark: TimeMark, val adjustment: Duration) : T
@SinceKotlin("1.3")
@ExperimentalTime
@Deprecated("Use TimeSource interface instead.", ReplaceWith("TimeSource", "kotlin.time.TimeSource"))
@Deprecated("Use TimeSource interface instead.", ReplaceWith("TimeSource", "kotlin.time.TimeSource"), DeprecationLevel.ERROR)
public typealias Clock = TimeSource
@SinceKotlin("1.3")
@ExperimentalTime
@Deprecated("Use TimeMark class instead.", ReplaceWith("TimeMark", "kotlin.time.TimeMark"))
@Deprecated("Use TimeMark class instead.", ReplaceWith("TimeMark", "kotlin.time.TimeMark"), DeprecationLevel.ERROR)
public typealias ClockMark = TimeMark

View File

@@ -106,20 +106,20 @@ public class TestTimeSource : AbstractLongTimeSource(unit = DurationUnit.NANOSEC
@SinceKotlin("1.3")
@ExperimentalTime
@Deprecated("Use TimeSource.Monotonic instead.", ReplaceWith("TimeSource.Monotonic", "kotlin.time.TimeSource"))
@Deprecated("Use TimeSource.Monotonic instead.", ReplaceWith("TimeSource.Monotonic", "kotlin.time.TimeSource"), DeprecationLevel.ERROR)
public typealias MonoClock = TimeSource.Monotonic
@SinceKotlin("1.3")
@ExperimentalTime
@Deprecated("Use AbstractLongTimeSource instead.", ReplaceWith("AbstractLongTimeSource", "kotlin.time.AbstractLongTimeSource"))
@Deprecated("Use AbstractLongTimeSource instead.", ReplaceWith("AbstractLongTimeSource", "kotlin.time.AbstractLongTimeSource"), DeprecationLevel.ERROR)
public typealias AbstractLongClock = AbstractLongTimeSource
@SinceKotlin("1.3")
@ExperimentalTime
@Deprecated("Use AbstractDoubleTimeSource instead.", ReplaceWith("AbstractDoubleTimeSource", "kotlin.time.AbstractDoubleTimeSource"))
@Deprecated("Use AbstractDoubleTimeSource instead.", ReplaceWith("AbstractDoubleTimeSource", "kotlin.time.AbstractDoubleTimeSource"), DeprecationLevel.ERROR)
public typealias AbstractDoubleClock = AbstractDoubleTimeSource
@SinceKotlin("1.3")
@ExperimentalTime
@Deprecated("Use TestTimeSource instead.", ReplaceWith("TestTimeSource", "kotlin.time.TestTimeSource"))
@Deprecated("Use TestTimeSource instead.", ReplaceWith("TestTimeSource", "kotlin.time.TestTimeSource"), DeprecationLevel.ERROR)
public typealias TestClock = TestTimeSource

View File

@@ -26,8 +26,8 @@ class ExceptionTest {
@Test fun concurrentModificationException() = testCreateException(::ConcurrentModificationException, ::ConcurrentModificationException)
@Test fun arithmeticException() = testCreateException(::ArithmeticException, ::ArithmeticException)
@Test fun noWhenBranchMatchedException() = testCreateException(::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException)
@Test fun uninitializedPropertyAccessException() = testCreateException(::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException)
@Test fun noWhenBranchMatchedException() = @Suppress("DEPRECATION_ERROR") testCreateException(::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException)
@Test fun uninitializedPropertyAccessException() = @Suppress("DEPRECATION_ERROR") testCreateException(::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException)
@Test fun assertionError() = testCreateException(::AssertionError, ::AssertionError, ::AssertionError)