diff --git a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/CoroutineScopeFunSuspendingCheck.kt b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/CoroutineScopeFunSuspendingCheck.kt index c749b5039..9d16233c5 100644 --- a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/CoroutineScopeFunSuspendingCheck.kt +++ b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/CoroutineScopeFunSuspendingCheck.kt @@ -33,7 +33,7 @@ import org.sonarsource.kotlin.api.frontend.KotlinFileContext private const val COROUTINE_SCOPE = "kotlinx.coroutines.CoroutineScope" private const val MESSAGE = "Extension functions on CoroutineScope should not be suspending." -@org.sonarsource.kotlin.api.frontend.K1only("easy?") +@org.sonarsource.kotlin.api.frontend.K1only("easy? try next") @Rule(key = "S6312") class CoroutineScopeFunSuspendingCheck : AbstractCheck() { override fun visitNamedFunction(function: KtNamedFunction, kotlinFileContext: KotlinFileContext) { diff --git a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/DeprecatedCodeCheck.kt b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/DeprecatedCodeCheck.kt index 18c23180f..a55c8139a 100644 --- a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/DeprecatedCodeCheck.kt +++ b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/DeprecatedCodeCheck.kt @@ -31,7 +31,7 @@ import org.sonarsource.kotlin.api.checks.AbstractCheck import org.sonarsource.kotlin.api.checks.annotatedElement import org.sonarsource.kotlin.api.frontend.KotlinFileContext -@org.sonarsource.kotlin.api.frontend.K1only("easy?") +@org.sonarsource.kotlin.api.frontend.K1only("easy? try next") @Rule(key = "S1133") class DeprecatedCodeCheck : AbstractCheck() { diff --git a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/DeprecatedCodeUsedCheck.kt b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/DeprecatedCodeUsedCheck.kt index 1875979aa..f45bce198 100644 --- a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/DeprecatedCodeUsedCheck.kt +++ b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/DeprecatedCodeUsedCheck.kt @@ -32,7 +32,7 @@ import org.sonar.check.Rule import org.sonarsource.kotlin.api.checks.AbstractCheck import org.sonarsource.kotlin.api.frontend.KotlinFileContext -//@K1only +@org.sonarsource.kotlin.api.frontend.K1only("rewritten, but K2 differs") @Rule(key = "S1874") class DeprecatedCodeUsedCheck : AbstractCheck() { diff --git a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/IsInstanceMethodCheck.kt b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/IsInstanceMethodCheck.kt index fdf9b7f97..938bbb6ff 100644 --- a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/IsInstanceMethodCheck.kt +++ b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/IsInstanceMethodCheck.kt @@ -43,7 +43,7 @@ import org.sonarsource.kotlin.api.visiting.analyze private val JAVA_CLASS_KEYWORDS = listOf("java", "javaClass") -@org.sonarsource.kotlin.api.frontend.K1only("easy?") +@org.sonarsource.kotlin.api.frontend.K1only("rewritten, but K2 differs") @Rule(key = "S6202") class IsInstanceMethodCheck : CallAbstractCheck() { diff --git a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/SamConversionCheck.kt b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/SamConversionCheck.kt index 9ae68e9cf..5b61b8983 100644 --- a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/SamConversionCheck.kt +++ b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/SamConversionCheck.kt @@ -28,7 +28,7 @@ import org.sonarsource.kotlin.api.checks.isFunctionalInterface import org.sonarsource.kotlin.api.checks.merge import org.sonarsource.kotlin.api.frontend.KotlinFileContext -@org.sonarsource.kotlin.api.frontend.K1only("easy?") +@org.sonarsource.kotlin.api.frontend.K1only("easy? try next") @Rule(key = "S6516") class SamConversionCheck : AbstractCheck() { diff --git a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/SingletonPatternCheck.kt b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/SingletonPatternCheck.kt index 57876d4a3..337b5bc59 100644 --- a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/SingletonPatternCheck.kt +++ b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/SingletonPatternCheck.kt @@ -49,7 +49,7 @@ private val lazyInitializationMatcher = FunMatcher( definingSupertype = "kotlin" ) -@org.sonarsource.kotlin.api.frontend.K1only("easy?") +@org.sonarsource.kotlin.api.frontend.K1only("easy? try next") @Rule(key = "S6515") class SingletonPatternCheck : AbstractCheck() { diff --git a/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/KotlinSensorTest.kt b/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/KotlinSensorTest.kt index f3488c64a..e222d6640 100644 --- a/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/KotlinSensorTest.kt +++ b/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/KotlinSensorTest.kt @@ -217,6 +217,19 @@ internal class KotlinSensorTest : AbstractSensorTest() { assertThat(issues).hasSize(2) } + /** + * ``` + * java.lang.IllegalStateException: Resolution is not performed + * at org.jetbrains.kotlin.analysis.api.descriptors.CliFe10AnalysisFacade.orThrowResolutionNotPerformedError(CliFe10AnalysisFacade.kt:78) + * at org.jetbrains.kotlin.analysis.api.descriptors.CliFe10AnalysisFacade.getAnalysisContext(CliFe10AnalysisFacade.kt:52) + * at org.jetbrains.kotlin.analysis.api.descriptors.CliFe10AnalysisFacade.getAnalysisContext(CliFe10AnalysisFacade.kt:41) + * at org.jetbrains.kotlin.analysis.api.descriptors.KaFe10SessionProvider.getAnalysisSession(KaFe10SessionProvider.kt:24) + * at org.sonarsource.kotlin.api.visiting.KotlinFileVisitor.scan(KotlinFileVisitor.kt:57) + * ``` + * + * TODO try to mock analyzeDeclarations in TopDownAnalyzerFacadeForJVM which is after analysisHandlerExtensions + */ + @org.junit.jupiter.api.Disabled @Test fun `Ensure compiler crashes during BindingContext generation don't crash engine`() { context.setCanSkipUnchangedFiles(false)