Psi oddness - Should not be called on Chameleons

Whilst trying to track down some problems with my Psi code, I started hitting this in IDEA:

Error message: Should not be called on Chameleons
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:34)
at com.intellij.psi.impl.source.tree.ChameleonElement.getPsi(ChameleonElement.java:30)
at com.intellij.psi.impl.source.SourceTreeToPsiMap.treeElementToPsi(SourceTreeToPsiMap.java:4)
at com.intellij.psi.impl.source.tree.CompositeElement.getChildrenAsPsiElements(CompositeElement.java:63)
at com.intellij.psi.impl.source.tree.CompositePsiElement.getChildren(CompositePsiElement.java:75)
at com.talios.jira.idea.JiraAnnotationListener.containsIssueDoc(JiraAnnotationListener.java:192)
at com.talios.jira.idea.JiraAnnotationListener.access$600(JiraAnnotationListener.java:32)
at com.talios.jira.idea.JiraAnnotationListener$3.run(JiraAnnotationListener.java:149)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:139)
at com.talios.jira.idea.JiraAnnotationListener$2.run(JiraAnnotationListener.java:133)
at com.intellij.openapi.command.a.a.executeCommand(a.java:5)
at com.intellij.openapi.command.a.a.executeCommand(a.java:18)
at com.talios.jira.idea.JiraAnnotationListener.annotatePsiElement(JiraAnnotationListener.java:128)
at com.talios.jira.idea.JiraAnnotationListener.access$000(JiraAnnotationListener.java:32)
at com.talios.jira.idea.JiraAnnotationListener$1.run(JiraAnnotationListener.java:106)
at com.intellij.openapi.application.impl.c$b_.run(c$b_.java:9)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:1)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:146)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:63)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)


The relevant line from my code and 3 lines prior are:

if (comment != null ) {
try {
PsiElement[] children = comment.getChildren();

What actually is a ChameleonElement when its at home?

0
Avatar
Permanently deleted user

What actually is a ChameleonElement when its at home?

Kind of stuff you should not be faced with. A bulk of text to be parsed later
should be transparent optimization to PSI clients. So what you get is clear
PSI implementation bug. I'd be keen for a short sample demonstrating this
exception.

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"




0

The codes running from inside a DocumentListener and only seems to trigger if I type fast.

I'll rip the code out into a small plugin that hopefully reproduces it.

0

请先登录再写评论。