ParameterInfoHandler not parameterized by PsiElement results in ClassCastException

This is more of an FYI about a plugin SDK inconsistency.  I originally logged a bug for this, but it was resolved and I was asked to post here for Open API issues.

I've create a custom ParameterInfoHandler that's parameterized by types which are not PsiElements. This is because the parameters are associated with a subset of a much larger and more generic element (basically a large text region). This is allowed in the SDK because the type parameters for ParameterInfoHandler are not constrained by any base class. My implementation actually works well, but when parameter info is shown, I see the following stack trace in the log:

[ 131856] ERROR - til.concurrency.QueueProcessor - java.util.LinkedList cannot be cast to com.intellij.psi.PsiElement
java.lang.ClassCastException: java.util.LinkedList cannot be cast to com.intellij.psi.PsiElement
at com.intellij.codeInsight.hint.ParameterInfoController.updateComponent(ParameterInfoController.java:277)
at com.intellij.codeInsight.hint.ParameterInfoController.access$700(ParameterInfoController.java:52)
at com.intellij.codeInsight.hint.ParameterInfoController$5$1.run(ParameterInfoController.java:249)
at com.intellij.openapi.project.DumbService.withAlternativeResolveEnabled(DumbService.java:256)
at com.intellij.codeInsight.hint.ParameterInfoController$5.run(ParameterInfoController.java:246)
...

It might be good to check whether elementForUpdating is a PsiElement before casting to avoid this issue.

5 comments
Comment actions Permalink

You say that the bug was resolved, but casting is still there. If that wasn't part of the original issue, please create a separate one for this.

0
Comment actions Permalink

I meant to say that the bug was closed (vs. resolved) asking me to bring the question/issue here.  Here's the exact resolution comment:

"Open API questions should be submitted at https://intellij-support.jetbrains.com/hc/en-us/community/topics/200366979-IntelliJ-IDEA-Open-API-and-Plugin-Development . Thank you."

If this should be logged as an actual issue, please let me know how to do so in a way that doesn't lead to the same result.  Thanks!

0
Comment actions Permalink

Could you please give a reference to the original bug?

0
Comment actions Permalink

Sure.  It's case #702342.  Please let me know if you need additional info.

0
Comment actions Permalink

I've created an issue in YouTrack for this - https://youtrack.jetbrains.com/issue/IDEA-157491, and submitted a fix to master. Later I'll copy it to 162 branch (to be included in IDEA 2016.2).

0

Please sign in to leave a comment.