Amy Pearson created NETBEANS-4282:
-------------------------------------
Summary: Expanding for template between package statement and
class declaration
Key: NETBEANS-4282
URL: https://issues.apache.org/jira/browse/NETBEANS-4282
Project: NetBeans
Issue Type: Bug
Components: java - Editor
Affects Versions: 12.0
Environment: Mac OS Mojave 10.14.6
Reporter: Amy Pearson
h3. Steps
# Open Code Templates setting
# select _for_ template
# switch to Contexts tab
# select _COMPILATION_UNIT_ and unselect _IF_ context
# Try expanding _for_ template between package statement and class declaration
# Try expanding _for_ template just behind code _if(true)_
h3. Expected result:
_for_ template can by now expanded in the compilation unit context (in the
file, outside the class) and cannot be expanded after if statement. Note that
if there is {} after _if_ statement that the context inside the brackets is
BLOCK, not IF. The code completion will provide the template if it is
expandable in actual context.
Error:
java.lang.AssertionErrorjava.lang.AssertionError at
com.sun.tools.javac.util.Assert.error(Assert.java:155) at
com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:62) at
com.sun.tools.javac.comp.Annotate.queueScanTreeAndTypeAnnotate(Annotate.java:1024)
at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:1199) at
com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:972) at
com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674) at
com.sun.tools.javac.comp.Attr.attribStat(Attr.java:754) at
com.sun.tools.javac.comp.Attr.attribStats(Attr.java:778) at
com.sun.tools.javac.comp.Attr.visitForLoop(Attr.java:1381) at
com.sun.tools.javac.tree.JCTree$JCForLoop.accept(JCTree.java:1136) at
com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674) at
com.sun.tools.javac.comp.Attr.attribStat(Attr.java:754) at
com.sun.tools.javac.comp.Attr.attribStats(Attr.java:778) at
com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1357) at
org.netbeans.lib.nbjavac.services.NBAttr.visitBlock(NBAttr.java:78) at
com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1036) at
com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674) at
com.sun.tools.javac.comp.Attr.attribStat(Attr.java:754) at
com.sun.tools.javac.comp.Attr.attribStatToTree(Attr.java:430) at
org.netbeans.lib.nbjavac.services.NBAttr.attributeAndCapture(NBAttr.java:113)
at
org.netbeans.api.java.source.TreeUtilities.attributeTreeTo(TreeUtilities.java:920)
at
org.netbeans.api.java.source.TreeUtilities.attributeTreeTo(TreeUtilities.java:836)
at
org.netbeans.modules.editor.java.JavaCodeTemplateProcessor.newVarName(JavaCodeTemplateProcessor.java:880)
at
org.netbeans.modules.editor.java.JavaCodeTemplateProcessor.getProposedValue(JavaCodeTemplateProcessor.java:514)
at
org.netbeans.modules.editor.java.JavaCodeTemplateProcessor.updateDefaultValues(JavaCodeTemplateProcessor.java:145)
at
org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.processTemplate(CodeTemplateInsertHandler.java:225)
at
org.netbeans.lib.editor.codetemplates.CodeTemplateManagerOperation.insert(CodeTemplateManagerOperation.java:273)
at
org.netbeans.lib.editor.codetemplates.api.CodeTemplate.insert(CodeTemplate.java:82)
at
org.netbeans.lib.editor.codetemplates.AbbrevDetection.expand(AbbrevDetection.java:517)
at
org.netbeans.lib.editor.codetemplates.AbbrevDetection.expand(AbbrevDetection.java:411)
at
org.netbeans.lib.editor.codetemplates.AbbrevDetection.checkExpansionKeystroke(AbbrevDetection.java:315)
at
org.netbeans.lib.editor.codetemplates.AbbrevDetection.keyTyped(AbbrevDetection.java:275)
at
java.desktop/java.awt.AWTEventMulticaster.keyTyped(AWTEventMulticaster.java:248)
at
java.desktop/java.awt.AWTEventMulticaster.keyTyped(AWTEventMulticaster.java:247)
at
java.desktop/java.awt.AWTEventMulticaster.keyTyped(AWTEventMulticaster.java:247)
at
java.desktop/java.awt.AWTEventMulticaster.keyTyped(AWTEventMulticaster.java:247)
at java.desktop/java.awt.Component.processKeyEvent(Component.java:6587) at
java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2849) at
java.desktop/java.awt.Component.processEvent(Component.java:6409) at
java.desktop/java.awt.Container.processEvent(Container.java:2263) at
java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008) at
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at
java.desktop/java.awt.Component.dispatchEvent(Component.java:4840) at
java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1950)
at
java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:870)
at
java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1139)
at
java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1009)
at
java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:835)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4889) at
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at
java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2762) at
java.desktop/java.awt.Component.dispatchEvent(Component.java:4840) at
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) at
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at
java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at
java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743) at
java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at
org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)[catch]
at
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists