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:
2022-08-15 21:39:32 +02:00
parent 2d92d71af0
commit c29d644f56
7 changed files with 38 additions and 25 deletions
@@ -115,8 +115,7 @@ fun PsiMethodCallExpression.getExpectedNullNonNullResult(): Boolean? {
}
fun PsiMethodCallExpression.calculateConstantParameterValue(argIndex: Int): Any? {
if (argIndex >= argumentList.expressions.size) return null
return getArg(argIndex).calculateConstantValue()
return getArgOrNull(argIndex)?.calculateConstantValue()
}
fun PsiExpression.calculateConstantValue(): Any? {
@@ -56,9 +56,14 @@ class JoinStatementsQuickFix(private val separateLineLimit: Int) : AbstractCommo
}
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")
}
lastElementBeforeConcat.addAfter(newLineNode, lastElementBeforeConcat.firstChild)
}