can no longer visit typecast expressions... with 963


I guess you made some changes to the Psi structure, and/or the
PsiElementVisitor, since 957.
With 963, I can no longer visit a class TypeCast expression the old -
957 - way, and I'm clueless.

This used to work :


and



With 963, all I get is a crypted stacktrace. TIA for any hint at a solution.

Alain

(d.java:35) at com.intellij.openapi.fileEditor.a.a.a.(a.java:34) at com.intellij.openapi.fileEditor.a.a.b.createEditor(b.java:56) at com.intellij.openapi.fileEditor.a.f.b(f.java:80) at com.intellij.openapi.fileEditor.a.f.access$900(f.java:40) at com.intellij.openapi.fileEditor.a.f$3.run(f$3.java:1) at com.intellij.openapi.command.b.a.executeCommand(a.java:88) at com.intellij.openapi.fileEditor.a.f.a(f.java:451) at com.intellij.openapi.fileEditor.a.f.openFile(f.java:596) at com.intellij.ide.n.dh$4.run(dh$4.java:6) at com.intellij.ui.bc.a(bc.java:23) at com.intellij.ui.bc$4.keyTyped(bc$4.java:13) at java.awt.AWTEventMulticaster.keyTyped(Unknown Source) at java.awt.Component.processKeyEvent(Unknown Source) at javax.swing.JComponent.processKeyEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at com.intellij.ide.s.a(s.java:43) at com.intellij.ide.s.dispatchEvent(s.java:92) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) ]]>

4 comments

Visiting typecasts still works for me, but I'm subclassing PsiRecursiveElementVisitor, rather than PsiElementVisitor. Not too helpful, I know, but I figured any data point might be a clue.

(Weirdly enough, I've only got one inspection visitor that visits typecasts).

--Dave

0

Dave Griffith wrote:

>Visiting typecasts still works for me, but I'm subclassing PsiRecursiveElementVisitor, rather than PsiElementVisitor. Not too helpful, I know, but I figured any data point might be a clue.

>

Thanks, but it didn't help.

Alain

0

Strangely assertion failed says the project PsiElements of are being visited
is already disposed. Does this say anything to you?

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Alain Ravet" <alain.ravet.list@wanadoo.be> wrote in message
news:bo6g39$t1j$1@is.intellij.net...
>

I guess you made some changes to the Psi structure, and/or the
PsiElementVisitor, since 957.
With 963, I can no longer visit a class TypeCast expression the old -
957 - way, and I'm clueless.

>

This used to work :

>

> public abstract class AbstractVisitor extends PsiElementVisitor
> {
>     public void visitReferenceExpression(PsiReferenceExpression
> i_psiReferenceExpression) {
>
>     }
>
>     public abstract void visitElement(PsiElement i_element);
>
>     protected void doVisitChildren(PsiElement i_theElement)
>     {
>         if (i_theElement==null)
>             return;
>
>         final PsiElement[] theChildren = i_theElement.getChildren();
>         for (int i1 = 0; i1 < theChildren.length; i1++) {
>             visitElement(theChildren[i1]);
>         }
>     }
> }
>
> ]]>

>

and

>

 public abstract class TypeCastExpressionVisitor
>         extends AbstractVisitor
> {
>     public void visitElement(PsiElement i_element)
>     {
>         if (i_element instanceof PsiTypeCastExpression) {
>             visitTypeCastExpression((PsiTypeCastExpression) i_element);
>         }
>         else {
>             doVisitChildren(i_element);
>         }
>     }
>
>     public abstract void visitTypeCastExpression(PsiTypeCastExpression
> i_psiTypeCastExpression) ;
> }
> ]]>

>
>

With 963, all I get is a crypted stacktrace. TIA for any hint at a

solution.
>

Alain

>

