Updated dependencies, attempt to fix NPE, workaround for scheduled removal of a static field in PsiParserFacade.
Added PluginVerifier to build.gradle.
This commit is contained in:
parent
2d92d71af0
commit
c29d644f56
@ -1,4 +1,4 @@
|
|||||||
Copyright 2019 Chris Hodges <chrisly@platon42.de>
|
Copyright 2019-2022 Chris Hodges <chrisly@platon42.de>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -798,7 +798,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
|
|||||||
|
|
||||||
## Development notice
|
## Development notice
|
||||||
|
|
||||||
Cajon is written in Kotlin 1.4.
|
Cajon is written in Kotlin 1.7.
|
||||||
|
|
||||||
Cajon is probably the only plugin that uses JUnit 5 Jupiter for unit testing so far (or at least the only one I'm aware of ;) ).
|
Cajon is probably the only plugin that uses JUnit 5 Jupiter for unit testing so far (or at least the only one I'm aware of ;) ).
|
||||||
The IntelliJ framework actually uses the JUnit 3 TestCase for plugin testing, and it took me quite a while to make it work with JUnit 5.
|
The IntelliJ framework actually uses the JUnit 3 TestCase for plugin testing, and it took me quite a while to make it work with JUnit 5.
|
||||||
@ -814,6 +814,7 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
|
|||||||
from: assertThat(object).extracting("propOne", "propNoGetter", "propTwo.innerProp")...
|
from: assertThat(object).extracting("propOne", "propNoGetter", "propTwo.innerProp")...
|
||||||
to: assertThat(object).extracting(type::getPropOne, it -> it.propNoGetter, it -> it.getPropTwo().getInnerProp())...
|
to: assertThat(object).extracting(type::getPropOne, it -> it.propNoGetter, it -> it.getPropTwo().getInnerProp())...
|
||||||
```
|
```
|
||||||
|
- Support primitives in assertThat(map.containsKey(1)).isTrue();
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
36
build.gradle
36
build.gradle
@ -1,13 +1,13 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'org.jetbrains.intellij' version '1.1.3'
|
id 'org.jetbrains.intellij' version '1.8.0'
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.5.21'
|
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
|
||||||
id 'jacoco'
|
id 'jacoco'
|
||||||
id 'com.github.kt3k.coveralls' version '2.11.0'
|
id 'com.github.kt3k.coveralls' version '2.12.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
group 'de.platon42'
|
group 'de.platon42'
|
||||||
version '1.12'
|
version '1.13'
|
||||||
sourceCompatibility = "1.8"
|
sourceCompatibility = "1.8"
|
||||||
targetCompatibility = "1.8"
|
targetCompatibility = "1.8"
|
||||||
|
|
||||||
@ -22,10 +22,10 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||||
testImplementation "org.assertj:assertj-core:3.20.2"
|
testImplementation "org.assertj:assertj-core:3.23.1"
|
||||||
testImplementation "org.assertj:assertj-guava:3.4.0"
|
testImplementation "org.assertj:assertj-guava:3.5.0"
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.0-M1'
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
|
||||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.0-M1'
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
|
||||||
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
||||||
testImplementation "org.jetbrains.kotlin:kotlin-reflect"
|
testImplementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||||
// testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
// testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
||||||
@ -40,18 +40,24 @@ compileTestKotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
intellij {
|
intellij {
|
||||||
setVersion("2021.1.3") // LATEST-EAP-SNAPSHOT
|
setVersion("2022.2") // LATEST-EAP-SNAPSHOT
|
||||||
//pluginName.set(provider { 'Concise AssertJ Optimizing Nitpicker (Cajon)' })
|
//pluginName.set(provider { 'Concise AssertJ Optimizing Nitpicker (Cajon)' })
|
||||||
setUpdateSinceUntilBuild(false)
|
setUpdateSinceUntilBuild(false)
|
||||||
setPlugins(["com.intellij.java"])
|
setPlugins(["com.intellij.java"])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runPluginVerifier {
|
||||||
|
ideVersions = ["IC-193.5662.53", "IC-222.3345.118"] // 2020.3 - 2022.2
|
||||||
|
downloadDir = System.getProperty("user.home") + "/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/verifier"
|
||||||
|
}
|
||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
setChangeNotes("""
|
setChangeNotes("""
|
||||||
<h4>V1.12 (06-May-21)</h4>
|
<h4>V1.13 (15-Aug-22)</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Maintenance. Updated various dependencies (Kotlin 1.50.0) and AssertJ 3.19.0
|
<li>Maintenance. Updated various dependencies (Kotlin 1.70.0) and AssertJ 3.23.1 and AssertJ-Guava 3.5.0.
|
||||||
<li>Fixed issue#3 reported by hankem where usingRecursiveComparison() was not considered a complex transformation.
|
<li>Tried to fix unreproducable issue#9.
|
||||||
|
<li>Added workaround for upcoming API change in IntelliJ breaking older releases.
|
||||||
</ul>
|
</ul>
|
||||||
<p>Full changelog available at <a href="https://github.com/chrisly42/cajon-plugin#changelog">Github project site</a>.</p>
|
<p>Full changelog available at <a href="https://github.com/chrisly42/cajon-plugin#changelog">Github project site</a>.</p>
|
||||||
""")
|
""")
|
||||||
@ -64,8 +70,12 @@ test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.test {
|
||||||
|
systemProperty("idea.force.use.core.classloader", "true")
|
||||||
|
}
|
||||||
|
|
||||||
jacoco {
|
jacoco {
|
||||||
toolVersion = '0.8.7'
|
toolVersion = '0.8.8'
|
||||||
}
|
}
|
||||||
|
|
||||||
jacocoTestReport {
|
jacocoTestReport {
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -115,8 +115,7 @@ fun PsiMethodCallExpression.getExpectedNullNonNullResult(): Boolean? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun PsiMethodCallExpression.calculateConstantParameterValue(argIndex: Int): Any? {
|
fun PsiMethodCallExpression.calculateConstantParameterValue(argIndex: Int): Any? {
|
||||||
if (argIndex >= argumentList.expressions.size) return null
|
return getArgOrNull(argIndex)?.calculateConstantValue()
|
||||||
return getArg(argIndex).calculateConstantValue()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun PsiExpression.calculateConstantValue(): Any? {
|
fun PsiExpression.calculateConstantValue(): Any? {
|
||||||
|
@ -56,9 +56,14 @@ class JoinStatementsQuickFix(private val separateLineLimit: Int) : AbstractCommo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addLineBreak(project: Project, lastElementBeforeConcat: PsiElement) {
|
private fun addLineBreak(project: Project, lastElementBeforeConcat: PsiElement) {
|
||||||
val newLineNode =
|
val newLineNode = try {
|
||||||
|
PsiParserFacade.getInstance(project).createWhiteSpaceFromText("\n\t")
|
||||||
|
} catch (ex: NoSuchMethodError) {
|
||||||
|
// scheduled for removal, but alternate version not even available in 2020.3.
|
||||||
|
// So keep it here until we run into a problem.
|
||||||
|
// Changing the min version from 2017.3 to 2021.x is a major thing.
|
||||||
PsiParserFacade.SERVICE.getInstance(project).createWhiteSpaceFromText("\n\t")
|
PsiParserFacade.SERVICE.getInstance(project).createWhiteSpaceFromText("\n\t")
|
||||||
|
}
|
||||||
lastElementBeforeConcat.addAfter(newLineNode, lastElementBeforeConcat.firstChild)
|
lastElementBeforeConcat.addAfter(newLineNode, lastElementBeforeConcat.firstChild)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import de.platon42.intellij.jupiter.LightCodeInsightExtension
|
|||||||
import de.platon42.intellij.jupiter.TestDataPath
|
import de.platon42.intellij.jupiter.TestDataPath
|
||||||
import de.platon42.intellij.jupiter.TestJdk
|
import de.platon42.intellij.jupiter.TestJdk
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
|
import org.assertj.core.api.Condition
|
||||||
import org.junit.jupiter.api.DisplayNameGeneration
|
import org.junit.jupiter.api.DisplayNameGeneration
|
||||||
import org.junit.jupiter.api.DisplayNameGenerator
|
import org.junit.jupiter.api.DisplayNameGenerator
|
||||||
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
@ -39,11 +40,8 @@ abstract class AbstractCajonTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun assertHighlightings(myFixture: JavaCodeInsightTestFixture, count: Int, snippet: String) {
|
protected fun assertHighlightings(myFixture: JavaCodeInsightTestFixture, count: Int, snippet: String) {
|
||||||
val highlights = myFixture.doHighlighting()
|
assertThat(myFixture.doHighlighting())
|
||||||
.asSequence()
|
.areExactly(count, Condition({ it.description?.contains(snippet) ?: false }, "containing"))
|
||||||
.filter { it.description?.contains(snippet) ?: false }
|
|
||||||
.toList()
|
|
||||||
assertThat(highlights).hasSize(count)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CutOffFixtureDisplayNameGenerator : DisplayNameGenerator.ReplaceUnderscores() {
|
class CutOffFixtureDisplayNameGenerator : DisplayNameGenerator.ReplaceUnderscores() {
|
||||||
|
Loading…
Reference in New Issue
Block a user