Fixed two possible index out of bounds exceptions in ExtractorReferenceContributor and BogusAssertionInspection. Prepared release.

This commit is contained in:
Chris Hodges 2020-07-31 17:01:13 +02:00
parent 66b725c4d2
commit 45307b364d
4 changed files with 7 additions and 3 deletions

View File

@ -793,8 +793,9 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
## Changelog
#### V1.10 (unreleased)
#### V1.10 (31-Jul-20) Friday the 31st Edition
- Updated libraries to the latest versions (including AssertJ 3.16.1 and Kotlin 1.40-rc).
- Fixed two possible index out of bounds exceptions in ExtractorReferenceContributor and BogusAssertionInspection.
#### V1.9 (25-Feb-20) Mardi Gras Edition
- TwistedAssertion inspection will no longer warn for ```.matches()``` and ```doesNotMatch()``` for regular expressions.

View File

@ -7,7 +7,7 @@ plugins {
}
group 'de.platon42'
version '1.9'
version '1.10'
repositories {
mavenCentral()
@ -43,9 +43,10 @@ intellij {
patchPluginXml {
changeNotes """
<h4>V1.10 (unreleased)</h4>
<h4>V1.10 (31-Jul-20) Friday the 31st Edition</h4>
<ul>
<li>Updated libraries to the latest versions (including AssertJ 3.16.1 and Kotlin 1.40-rc).
<li>Fixed two possible index out of bounds exceptions in ExtractorReferenceContributor and BogusAssertionInspection.
</ul>
<p>Full changelog available at <a href="https://github.com/chrisly42/cajon-plugin#changelog">Github project site</a>.</p>
"""

View File

@ -132,6 +132,7 @@ class BogusAssertionInspection : AbstractAssertJInspection() {
// Note: replace with TrackingEquivalenceChecker() for IDEA >= 2019.1
val equivalenceChecker = EquivalenceChecker.getCanonicalPsiEquivalence()!!
val isSameExpression = allCalls
.filter { it.argumentList.expressions.size == 1 }
.filter(SAME_ACTUAL_AND_EXPECTED_MATCHERS::test)
.any { equivalenceChecker.expressionsAreEquivalent(actualExpression, it.firstArg) }
if (isSameExpression) {

View File

@ -124,6 +124,7 @@ class ExtractorReferenceContributor : PsiReferenceContributor() {
if (!CallMatcher.anyOf(EXTRACTING_FROM_ITERABLE, FLAT_EXTRACTING_FROM_ITERABLE).test(methodCallExpression)) return null
val iterableType = findActualType(methodCallExpression) ?: return null
if (iterableType.parameters.isEmpty()) return null
val innerType = iterableType.resolveGenerics().substitutor.substitute(iterableType.parameters[0])
val containingClass = PsiTypesUtil.getPsiClass(innerType) ?: return null
return if (isResultOf) lookupMethod(containingClass, literal) else lookupFieldOrProperty(containingClass, literal, 0)