apache / apache/grails-intellij-plugin

IOE at com.intellij.psi.impl.PsiJavaParserFacadeImpl.a

Open
#202 0 comments 0 reactions 0 assignees View on GitHub
bug exception imported-from-youtrack
Dominant language
Java
Stars
17
Forks
4
Avg merge
5d 15h
Merged PRs (30d)
4

Description

141.712.1

Invoke GenerateMissingTestMethods intention for the AddressController class
```
package test0

class AddressController {
def scaffold = true
def index() {}
}
```
Its test class is as follows (all defaults):
```
package test0

import grails.test.mixin.TestFor
import spock.lang.Specification

/**
* See the API for {@link grails.test.mixin.web.ControllerUnitTestMixin} for usage instructions
*/
@TestFor(AddressController)
class AddressControllerSpec extends Specification {
def setup() {
}
def cleanup() {
}
void "test something"() {
}
}
```
Incorrect method 'def ""() {

}'
com.intellij.util.IncorrectOperationException: Incorrect method 'def ""() {

}'

**at** com.intellij.psi.impl.PsiJavaParserFacadeImpl.a(PsiJavaParserFacadeImpl.java:402)

```
at com.intellij.psi.impl.PsiJavaParserFacadeImpl.createMethodFromText(PsiJavaParserFacadeImpl.java:221)
at com.intellij.psi.impl.PsiElementFactoryImpl.createMethodFromText(PsiElementFactoryImpl.java:725)
at com.intellij.psi.impl.PsiJavaParserFacadeImpl.createMethodFromText(PsiJavaParserFacadeImpl.java:230)
at com.intellij.testIntegration.createTest.JavaTestGenerator.addTestMethods(JavaTestGenerator.java:189)
at com.intellij.testIntegration.createTest.GenerateMissedTestsAction$2.run(GenerateMissedTestsAction.java:109)
at com.intellij.openapi.command.WriteCommandAction$4.run(WriteCommandAction.java:176)
at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:166)
at com.intellij.openapi.application.RunResult.run(RunResult.java:38)
at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:114)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:937)
at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:111)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:117)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:108)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:80)
at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:173)
at com.intellij.testIntegration.createTest.GenerateMissedTestsAction.a(GenerateMissedTestsAction.java:106)
at com.intellij.testIntegration.createTest.GenerateMissedTestsAction.invoke(GenerateMissedTestsAction.java:81)
at com.intellij.codeInsight.intention.PsiElementBaseIntentionAction.invoke(PsiElementBaseIntentionAction.java:42)
at com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper.invoke(IntentionActionWrapper.java:61)
at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler$2.run(ShowIntentionActionsHandler.java:181)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)
at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseActionAndInvoke(ShowIntentionActionsHandler.java:200)
at com.intellij.codeInsight.intention.impl.IntentionListStep$2$1.run(IntentionListStep.java:260)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:332)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:749)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:702)
at java.awt.EventQueue$3.run(EventQueue.java:696)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:719)
at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:734)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
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)
Caused by: java.lang.AssertionError: Unexpected tokens
at com.intellij.lang.java.parser.JavaParserUtil.parseFragment(JavaParserUtil.java:213)
at com.intellij.psi.impl.source.tree.JavaElementType$JavaDummyElementType.parseContents(JavaElementType.java:274)
at com.intellij.psi.impl.source.tree.LazyParseableElement.f(LazyParseableElement.java:172)
at com.intellij.psi.impl.source.tree.LazyParseableElement.getFirstChildNode(LazyParseableElement.java:212)
at com.intellij.psi.impl.source.JavaDummyElement.getFirstChildNode(JavaDummyElement.java:69)
at com.intellij.psi.impl.PsiJavaParserFacadeImpl.createMethodFromText(PsiJavaParserFacadeImpl.java:219)
... 43 more
```

---

*Imported from [IDEA-139368](https://youtrack.jetbrains.com/issue/IDEA-139368) · Type: Exception · Votes: 1*
*Comments, attachments, dates and reporter are not part of the export — follow the link above for the full history.*

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure by invoking GenerateMissingTestMethods for the shown AddressController and AddressControllerSpec. Start with JavaTestGenerator.addTestMethods and GenerateMissedTestsAction, then verify the intention no longer creates the invalid `def ""()` method and completes without an IncorrectOperationException.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.