Show versions that are reported different in SameVersionIDEPluginInspection
This commit is contained in:
+5
-1
@@ -20,6 +20,7 @@ import com.intellij.lang.annotation.HighlightSeverity
|
||||
import com.intellij.util.xml.DomFileElement
|
||||
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder
|
||||
import com.intellij.util.xml.highlighting.DomElementsInspection
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomPlugin
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel
|
||||
import org.jetbrains.idea.maven.project.MavenProjectsManager
|
||||
@@ -29,6 +30,9 @@ import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
||||
class SameVersionIDEPluginInspection : DomElementsInspection<MavenDomProjectModel>(MavenDomProjectModel::class.java) {
|
||||
private val idePluginVersion by lazy { bundledRuntimeVersion() }
|
||||
|
||||
var testVersionMessage: String? = null
|
||||
@TestOnly set
|
||||
|
||||
override fun checkFileElement(domFileElement: DomFileElement<MavenDomProjectModel>?, holder: DomElementAnnotationHolder?) {
|
||||
if (domFileElement == null || holder == null) {
|
||||
return
|
||||
@@ -50,6 +54,6 @@ class SameVersionIDEPluginInspection : DomElementsInspection<MavenDomProjectMode
|
||||
private fun createProblem(holder: DomElementAnnotationHolder, plugin: MavenDomPlugin) {
|
||||
holder.createProblem(plugin.version,
|
||||
HighlightSeverity.WARNING,
|
||||
"You use different IDE and Maven plugins' versions so you code's behaviour may be different")
|
||||
"Kotlin version that is used for building with Maven (${plugin.version.stringValue}) differs from the one bundled into the IDE plugin (${testVersionMessage ?: idePluginVersion})")
|
||||
}
|
||||
}
|
||||
+6
@@ -37,6 +37,7 @@ import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl
|
||||
import com.intellij.util.indexing.FileBasedIndex
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType
|
||||
import org.jetbrains.kotlin.idea.maven.inspections.KotlinMavenPluginPhaseInspection
|
||||
import org.jetbrains.kotlin.idea.maven.inspections.SameVersionIDEPluginInspection
|
||||
import org.jetbrains.kotlin.idea.refactoring.toPsiDirectory
|
||||
import org.jetbrains.kotlin.idea.util.projectStructure.allModules
|
||||
import java.io.File
|
||||
@@ -154,6 +155,11 @@ abstract class AbstractKotlinMavenInspectionTest : MavenImportingTestCase() {
|
||||
private fun runInspection(inspectionClass: Class<*>): List<Pair<SimplifiedProblemDescription, ProblemDescriptorBase>> {
|
||||
val toolWrapper = LocalInspectionToolWrapper(inspectionClass.newInstance() as LocalInspectionTool)
|
||||
|
||||
val tool = toolWrapper.tool
|
||||
if (tool is SameVersionIDEPluginInspection) {
|
||||
tool.testVersionMessage = "\$PLUGIN_VERSION"
|
||||
}
|
||||
|
||||
val scope = AnalysisScope(myProject)
|
||||
val inspectionManager = (InspectionManager.getInstance(myProject) as InspectionManagerEx)
|
||||
val globalContext = CodeInsightTestFixtureImpl.createGlobalContextForTool(scope, myProject, inspectionManager, toolWrapper)
|
||||
|
||||
@@ -32,4 +32,4 @@
|
||||
</project>
|
||||
|
||||
<!-- inspection: org.jetbrains.kotlin.idea.maven.inspections.SameVersionIDEPluginInspection -->
|
||||
<!-- problem: on ${kotlin.version}, title You use different IDE and Maven plugins' versions so you code's behaviour may be different -->
|
||||
<!-- problem: on ${kotlin.version}, title Kotlin version that is used for building with Maven (1.0.0) differs from the one bundled into the IDE plugin ($PLUGIN_VERSION) -->
|
||||
Reference in New Issue
Block a user