Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExplicitCollectionElementAccessMethod crashes #2322

Closed
BraisGabin opened this issue Feb 6, 2020 · 1 comment · Fixed by #2323
Closed

ExplicitCollectionElementAccessMethod crashes #2322

BraisGabin opened this issue Feb 6, 2020 · 1 comment · Fixed by #2323
Milestone

Comments

@BraisGabin
Copy link
Member

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.

@schalkms
Copy link
Member

schalkms commented Feb 6, 2020

Yeah cause #2312 was no duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants