Upgraded kotlin-compiler to 1.2.40
diff --git a/build.gradle b/build.gradle
index 7260332..c1c9c6b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,10 @@
plugins {
- id "org.jetbrains.kotlin.jvm" version "1.2.30" apply false
+ id "org.jetbrains.kotlin.jvm" version "1.2.40" apply false
}
ext.libraries = [
- "kotlin_stdlib": "org.jetbrains.kotlin:kotlin-stdlib:1.2.30",
- "kotlin_compiler_embeddable": "org.jetbrains.kotlin:kotlin-compiler-embeddable:1.2.30",
+ "kotlin_stdlib": "org.jetbrains.kotlin:kotlin-stdlib:1.2.40",
+ "kotlin_compiler_embeddable": "org.jetbrains.kotlin:kotlin-compiler-embeddable:1.2.40",
"klob": "com.github.shyiko.klob:klob:0.2.0",
"aether_api": "org.eclipse.aether:aether-api:1.1.0",
"aether_spi": "org.eclipse.aether:aether-spi:1.1.0",
diff --git a/ktlint-test/src/main/kotlin/com/github/shyiko/ktlint/test/package.kt b/ktlint-test/src/main/kotlin/com/github/shyiko/ktlint/test/package.kt
index 651c4ac..a22223e 100644
--- a/ktlint-test/src/main/kotlin/com/github/shyiko/ktlint/test/package.kt
+++ b/ktlint-test/src/main/kotlin/com/github/shyiko/ktlint/test/package.kt
@@ -4,6 +4,7 @@
import com.andreapivetta.kolor.Kolor
import com.github.shyiko.ktlint.core.Rule
import org.jetbrains.kotlin.com.intellij.lang.ASTNode
+import org.jetbrains.kotlin.com.intellij.openapi.util.TextRange
import org.jetbrains.kotlin.com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
@@ -62,16 +63,16 @@
if (node.lastChildNode == null) node else lastChildNodeOf(node.lastChildNode)
private fun location(node: ASTNode) =
- DiagnosticUtils.getClosestPsiElement(node)
- ?.takeIf { it.isValid && it.containingFile != null }
- ?.let {
- try {
- DiagnosticUtils.offsetToLineAndColumn(it.containingFile.viewProvider.document,
- it.textRange.startOffset)
- } catch (e: Exception) {
- null // DiagnosticUtils.offsetToLineAndColumn has knowledge of mutated AST
- }
+ node.psi.containingFile?.let { psiFile ->
+ try {
+ DiagnosticUtils.getLineAndColumnInPsiFile(
+ psiFile,
+ TextRange(node.startOffset, node.startOffset)
+ )
+ } catch (e: Exception) {
+ null // DiagnosticUtils has no knowledge of mutated AST
}
+ }
private fun colorClassName(className: String): String {
val name = className.substringAfterLast(".")
diff --git a/pom.xml b/pom.xml
index e8d85a7..0b87efa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <kotlin.version>1.2.30</kotlin.version>
+ <kotlin.version>1.2.40</kotlin.version>
<kotlin.compiler.languageVersion>1.1</kotlin.compiler.languageVersion>
<kotlin.compiler.apiVersion>1.1</kotlin.compiler.apiVersion>
<aether.version>1.1.0</aether.version>