When using "logt" inside a static method of the following class structure, the appended exception is thrown (using IDEA 10.0.1).
class Parent {
private static Logger log = ...
}
class Actual extends Parent {
private static void myMethod() {
logt
}
}
----
Exception:
Element: class com.intellij.psi.impl.source.tree.java.PsiIdentifierImpl: Element: class com.intellij.psi.impl.source.tree.java.PsiIdentifierImpl
com.intellij.psi.PsiInvalidElementAccessException: Element: class com.intellij.psi.impl.source.tree.java.PsiIdentifierImpl
at com.intellij.psi.impl.source.tree.LeafPsiElement.a(LeafPsiElement.java:95)
at com.intellij.psi.impl.source.tree.LeafPsiElement.getContainingFile(LeafPsiElement.java:84)
at com.intellij.psi.util.PsiUtil.getTopLevelClass(PsiUtil.java:549)
at net.sf.logsupport.util.LoggerFieldBuilder.classForPlace(LoggerFieldBuilder.java:39)
at net.sf.logsupport.util.LoggerFieldBuilder.access$000(LoggerFieldBuilder.java:34)
at net.sf.logsupport.util.LoggerFieldBuilder$1.run(LoggerFieldBuilder.java:112)
at net.sf.logsupport.livetemplates.TemplatePostProcessor.processText(TemplatePostProcessor.java:78)
at com.intellij.codeInsight.template.impl.TemplateState.a(TemplateState.java:971)
at com.intellij.codeInsight.template.impl.TemplateState.access$2100(TemplateState.java:71)
at com.intellij.codeInsight.template.impl.TemplateState$5.run(TemplateState.java:371)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:834)
at com.intellij.codeInsight.template.impl.TemplateState.doReformat(TemplateState.java:376)
at com.intellij.codeInsight.template.impl.TemplateState$4.run(TemplateState.java:337)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:834)
at com.intellij.codeInsight.template.impl.TemplateState.a(TemplateState.java:327)
at com.intellij.codeInsight.template.impl.TemplateState.start(TemplateState.java:308)
at com.intellij.codeInsight.template.impl.TemplateManagerImpl$4.run(TemplateManagerImpl.java:413)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:108)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:91)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:79)
at com.intellij.codeInsight.template.impl.TemplateManagerImpl.startTemplateWithPrefix(TemplateManagerImpl.java:402)
at com.intellij.codeInsight.template.impl.TemplateManagerImpl.startNonCustomTemplates(TemplateManagerImpl.java:344)
at com.intellij.codeInsight.template.impl.TemplateManagerImpl.startTemplate(TemplateManagerImpl.java:256)
at com.intellij.codeInsight.template.impl.TemplateManagerImpl.startTemplate(TemplateManagerImpl.java:122)
at com.intellij.codeInsight.template.impl.editorActions.TabHandler.executeWriteAction(TabHandler.java:45)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:52)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:834)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.execute(EditorWriteActionHandler.java:36)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:77)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:115)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:88)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:63)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:524)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:564)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.d(IdeKeyEventDispatcher.java:444)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:197)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:491)
at com.intellij.ide.IdeEventQueue.b(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)
Update: The same error occurs when calling logt in a non-static context. The problem may be related to the fact that the project is a multi module maven project and "Parent" is located in another module.