Error message: Assertion failed > java.lang.Throwable > at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:2) > at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:21) > at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:91) > at com.intellij.psi.impl.e.a.q.e(q.java:251) > at com.intellij.psi.impl.e.a.j.d(j.java:51) > at com.intellij.psi.impl.e.a.j.a(j.java:63) > at com.intellij.psi.impl.z.a(z.java:283) > at com.intellij.psi.impl.z.a(z.java:86) > at com.intellij.psi.impl.source.k.a(k.java:0) > at com.intellij.psi.impl.source.a.r.a(r.java:109) > at com.intellij.psi.impl.source.p.getChildren(p.java:78) > at > ravet.intellij.commons.visitors.AbstractVisitor.doVisitChildren(AbstractVisi tor.java:20) > at > ravet.intellij.commons.visitors.TypeCastExpressionVisitor.visitElement(TypeC astExpressionVisitor.java:15) > at > com.intellij.psi.JavaElementVisitor.visitFile(JavaElementVisitor.java:39) > at > ravet.intellij.plugins.camouflagePlugin.actions.AutomaticClassMultiFolder.ca mouflageTypecasts(AutomaticClassMultiFolder.java:157) > at > ravet.intellij.plugins.camouflagePlugin.actions.AutomaticClassMultiFolder.pr ocessTheFile(AutomaticClassMultiFolder.java:51) > at > ravet.intellij.plugins.camouflagePlugin.actions.AutomaticClassMultiFolder.ed itorCreated(AutomaticClassMultiFolder.java:34) > at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at com.intellij.util.EventUtil$2.dispatchToListener(EventUtil.java:5) > at > com.intellij.util.EventListenerList.dispatch(EventListenerList.java:31) > at com.intellij.util.EventUtil$1.invoke(EventUtil.java:3) > at $Proxy14.editorCreated(Unknown Source) > at com.intellij.openapi.editor.a.d.a(d.java:3) > at com.intellij.openapi.editor.a.d.createEditor(d.java:32) > at com.intellij.openapi.fileEditor.a.a.d.o(d.java:33) > at com.intellij.openapi.fileEditor.a.a.d.(d.java:35) > at com.intellij.openapi.fileEditor.a.a.a.(a.java:34) > at com.intellij.openapi.fileEditor.a.a.b.createEditor(b.java:56) > at com.intellij.openapi.fileEditor.a.f.b(f.java:80) > at com.intellij.openapi.fileEditor.a.f.access$900(f.java:40) > at com.intellij.openapi.fileEditor.a.f$3.run(f$3.java:1) > at com.intellij.openapi.command.b.a.executeCommand(a.java:88) > at com.intellij.openapi.fileEditor.a.f.a(f.java:451) > at com.intellij.openapi.fileEditor.a.f.openFile(f.java:596) > at com.intellij.ide.n.dh$4.run(dh$4.java:6) > at com.intellij.ui.bc.a(bc.java:23) > at com.intellij.ui.bc$4.keyTyped(bc$4.java:13) > at java.awt.AWTEventMulticaster.keyTyped(Unknown Source) > at java.awt.Component.processKeyEvent(Unknown Source) > at javax.swing.JComponent.processKeyEvent(Unknown Source) > at java.awt.Component.processEvent(Unknown Source) > at java.awt.Container.processEvent(Unknown Source) > at java.awt.Component.dispatchEventImpl(Unknown Source) > at java.awt.Container.dispatchEventImpl(Unknown Source) > at java.awt.Component.dispatchEvent(Unknown Source) > at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source) > at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source) > at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown > Source) > at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown > Source) > at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source) > at java.awt.Component.dispatchEventImpl(Unknown Source) > at java.awt.Container.dispatchEventImpl(Unknown Source) > at java.awt.Window.dispatchEventImpl(Unknown Source) > at java.awt.Component.dispatchEvent(Unknown Source) > at java.awt.EventQueue.dispatchEvent(Unknown Source) > at com.intellij.ide.s.a(s.java:43) > at com.intellij.ide.s.dispatchEvent(s.java:92) > at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) > at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) > at java.awt.EventDispatchThread.pumpEvents(Unknown Source) > at java.awt.EventDispatchThread.pumpEvents(Unknown Source) > at java.awt.EventDispatchThread.run(Unknown Source) > ]]>

>


0

Maxim Shafirov (JetBrains) wrote:

>Strangely assertion failed says the project PsiElements of are being visited
>is already disposed. Does this say anything to you?

>

Nope.
FYI,

  • the plugin doesn't modify the code/tree at all : all is done by adding

FoldRegions

  • the troublesome action is called in

editorCreated() of an EditorFactoryListener.

  • I suspect it also happens on classes where there is no typecast.


Could it be that I start my psi tree visit while IDEA is still modifying it?

I posted a someway related question a few days ago :
problem: EditorFactoryListener comes to early
http://www.intellij.net/forums/thread.jsp?forum=23&thread=50938

Alain

0

Please sign in to leave a comment.