Create RestrictReturnStatementTargetMigrationInspection
#KT-36262
This commit is contained in:
@@ -3139,6 +3139,16 @@
|
|||||||
language="kotlin"
|
language="kotlin"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.migration.RestrictReturnStatementTargetMigrationInspection"
|
||||||
|
displayName="Target label does not denote a function since 1.4"
|
||||||
|
groupPath="Kotlin"
|
||||||
|
groupName="Migration"
|
||||||
|
enabledByDefault="false"
|
||||||
|
cleanupTool="true"
|
||||||
|
level="ERROR"
|
||||||
|
language="kotlin"
|
||||||
|
/>
|
||||||
|
|
||||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.migration.ObsoleteExperimentalCoroutinesInspection"
|
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.migration.ObsoleteExperimentalCoroutinesInspection"
|
||||||
displayName="Experimental coroutines usages are deprecated since 1.3"
|
displayName="Experimental coroutines usages are deprecated since 1.3"
|
||||||
groupPath="Kotlin"
|
groupPath="Kotlin"
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
Since Kotlin 1.4, it's forbidden to declare a target label which does not denote a function.
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.inspections.migration
|
||||||
|
|
||||||
|
import com.intellij.codeInspection.CleanupLocalInspectionTool
|
||||||
|
import org.jetbrains.kotlin.config.LanguageVersion
|
||||||
|
import org.jetbrains.kotlin.diagnostics.Errors
|
||||||
|
import org.jetbrains.kotlin.idea.configuration.MigrationInfo
|
||||||
|
import org.jetbrains.kotlin.idea.configuration.isLanguageVersionUpdate
|
||||||
|
import org.jetbrains.kotlin.idea.quickfix.migration.MigrationFix
|
||||||
|
import org.jetbrains.kotlin.psi.KtExpressionWithLabel
|
||||||
|
|
||||||
|
|
||||||
|
class RestrictReturnStatementTargetMigrationInspection :
|
||||||
|
AbstractDiagnosticBasedMigrationInspection<KtExpressionWithLabel>(Errors.NOT_A_FUNCTION_LABEL, KtExpressionWithLabel::class.java),
|
||||||
|
MigrationFix,
|
||||||
|
CleanupLocalInspectionTool {
|
||||||
|
override fun isApplicable(migrationInfo: MigrationInfo): Boolean {
|
||||||
|
return migrationInfo.isLanguageVersionUpdate(LanguageVersion.KOTLIN_1_3, LanguageVersion.KOTLIN_1_4)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user