Add quickfix for adding CancellableException to @Throws suspend fun
This commit is contained in:
+3
@@ -0,0 +1,3 @@
|
||||
package kotlin.coroutines.cancellation
|
||||
|
||||
public open class CancellationException() : IllegalStateException()
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
package kotlin
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
public annotation class Throws(vararg val exceptionClasses: KClass<out Throwable>)
|
||||
|
||||
public open class Exception : Throwable()
|
||||
|
||||
public open class RuntimeException : Exception()
|
||||
|
||||
public open class IllegalStateException : RuntimeException()
|
||||
|
||||
public open class Error : Throwable()
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
// "Add 'CancellationException::class'" "true"
|
||||
|
||||
<caret>@Throws(Error::class)
|
||||
suspend fun addCE() {}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import kotlin.coroutines.cancellation.CancellationException
|
||||
|
||||
// "Add 'CancellationException::class'" "true"
|
||||
|
||||
@Throws(Error::class, CancellationException::class)
|
||||
suspend fun addCE() {}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package kotlin
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
public annotation class Throws(vararg val exceptionClasses: KClass<out Throwable>)
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// "Add 'CancellationException::class'" "false"
|
||||
// ERROR: @Throws on suspend declaration must have CancellationException (or any of its superclasses) listed
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
|
||||
class MyException : Throwable()
|
||||
|
||||
// Quickfix doesn't support this case:
|
||||
<caret>@Throws(exceptionClasses = [MyException::class])
|
||||
suspend fun addCE() {}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package kotlin
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
public annotation class Throws(vararg val exceptionClasses: KClass<out Throwable>)
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// "Add 'CancellationException::class'" "false"
|
||||
// ERROR: @Throws must have non-empty class list
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
|
||||
// No compilation error => no quickfix.
|
||||
<caret>@Throws()
|
||||
suspend fun emptyThrows() {}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package kotlin
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
public annotation class Throws(vararg val exceptionClasses: KClass<out Throwable>)
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// "Add 'CancellationException::class'" "false"
|
||||
// ERROR: @Throws must have non-empty class list
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
|
||||
// No compilation error => no quickfix.
|
||||
<caret>@Throws
|
||||
suspend fun emptyThrows() {}
|
||||
Reference in New Issue
Block a user