Show versions that are reported different in SameVersionIDEPluginInspection

This commit is contained in:
Nikolay Krasko
2016-07-06 13:12:26 +03:00
parent 5cfebe4120
commit 16b8f3fd57
4 changed files with 24 additions and 10 deletions
+12 -8
View File
@@ -8,12 +8,12 @@
### Language features
+ **Coroutines (async/await, generators)** ([proposal](https://github.com/Kotlin/kotlin-coroutines))
Current limitations:
- for some cases type inference is not supported yet
- limited IDE support
- allowed only one `handleResult` function: [design](https://github.com/Kotlin/kotlin-coroutines/blob/master/kotlin-coroutines-informal.md#result-handlers)
- allowed only one `handleResult` function: [design](https://github.com/Kotlin/kotlin-coroutines/blob/master/kotlin-coroutines-informal.md#result-handlers)
- handling `finally` blocks is not supported: [issue](https://github.com/Kotlin/kotlin-coroutines/issues/1)
+ **Bound callable references** ([proposal](https://github.com/Kotlin/KEEP/issues/5))
@@ -49,13 +49,13 @@ and related functionality, except the following parts:
###### Issues fixed
- [`KT-4779`](https://youtrack.jetbrains.com/issue/KT-4779) Generate default methods for implementations in interfaces
- [`KT-11780`](https://youtrack.jetbrains.com/issue/KT-11780) Fixed incorrect "No cast needed" warning
- [`KT-11780`](https://youtrack.jetbrains.com/issue/KT-11780) Fixed incorrect "No cast needed" warning
- [`KT-12156`](https://youtrack.jetbrains.com/issue/KT-12156) Fixed incorrect error on `inline` modifier inside final class
- [`KT-12358`](https://youtrack.jetbrains.com/issue/KT-12358) Report missing error "Abstract member not implemented" when a fake method of 'Any' is inherited from an interface
- [`KT-6206`](https://youtrack.jetbrains.com/issue/KT-6206) Generate equals/hashCode/toString in data class always unless it'll cause a JVM signature clash error
- [`KT-8990`](https://youtrack.jetbrains.com/issue/KT-8990) Fixed incorrect error "virtual member hidden" for a private method of an inner class
- [`KT-12429`](https://youtrack.jetbrains.com/issue/KT-12429) Fixed visibility checks for annotation usage on top-level declarations
- [`KT-5068`](https://youtrack.jetbrains.com/issue/KT-5068) Introduced a special diagnostic message for "type mismatch" errors such as `fun f(): Int = { 1 }`.
- [`KT-8990`](https://youtrack.jetbrains.com/issue/KT-8990) Fixed incorrect error "virtual member hidden" for a private method of an inner class
- [`KT-12429`](https://youtrack.jetbrains.com/issue/KT-12429) Fixed visibility checks for annotation usage on top-level declarations
- [`KT-5068`](https://youtrack.jetbrains.com/issue/KT-5068) Introduced a special diagnostic message for "type mismatch" errors such as `fun f(): Int = { 1 }`.
### Standard Library
@@ -71,7 +71,7 @@ These artifacts include extensions for the types available in the latter JDKs, s
+ **"Leaking this" inspection**
This inspection reports dangerous operations inside constructors including:
- Accessing non-final property in constructor
- Calling non-final function in constructor
- Using 'this' as function argument in constructor of non-final class
@@ -87,6 +87,10 @@ These artifacts include extensions for the types available in the latter JDKs, s
### IDE
###### New features
- Show versions in inspection about different version of Kotlin plugin in Maven and IDE plugin
###### Issues fixed
- [`KT-12830`](https://youtrack.jetbrains.com/issue/KT-12830) Remove spaces before *?* in nullable types
@@ -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})")
}
}
@@ -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) -->