question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NoSuchElementException when renaming function

See original GitHub issue

When refactor renaming a function intellij-elm crashes. 😢

I was in the middle of renaming this function, by Shift + F6 with the cursor inside initTestTile in the top definition line. It crashes in the middle of me renaming it initTestTileWaiting

initTestTile : Reaction -> Color -> Int -> Int -> ( Int, Tile )
initTestTile reaction color x y =
    ( positionKey x y
    , TileWaiting
        (TileState
            reaction
            color
            (IVec2 x y)
        )
        (initView color (Vec2 (toFloat x) (toFloat y)))
    )

When it crashes the following code is replaced in my file.

initTestTileWaiting : Reaction -> Color -> Int -> Int -> ( Int, Tile )
in reaction color x y =
    ( positionKey x y
    , TileWaiting
        (TileState
            reaction
            color
            (IVec2 x y)
        )
        (initView color (Vec2 (toFloat x) (toFloat y)))
    )

Note in instead of initTestTileWaiting in the second line after the definition. At this point the editor is broken and I must Cmd+Z to get back to an editable state.

null
java.util.NoSuchElementException
	at java.util.LinkedList.removeFirst(LinkedList.java:270)
	at java.util.LinkedList.pop(LinkedList.java:801)
	at org.elm.lang.core.lexer.ElmLayoutLexer.advance(ElmLayoutLexer.kt:160)
	at com.intellij.lang.impl.TokenSequence$Builder.performLexing(TokenSequence.java:86)
	at com.intellij.lang.impl.PsiBuilderImpl.a(PsiBuilderImpl.java:202)
	at com.intellij.lang.impl.PsiBuilderImpl.<init>(PsiBuilderImpl.java:175)
	at com.intellij.lang.impl.PsiBuilderImpl.<init>(PsiBuilderImpl.java:130)
	at com.intellij.lang.impl.PsiBuilderFactoryImpl.createBuilder(PsiBuilderFactoryImpl.java:52)
	at com.intellij.psi.tree.ILazyParseableElementType.doParseContents(ILazyParseableElementType.java:86)
	at com.intellij.psi.tree.IFileElementType.parseContents(IFileElementType.java:49)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.ensureParsed(LazyParseableElement.java:192)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.getFirstChildNode(LazyParseableElement.java:240)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.getFirstChildNode(LazyParseableElement.java:39)
	at com.intellij.psi.impl.source.text.BlockSupportImpl.isReplaceWholeNode(BlockSupportImpl.java:331)
	at com.intellij.psi.impl.source.text.BlockSupportImpl.mergeTrees(BlockSupportImpl.java:277)
	at com.intellij.psi.impl.source.text.BlockSupportImpl.makeFullParse(BlockSupportImpl.java:216)
	at com.intellij.psi.impl.source.text.BlockSupportImpl.reparseRange(BlockSupportImpl.java:92)
	at com.intellij.psi.impl.DocumentCommitThread.doCommit(DocumentCommitThread.java:741)
	at com.intellij.psi.impl.DocumentCommitThread.lambda$commitUnderProgress$4(DocumentCommitThread.java:522)
	at com.intellij.psi.impl.DocumentCommitThread.commitUnderProgress(DocumentCommitThread.java:545)
	at com.intellij.psi.impl.DocumentCommitThread.commitSynchronously(DocumentCommitThread.java:441)
	at com.intellij.psi.impl.PsiDocumentManagerBase.lambda$doCommit$0(PsiDocumentManagerBase.java:455)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1003)
	at com.intellij.psi.impl.PsiDocumentManagerBase.doCommit(PsiDocumentManagerBase.java:467)
	at com.intellij.psi.impl.PsiDocumentManagerBase.commitDocument(PsiDocumentManagerBase.java:308)
	at com.intellij.codeInsight.template.impl.TemplateState.b(TemplateState.java:829)
	at com.intellij.codeInsight.template.impl.TemplateState.a(TemplateState.java:726)
	at com.intellij.openapi.project.DumbService.withAlternativeResolveEnabled(DumbService.java:291)
	at com.intellij.codeInsight.template.impl.TemplateState.f(TemplateState.java:725)
	at com.intellij.openapi.command.WriteCommandAction$1.run(WriteCommandAction.java:252)
	at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:234)
	at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
	at com.intellij.openapi.command.WriteCommandAction.lambda$null$1(WriteCommandAction.java:171)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1003)
	at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$2(WriteCommandAction.java:170)
	at com.intellij.openapi.command.WriteCommandAction.lambda$doExecuteCommand$4(WriteCommandAction.java:210)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.a(CoreCommandProcessor.java:141)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:119)
	at com.intellij.openapi.command.WriteCommandAction.doExecuteCommand(WriteCommandAction.java:212)
	at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:168)
	at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:151)
	at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:254)
	at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:241)
	at com.intellij.codeInsight.template.impl.TemplateState.calcResults(TemplateState.java:708)
	at com.intellij.codeInsight.template.impl.TemplateState.q(TemplateState.java:518)
	at com.intellij.codeInsight.template.impl.TemplateState.access$600(TemplateState.java:66)
	at com.intellij.codeInsight.template.impl.TemplateState$4.a(TemplateState.java:148)
	at com.intellij.codeInsight.template.impl.TemplateState$4.beforeCommandFinished(TemplateState.java:154)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.fireCommandFinished(CoreCommandProcessor.java:203)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.finishCommand(CoreCommandProcessor.java:187)
	at com.intellij.openapi.command.impl.CommandProcessorImpl.finishCommand(CommandProcessorImpl.java:53)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.a(CoreCommandProcessor.java:155)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:109)
	at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.e(EditorImpl.java:3509)
	at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.mousePressed(EditorImpl.java:3439)
	at java.awt.Component.processMouseEvent(Component.java:6538)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6306)
	at java.awt.Container.processEvent(Container.java:2237)
	at java.awt.Component.dispatchEventImpl(Component.java:4897)
	at java.awt.Container.dispatchEventImpl(Container.java:2295)
	at java.awt.Component.dispatchEvent(Component.java:4719)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4523)
	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:4719)
	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.j(IdeEventQueue.java:822)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:646)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)
	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)


