diff --git a/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/api/InputFileContext.kt b/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/api/InputFileContext.kt index 806eb5e5f..22b067dc3 100644 --- a/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/api/InputFileContext.kt +++ b/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/api/InputFileContext.kt @@ -39,7 +39,7 @@ interface InputFileContext { gap: Double?, ) - fun reportAnalysisParseError(repositoryKey: String?, inputFile: InputFile, location: TextPointer?) + fun reportAnalysisParseError(repositoryKey: String, inputFile: InputFile, location: TextPointer?) fun reportAnalysisError(message: String?, location: TextPointer?) } diff --git a/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/converter/CommentAnnotationsAndTokenVisitor.kt b/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/converter/CommentAnnotationsAndTokenVisitor.kt index 7965e42d3..4c5660d33 100644 --- a/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/converter/CommentAnnotationsAndTokenVisitor.kt +++ b/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/converter/CommentAnnotationsAndTokenVisitor.kt @@ -32,7 +32,6 @@ import org.jetbrains.kotlin.psi.KtValueArgument import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.sonar.api.batch.fs.InputFile -import org.sonar.api.batch.fs.TextPointer import org.sonar.api.batch.fs.TextRange import org.sonarsource.kotlin.converter.KotlinTextRanges.textPointerAtOffset diff --git a/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/plugin/InputFileContext.kt b/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/plugin/InputFileContext.kt index 939825ddd..928cddeb6 100644 --- a/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/plugin/InputFileContext.kt +++ b/sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/plugin/InputFileContext.kt @@ -74,7 +74,7 @@ class InputFileContextImpl( } } - override fun reportAnalysisParseError(repositoryKey: String?, inputFile: InputFile, location: TextPointer?) { + override fun reportAnalysisParseError(repositoryKey: String, inputFile: InputFile, location: TextPointer?) { reportAnalysisError("Unable to parse file: $inputFile", location) val parsingErrorRuleKey = RuleKey.of(repositoryKey, PARSING_ERROR_RULE_KEY) diff --git a/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/DummyInputFileContext.kt b/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/DummyInputFileContext.kt index d917599b6..c79ed0d3f 100644 --- a/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/DummyInputFileContext.kt +++ b/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/DummyInputFileContext.kt @@ -45,7 +45,7 @@ class DummyInputFileContext : InputFileContext { issuesReported.add(ReportedIssue(ruleKey, textRange, message, secondaryLocations, gap)) } - override fun reportAnalysisParseError(repositoryKey: String?, inputFile: InputFile, location: TextPointer?) { + override fun reportAnalysisParseError(repositoryKey: String, inputFile: InputFile, location: TextPointer?) { throw NotImplementedError() } diff --git a/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/surefire/data/SurefireStaxHandlerTest.java b/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/surefire/data/SurefireStaxHandlerTest.java index cf437b4cb..530d38c06 100644 --- a/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/surefire/data/SurefireStaxHandlerTest.java +++ b/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/surefire/data/SurefireStaxHandlerTest.java @@ -91,7 +91,7 @@ void shouldHaveErrorsAndFailures() throws XMLStreamException { // error UnitTestResult error = report.getResults().get(1); - assertThat(error.getDurationMilliseconds()).isEqualTo(0L); + assertThat(error.getDurationMilliseconds()).isZero(); assertThat(error.getStatus()).isEqualTo(UnitTestResult.STATUS_ERROR); assertThat(error.getName()).isEqualTo("testTwo"); } diff --git a/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/surefire/data/UnitTestClassReportTest.java b/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/surefire/data/UnitTestClassReportTest.java index 6d4c4d21a..efe5c2dd7 100644 --- a/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/surefire/data/UnitTestClassReportTest.java +++ b/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/surefire/data/UnitTestClassReportTest.java @@ -49,7 +49,7 @@ void shouldHaveEmptyReport() { assertThat(report.getResults().size()).isZero(); assertThat(report.getSkipped()).isZero(); assertThat(report.getTests()).isZero(); - assertThat(report.getDurationMilliseconds()).isEqualTo(0L); + assertThat(report.getDurationMilliseconds()).isZero(); assertThat(report.getErrors()).isZero(); assertThat(report.getFailures()).isZero(); } diff --git a/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/verifier/TestContext.kt b/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/verifier/TestContext.kt index 5b867b05e..28d77b5ef 100644 --- a/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/verifier/TestContext.kt +++ b/sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/verifier/TestContext.kt @@ -80,7 +80,7 @@ internal class TestContext( }) } - override fun reportAnalysisParseError(repositoryKey: String?, inputFile: InputFile, location: TextPointer?) { + override fun reportAnalysisParseError(repositoryKey: String, inputFile: InputFile, location: TextPointer?) { throw NotImplementedError() }