Lisp custom language plugin
Добрый день. Занимаюсь разработкой плагина для Лиспа и столкнулся с такой проблемаой при рефакторинге (ренейм) в дебаге:
Hello. Im working on Lisp plugin and received this stacktrace in debug when I tried to rename function:
[1993703] ERROR - com.intellij.ide.IdeEventQueue - Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(56,140),absolute(716,562),button=1,modifiers=Button1,clickCount=1] on dialog0
java.lang.NullPointerException
at com.bifit.ibank.sdk.plugin.idea.lisp.parser.psi.impl.symbols.SymbolImpl.handleElementRename(SymbolImpl.java:448)
at com.intellij.refactoring.rename.RenameUtil.rename(RenameUtil.java:241)
at com.intellij.refactoring.rename.RenameUtil.doRenameGenericNamedElement(RenameUtil.java:205)
at com.intellij.refactoring.rename.RenamePsiElementProcessor.renameElement(RenamePsiElementProcessor.java:57)
at com.intellij.refactoring.rename.RenameUtil.doRename(RenameUtil.java:172)
at com.intellij.refactoring.rename.RenameProcessor.performRefactoring(RenameProcessor.java:327)
at com.intellij.refactoring.BaseRefactoringProcessor$7.run(BaseRefactoringProcessor.java:384)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:844)
at com.intellij.refactoring.BaseRefactoringProcessor.doRefactoring(BaseRefactoringProcessor.java:381)
at com.intellij.refactoring.BaseRefactoringProcessor.access$000(BaseRefactoringProcessor.java:65)
at com.intellij.refactoring.BaseRefactoringProcessor$3.run(BaseRefactoringProcessor.java:259)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:115)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:91)
at com.intellij.refactoring.BaseRefactoringProcessor.execute(BaseRefactoringProcessor.java:256)
at com.intellij.refactoring.BaseRefactoringProcessor.doRun(BaseRefactoringProcessor.java:200)
at com.intellij.refactoring.rename.RenameProcessor.doRun(RenameProcessor.java:116)
at com.intellij.refactoring.BaseRefactoringProcessor.run(BaseRefactoringProcessor.java:451)
at com.intellij.refactoring.ui.RefactoringDialog.invokeRefactoring(RefactoringDialog.java:160)
at com.intellij.refactoring.rename.RenameDialog.performRename(RenameDialog.java:277)
at com.intellij.refactoring.rename.RenameDialog.doAction(RenameDialog.java:253)
at com.intellij.refactoring.ui.RefactoringDialog.doRefactorAction(RefactoringDialog.java:79)
at com.intellij.refactoring.ui.RefactoringDialog$RefactorAction.actionPerformed(RefactoringDialog.java:138)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:652)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:501)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:404)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:368)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
at java.awt.Dialog$1.run(Dialog.java:1046)
at java.awt.Dialog$3.run(Dialog.java:1098)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1096)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:675)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:412)
at com.intellij.openapi.ui.DialogWrapper.showAndGetOk(DialogWrapper.java:1175)
at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1160)
at com.intellij.refactoring.rename.PsiElementRenameHandler.rename(PsiElementRenameHandler.java:161)
at com.intellij.refactoring.rename.PsiElementRenameHandler.rename(PsiElementRenameHandler.java:132)
at com.intellij.refactoring.rename.PsiElementRenameHandler.invoke(PsiElementRenameHandler.java:85)
at com.intellij.refactoring.rename.PsiElementRenameHandler.invoke(PsiElementRenameHandler.java:61)
at com.intellij.refactoring.actions.BaseRefactoringAction.actionPerformed(BaseRefactoringAction.java:84)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter$1.run(ActionMenuItem.java:242)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:645)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:104)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:228)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:92)
at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:512)
at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:44)
at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:532)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:652)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:501)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:404)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:368)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[1993703] ERROR - com.intellij.ide.IdeEventQueue - IntelliJ IDEA 10.0.2 Build #IC-103.72
[1993703] ERROR - com.intellij.ide.IdeEventQueue - JDK: 1.6.0_21
[1993703] ERROR - com.intellij.ide.IdeEventQueue - VM: Java HotSpot(TM) Client VM
[1993703] ERROR - com.intellij.ide.IdeEventQueue - Vendor: Sun Microsystems Inc.
[1993703] ERROR - com.intellij.ide.IdeEventQueue - OS: Windows XP
[1993703] ERROR - com.intellij.ide.IdeEventQueue - Last Action: RenameElement
Вопрос вот в чем: это ошибка в реализации плагина (если да, то в чем она может быть?) или ошибка ИДЕИ (если да, то можно ли как-то ее обойти?).
Question: is it my plugin error (if Yes, then what error it is?) or its IDEA error (if Yes, then how can I avoid it?).
Sourcecode:
public PsiElement handleElementRename(String newName) throws IncorrectOperationException {
PsiElement nameElement = getReferenceNameElement();
if (nameElement != null) {
ASTNode node = nameElement.getNode();
ASTNode newNode = LispPsiElementFactory.getInstance(getProject()).createSymbolNodeFromText(newName);
assert newNode != null && node != null;
node.getTreeParent().replaceChild(node, newNode);
}
return this;
}
Thanks.
请先登录再写评论。
Hello Dmitriy,
The exception happens in your code, so it's most likely a bug in your plugin.
In order to provide more information, we need to know which line is line 448.
Note that this is an English language forum.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
public PsiElement handleElementRename(String newName) throws IncorrectOperationException {
PsiElement nameElement = getReferenceNameElement();
if (nameElement != null) {
ASTNode currentNode = getNode();
ASTNode newNode = LispPsiElementFactory.getInstance(getProject()).createSymbolNodeFromText(newName);
currentNode.getTreeParent().replaceChild(currentNode, newNode);
}
return this;
}
In this line.
Hello Dmitriy,
How is LispPsiElementFactory registered?
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
import com.intellij.openapi.project.Project;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.lang.ASTNode;
public abstract class LispPsiElementFactory {
public static LispPsiElementFactory getInstance(Project project) {
return ServiceManager.getService(project, LispPsiElementFactory.class);
}
public abstract ASTNode createSymbolNodeFromText(@NotNull String newName);
}
Have a problem in ServiceManager.getService(project, LispPsiFactory.class);
project is not null, in PicoContainer is not null, LispFileClass is not null.
What a problem?
Update:
in LispPsiFactory.getInstance(getProject()) I cannot receive an instance of LispPsiFactory coz getProject() returns project of debug instance of IDEA and not Plugin project.
What can I do with it?
Hello Dmitriy,
Is LispPsiFactory registered as an application or a project service?
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Thanks. It works.
Another one question. In debug mode while debug instance of IDEa is running i receiving this stacktrace (without any actions, just over some time):
ERROR: gnu/trove/THashSet
java.lang.NoClassDefFoundError: gnu/trove/THashSet
at com.intellij.openapi.util.Disposer.<clinit>(Disposer.java:33)
at com.intellij.util.Timed.disposeTimed(Timed.java:96)
at com.intellij.util.Timed$1.run(Timed.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: gnu.trove.THashSet
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 12 more
What is the problem?
P.S. Sorry for my english.
Please see http://devnet.jetbrains.net/message/5298857#5298857
Thanks!
After update i received new stacktrace with no actions in debug instance of IDEA:
ERROR - tellij.psi.impl.PsiManagerImpl - Argument 1 for @NotNull parameter of com/intellij/psi/util/PsiTreeUtil.isAncestor must not be null
java.lang.IllegalArgumentException: Argument 1 for @NotNull parameter of com/intellij/psi/util/PsiTreeUtil.isAncestor must not be null
at com.intellij.psi.util.PsiTreeUtil.isAncestor(PsiTreeUtil.java)
at idea.plugin.psiviewer.controller.project.EditorListener.isElementChangedUnderViewerRoot(EditorListener.java:106)
at idea.plugin.psiviewer.controller.project.EditorListener.updateTreeFromPsiTreeChange(EditorListener.java:96)
at idea.plugin.psiviewer.controller.project.EditorListener.access$000(EditorListener.java:46)
at idea.plugin.psiviewer.controller.project.EditorListener$1.propertyChanged(EditorListener.java:89)
at com.intellij.psi.impl.PsiManagerImpl.fireEvent(PsiManagerImpl.java:645)
at com.intellij.psi.impl.PsiManagerImpl.propertyChanged(PsiManagerImpl.java:573)
at com.intellij.psi.impl.file.impl.FileManagerImpl$FileTypesChanged.run(FileManagerImpl.java:278)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:844)
at com.intellij.psi.impl.file.impl.FileManagerImpl.handleFileTypesChange(FileManagerImpl.java:287)
at com.intellij.psi.impl.file.impl.FileManagerImpl.recalcAllViewProviders(FileManagerImpl.java:141)
at com.intellij.psi.impl.file.impl.FileManagerImpl.access$200(FileManagerImpl.java:67)
at com.intellij.psi.impl.file.impl.FileManagerImpl$2.exitDumbMode(FileManagerImpl.java:119)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:99)
at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:215)
at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:221)
at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:207)
at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:204)
at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:197)
at com.intellij.util.messages.impl.MessageBusImpl.access$000(MessageBusImpl.java:42)
at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:123)
at $Proxy57.exitDumbMode(Unknown Source)
at com.intellij.openapi.project.DumbServiceImpl.updateFinished(DumbServiceImpl.java:201)
at com.intellij.openapi.project.DumbServiceImpl.access$1000(DumbServiceImpl.java:55)
at com.intellij.openapi.project.DumbServiceImpl$IndexUpdateRunnable$1$3.run(DumbServiceImpl.java:369)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:652)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:505)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:404)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:368)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Before update i never catch this error.
That is an error from the PsiViewer plugin
And so?
Plugin was not updated since 2005. Plugin web-page redirecting to Developer Community main page (looks like web-page was deleted long time ago).
And the last: i was not receive this error before 10.0.3 update.
I'm just meaning that the error belongs to another third-party plugin and you can see that it has been reported in the comments section.
You could try contacting its authors.
U was right!
JavaDoc Browser plugin caused this error.
Thanks.
I'm actually going to be updating the PsiViewer plugin and releasing an updated version of it shortly, hopefully this weekend.
Thanks!
Lol I already did that.
http://plugins.intellij.net/plugin/?idea&id=6025
Hello again.
Have a problem with "Find usages...":
1. Ctrlshiftf7 on a definition works, highlighting all the right usages.
2. Ctrlshiftf7 on a usage works, highlighting all the right usages.
3. Ctrl+f7 works, but highlightingonly definition.
4. Using "Find usages..." on a difinition find only definition.
4. Using "Find usages..." on a usage says "No usages found".
What a problem can be with it?
Excuse me, I'd ask this if I could find any other way to contact you, Dmitriy, but I couldn't. Would you please tell if there's any progress on your LISP plugin, probably some open source platform you develop it on so people can participate? If anything (after all, this is not an appropriate place to converse), my e-mail is trueDOTneu at google mail.