java.util.NoSuchElementException
	at java.util.LinkedList.removeFirst(LinkedList.java:270)
	at java.util.LinkedList.pop(LinkedList.java:801)
	at org.elm.lang.core.lexer.ElmLayoutLexer.advance(ElmLayoutLexer.kt:160)
	at com.intellij.lang.impl.TokenSequence$Builder.performLexing(TokenSequence.java:86)
	at com.intellij.lang.impl.PsiBuilderImpl.a(PsiBuilderImpl.java:202)
	at com.intellij.lang.impl.PsiBuilderImpl.<init>(PsiBuilderImpl.java:175)
	at com.intellij.lang.impl.PsiBuilderImpl.<init>(PsiBuilderImpl.java:130)
	at com.intellij.lang.impl.PsiBuilderFactoryImpl.createBuilder(PsiBuilderFactoryImpl.java:52)
	at com.intellij.psi.tree.ILazyParseableElementType.doParseContents(ILazyParseableElementType.java:86)
	at com.intellij.psi.tree.IFileElementType.parseContents(IFileElementType.java:49)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.ensureParsed(LazyParseableElement.java:192)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.getFirstChildNode(LazyParseableElement.java:240)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.getFirstChildNode(LazyParseableElement.java:39)
	at com.intellij.psi.impl.source.text.BlockSupportImpl.isReplaceWholeNode(BlockSupportImpl.java:331)
	at com.intellij.psi.impl.source.text.BlockSupportImpl.mergeTrees(BlockSupportImpl.java:277)
	at com.intellij.psi.impl.source.text.BlockSupportImpl.makeFullParse(BlockSupportImpl.java:216)
	at com.intellij.psi.impl.source.text.BlockSupportImpl.reparseRange(BlockSupportImpl.java:92)
	at com.intellij.psi.impl.DocumentCommitThread.doCommit(DocumentCommitThread.java:741)
	at com.intellij.psi.impl.DocumentCommitThread.lambda$commitUnderProgress$4(DocumentCommitThread.java:522)
	at com.intellij.psi.impl.DocumentCommitThread.commitUnderProgress(DocumentCommitThread.java:545)
	at com.intellij.psi.impl.DocumentCommitThread.commitSynchronously(DocumentCommitThread.java:441)
	at com.intellij.psi.impl.PsiDocumentManagerBase.lambda$doCommit$0(PsiDocumentManagerBase.java:455)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1003)
	at com.intellij.psi.impl.PsiDocumentManagerBase.doCommit(PsiDocumentManagerBase.java:467)
	at com.intellij.psi.impl.PsiDocumentManagerBase.commitDocument(PsiDocumentManagerBase.java:308)
	at com.intellij.psi.impl.PsiDocumentManagerBase.commitAllDocuments(PsiDocumentManagerBase.java:233)
	at com.intellij.refactoring.rename.inplace.InplaceRefactoring$MyTemplateListener.templateCancelled(InplaceRefactoring.java:928)
	at com.intellij.codeInsight.template.impl.TemplateState.k(TemplateState.java:404)
	at com.intellij.codeInsight.template.impl.TemplateState.q(TemplateState.java:515)
	at com.intellij.codeInsight.template.impl.TemplateState.access$600(TemplateState.java:66)
	at com.intellij.codeInsight.template.impl.TemplateState$4.a(TemplateState.java:148)
	at com.intellij.codeInsight.template.impl.TemplateState$4.beforeCommandFinished(TemplateState.java:154)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.fireCommandFinished(CoreCommandProcessor.java:203)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.finishCommand(CoreCommandProcessor.java:187)
	at com.intellij.openapi.command.impl.CommandProcessorImpl.finishCommand(CommandProcessorImpl.java:53)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.a(CoreCommandProcessor.java:155)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:109)
	at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.c(EditorImpl.java:3555)
	at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.mouseReleased(EditorImpl.java:3446)
	at java.awt.Component.processMouseEvent(Component.java:6541)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6306)
	at java.awt.Container.processEvent(Container.java:2237)
	at java.awt.Component.dispatchEventImpl(Component.java:4897)
	at java.awt.Container.dispatchEventImpl(Container.java:2295)
	at java.awt.Component.dispatchEvent(Component.java:4719)
	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:4719)
	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.j(IdeEventQueue.java:822)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:646)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)
	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)

IntelliJ Ultimate 2017.3 Mac 10.13.3

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
klazukacommented, Apr 12, 2018

@robert-wallis I just released 1.0.0 which includes the fix

0reactions
klazukacommented, Mar 21, 2018

That’s a great bug report! Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception in thread "main" java.util.NoSuchElementException
To fix this simply pass your scanner from the "mid_term" class to the method in Act1 (which you have hopefully renamed at this...
Read more >
java.util.NoSuchElementException during ClusterSharding ...
I'm using ClusterSharding, and I deploy two sharding node: A and B. After killing A, I send a request for the entity in...
Read more >
How to Fix the No Such Element Exception in Java - Rollbar
The NoSuchElementException in Java can be thrown by various accessor methods to indicate that the element being requested does not exist.
Read more >
SFTP Jobs Fail with Error: No common elements found
NoSuchElementException: no common elements found. Solution: Upgrade the agent to version 11.4, which supports the following ciphers and MACs: Ciphers:.
Read more >
NoSuchElementException (Java SE 12 & JDK 12 )
Class NoSuchElementException​​ Thrown by various accessor methods to indicate that the element being requested does not exist.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found