"Should not be called on Chameleons" exception

I had this exception thrown all the time on a certain JSP files in build 8243 and reported it many times, of course.
I see 8280 didn't fix that, was thrown right away the moment I've opened a JSP file:

-



Should not be called on Chameleons
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)
at com.intellij.psi.impl.source.tree.ChameleonElement.getPsi(ChameleonElement.java:3)
at com.intellij.lang.javascript.folding.JavaScriptFoldingBuilder.collapseConsequentNodesOfSpecifiedType(JavaScriptFoldingBuilder.java:86)
at com.intellij.lang.javascript.folding.JavaScriptFoldingBuilder.appendDescriptors(JavaScriptFoldingBuilder.java:61)
at com.intellij.lang.javascript.folding.JavaScriptFoldingBuilder.appendDescriptors(JavaScriptFoldingBuilder.java:73)
at com.intellij.lang.javascript.folding.JavaScriptFoldingBuilder.buildFoldRegions(JavaScriptFoldingBuilder.java:44)
at com.intellij.lang.xml.XmlFoldingBuilder.doAddForChildren(XmlFoldingBuilder.java:8)
at com.intellij.lang.jsp.JspFoldingBuilder.addElementsToFold(JspFoldingBuilder.java:78)
at com.intellij.lang.xml.XmlFoldingBuilder.doAddForChildren(XmlFoldingBuilder.java:48)
at com.intellij.lang.jsp.JspFoldingBuilder.addElementsToFold(JspFoldingBuilder.java:78)
at com.intellij.lang.xml.XmlFoldingBuilder.doAddForChildren(XmlFoldingBuilder.java:48)
at com.intellij.lang.jsp.JspFoldingBuilder.addElementsToFold(JspFoldingBuilder.java:78)
at com.intellij.lang.xml.XmlFoldingBuilder.buildFoldRegions(XmlFoldingBuilder.java:16)
at com.intellij.lang.jsp.JspFoldingBuilder.buildFoldRegions(JspFoldingBuilder.java:39)
at com.intellij.codeInsight.folding.impl.FoldingPolicy.getElementsToFold(FoldingPolicy.java:13)
at com.intellij.codeInsight.folding.impl.FoldingUpdate.updateFoldRegions(FoldingUpdate.java:1)
at com.intellij.codeInsight.folding.impl.CodeFoldingManagerImpl.a(CodeFoldingManagerImpl.java:53)
at com.intellij.codeInsight.folding.impl.CodeFoldingManagerImpl.access$100(CodeFoldingManagerImpl.java:45)
at com.intellij.codeInsight.folding.impl.CodeFoldingManagerImpl$2$1$1.run(CodeFoldingManagerImpl.java:8)
at com.intellij.openapi.editor.impl.FoldingModelImpl.a(FoldingModelImpl.java:41)
at com.intellij.openapi.editor.impl.FoldingModelImpl.runBatchFoldingOperationDoNotCollapseCaret(FoldingModelImpl.java:81)
at com.intellij.codeInsight.folding.impl.CodeFoldingManagerImpl$2$1.run(CodeFoldingManagerImpl.java:4)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:13)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at com.intellij.ide.IdeEventQueue.c(IdeEventQueue.java:210)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:154)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:130)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

8 comments
Comment actions Permalink

Fedora 9, Java 6

0
Comment actions Permalink

Submitted as 110018

0
Comment actions Permalink

This is a consequence of an unfortunate open API: folding builder operates on ASTNodes rather than psi elements, so the language implementation calls getFirstChildNode() instead of getFirstChild() leaving the chameleons in the tree.

0
Comment actions Permalink

Ok, are you planning to fix this issue in the following builds ?

0
Comment actions Permalink

I'm definitely not, but IDEA team surely does.

0
Comment actions Permalink

Oh, that's encouraging :)

0
Comment actions Permalink

Should be fine in next eap build, please, post again if it is not

Evgeny Goldin wrote:

Oh, that's encouraging :)


--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Many thanks, Maxim, I will.

0

Please sign in to leave a comment.