Element from alien project

Answered

Hello!

I got very strange exception. I had two opened projects, and when I closed one of them, the second got the exception.

java.lang.IllegalArgumentException: Element from alien project: 1329573106 expected: 1568544590
    at com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl.ensureMyProject(SmartPointerManagerImpl.java:101)
    at com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl.createSmartPsiElementPointer(SmartPointerManagerImpl.java:83)
    at com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl.createSmartPsiElementPointer(SmartPointerManagerImpl.java:74)
    at com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl.createSmartPsiElementPointer(SmartPointerManagerImpl.java:69)
    at com.haulmont.studio.backend.model.EntityPsi.lambda$new$0(SourceFile:48)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:959)
    at com.haulmont.studio.backend.util.MetadataUtil.ra(SourceFile:984)
    at com.haulmont.studio.backend.model.EntityPsi.<init>(SourceFile:47)
    at com.haulmont.studio.backend.model.EntityPsi.lambda$null$1(SourceFile:56)
    at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:140)
    at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
    at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
    at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:136)
    at com.haulmont.studio.backend.model.EntityPsi.lambda$getInstance$2(SourceFile:53)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:959)
    at com.haulmont.studio.backend.util.MetadataUtil.ra(SourceFile:984)
    at com.haulmont.studio.backend.model.EntityPsi.getInstance(SourceFile:53)
    at com.haulmont.studio.intellij.ui.entity.EntityPropertiesEditor.lambda$activatePanel$0(SourceFile:75)
    at com.intellij.openapi.application.ReadAction.lambda$run$1(ReadAction.java:53)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:973)
    at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:57)
    at com.intellij.openapi.application.ReadAction.run(ReadAction.java:53)
    at com.haulmont.studio.intellij.ui.entity.EntityPropertiesEditor.activatePanel(SourceFile:68)
    at com.haulmont.studio.intellij.ui.entity.EntityPropertiesEditor.activatePanel(SourceFile:46)
    at com.haulmont.studio.intellij.ui.AbstractVaadinEditor.lambda$null$1(SourceFile:87)
    at com.vaadin.ui.UI.accessSynchronously(UI.java:1392)
    at com.haulmont.studio.intellij.ui.AbstractVaadinEditor.trySynchronously(SourceFile:139)
    at com.haulmont.studio.intellij.ui.AbstractVaadinEditor.lambda$tryActivate$2(SourceFile:86)
    at com.haulmont.studio.intellij.ui.AbstractVaadinEditor.tryUntilSuccess(SourceFile:228)
    at com.haulmont.studio.intellij.ui.AbstractVaadinEditor.tryActivate(SourceFile:85)
    at com.haulmont.studio.intellij.ui.AbstractVaadinEditor.selectNotify(SourceFile:80)
    at com.intellij.openapi.fileEditor.impl.EditorTabbedContainer$2.selectionChanged(EditorTabbedContainer.java:151)
    at com.intellij.ui.tabs.impl.JBTabsImpl.fireSelectionChanged(JBTabsImpl.java:951)
    at com.intellij.ui.tabs.impl.JBTabsImpl.executeSelectionChange(JBTabsImpl.java:907)
    at com.intellij.ui.tabs.impl.JBTabsImpl.access$1900(JBTabsImpl.java:52)
    at com.intellij.ui.tabs.impl.JBTabsImpl$9.run(JBTabsImpl.java:866)
    at com.intellij.openapi.fileEditor.impl.EditorTabbedContainer.lambda$null$2(EditorTabbedContainer.java:163)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:212)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:178)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:168)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:154)
    at com.intellij.openapi.fileEditor.impl.EditorTabbedContainer.lambda$new$3(EditorTabbedContainer.java:161)
    at com.intellij.ui.tabs.impl.JBTabsImpl._setSelected(JBTabsImpl.java:862)
    at com.intellij.ui.tabs.impl.JBTabsImpl.removeTab(JBTabsImpl.java:2515)
    at com.intellij.ui.tabs.impl.JBTabsImpl.removeTab(JBTabsImpl.java:2482)
    at com.intellij.openapi.fileEditor.impl.EditorTabbedContainer.removeTabAt(EditorTabbedContainer.java:281)
    at com.intellij.openapi.fileEditor.impl.EditorWindow.lambda$closeFile$1(EditorWindow.java:235)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.runChange(FileEditorManagerImpl.java:1660)
    at com.intellij.openapi.fileEditor.impl.EditorWindow.closeFile(EditorWindow.java:215)
    at com.intellij.openapi.fileEditor.impl.EditorsSplitters.closeFile(EditorsSplitters.java:517)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.lambda$closeFileImpl$3(FileEditorManagerImpl.java:637)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.runChange(FileEditorManagerImpl.java:1660)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.closeFileImpl(FileEditorManagerImpl.java:637)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.lambda$closeFile$2(FileEditorManagerImpl.java:631)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:178)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:168)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:154)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.closeFile(FileEditorManagerImpl.java:631)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.closeFile(FileEditorManagerImpl.java:625)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.closeAllFiles(FileEditorManagerImpl.java:1917)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl$3.projectClosed(FileEditorManagerImpl.java:174)
    at sun.reflect.GeneratedMethodAccessor966.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:117)
    at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:397)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:358)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:347)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:331)
    at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:322)
    at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:29)
    at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:196)
    at com.sun.proxy.$Proxy60.stateChanged(Unknown Source)
    at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.fireStateChanged(ToolWindowManagerImpl.java:1559)
    at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.execute(ToolWindowManagerImpl.java:587)
    at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.execute(ToolWindowManagerImpl.java:576)
    at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.projectClosed(ToolWindowManagerImpl.java:553)
    at com.intellij.openapi.wm.impl.ToolWindowManagerImpl$2.projectClosed(ToolWindowManagerImpl.java:162)
    at sun.reflect.GeneratedMethodAccessor966.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:117)
    at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:397)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:358)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:347)
    at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:322)
    at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:29)
    at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:196)
    at com.sun.proxy.$Proxy219.cubaProjectClosed(Unknown Source)
    at com.haulmont.studio.intellij.project.resolve.CubaProjectWatcher.projectClosed(SourceFile:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:117)
    at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:397)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:358)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:347)
    at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:324)
    at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:29)
    at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:196)
    at com.sun.proxy.$Proxy21.projectClosed(Unknown Source)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.fireProjectClosed(ProjectManagerImpl.java:809)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.lambda$closeProject$15(ProjectManagerImpl.java:698)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1057)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.closeProject(ProjectManagerImpl.java:695)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.closeAndDispose(ProjectManagerImpl.java:719)
    at com.intellij.ide.impl.ProjectUtil.closeAndDispose(ProjectUtil.java:97)
    at com.intellij.ide.actions.CloseProjectAction.actionPerformed(CloseProjectAction.java:42)
    at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:258)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:275)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:287)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:283)
    at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:106)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:277)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:111)
    at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
    at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
    at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:111)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:522)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:35)
    at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:544)
    at java.awt.Component.processMouseEvent(Component.java:6548)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
    at java.awt.Component.processEvent(Component.java:6313)
    at java.awt.Container.processEvent(Container.java:2237)
    at java.awt.Component.dispatchEventImpl(Component.java:4903)
    at java.awt.Container.dispatchEventImpl(Container.java:2295)
    at java.awt.Component.dispatchEvent(Component.java:4725)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
    at java.awt.Container.dispatchEventImpl(Container.java:2281)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4725)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:737)
    at java.awt.EventQueue$4.run(EventQueue.java:735)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:719)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:664)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Is there any ideas how to avoid it in future?

0
5 comments

How about setting a breakpoint in com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl#ensureMyProject to the throw statement and just run under debugger?

 

0

I will set a breakpoint, but I don't know how to reproduce the issue.

0

That complicates things. But you can just continue development and sometime it will happen :)

Looks like you are using smartpointermanager from one project to create a smartpointer for psi element from another project.

0

I also suppose so) But I cannot understand, how it is possible.

0

There's several issues here. I've filed https://youtrack.jetbrains.com/issue/IDEA-209724 and https://youtrack.jetbrains.com/issue/IDEA-209725. On your side, you could avoid PSI operations and smart pointer creation on editor tab change. This would get rid of this exception and also might improve UI responsiveness.

0

Please sign in to leave a comment.