Related with #2301
It seems that the "fix" didn't "fix" all the cases. Now instead of a NPE we are getting a casting exception:
Analyzing '/path/File.kt' led to an exception.
The original exception message was: org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.PsiWhiteSpaceImpl cannot be cast to org.jetbrains.kotlin.psi.KtElement
Running detekt '1.5.1' on Java '1.8.0_201-b09' on OS 'Linux'.
If the exception message does not help, please feel free to create an issue on our GitHub page.
io.gitlab.arturbosch.detekt.rules.style.ExplicitCollectionElementAccessMethod.isMapMethod(ExplicitCollectionElementAccessMethod.kt:70)
io.gitlab.arturbosch.detekt.rules.style.ExplicitCollectionElementAccessMethod.visitCallExpression(ExplicitCollectionElementAccessMethod.kt:53)
org.jetbrains.kotlin.psi.KtVisitorVoid.visitCallExpression(KtVisitorVoid.java:797)
It's easy to reproduce:
val string = ""
.toString()
I'm working in the fix.
Related with #2301
It seems that the "fix" didn't "fix" all the cases. Now instead of a NPE we are getting a casting exception:
It's easy to reproduce:
I'm working in the fix.