Intellij-Plugin icon indicating copy to clipboard operation
Intellij-Plugin copied to clipboard

QuickFix not listing all classes for Gradle project

Open mahendrakariya opened this issue 9 years ago • 4 comments

Expected behavior

When user selects the quick fix option, all the classes marked as test sources root should be listed.

Actual behavior

When user selects the quick fix option, none of the classes are getting listed.

Steps to reproduce

  1. Clone this project. https://github.com/limsim/newGaugeProj
  2. Try to create a step implementation for the another fish in the water step in zamoo.spec.

Version Info

  • IntelliJ version: IntelliJ IDEA 2016.2.4
  • OS information: OS X El Capitan 10.11.6
  • Gauge IntelliJ plugin version: 0.2.3
  • Does the project uses any Build tool(Gradle/Maven): Gradle
  • Gauge version:
Gauge version: 0.6.3

Plugins
-------
go (0.0.1)
html-report (2.2.0)
java (0.5.1)
xml-report (0.1.3)

Thanks a lot to @limsim for reporting this issue and providing a sample project.

mahendrakariya avatar Oct 17 '16 05:10 mahendrakariya

Dev Notes:

Whenever user invokes quick fix, Gauge plugin gets the module for the spec file, searches for all the Java files in that module and lists them. This used to work so far because IntelliJ always created only one module for every Gradle project.

However in the new versions, whenever a Gradle project is imported, IntelliJ creates multiple modules. So we need to search for Java files in all these modules.

mahendrakariya avatar Oct 17 '16 06:10 mahendrakariya

Fix is available in nightly >= 2016-10-17

mahendrakariya avatar Oct 17 '16 09:10 mahendrakariya

Though the classes are getting listed now. On trying to implement getting the following exception

Incorrect method '@Step("* a fish in water

")
public void implementation1(){

}
'
com.intellij.util.IncorrectOperationException: Incorrect method '@Step("* a fish in water

")
public void implementation1(){

}
'
    at com.intellij.psi.impl.PsiJavaParserFacadeImpl.newException(PsiJavaParserFacadeImpl.java:411)
    at com.intellij.psi.impl.PsiJavaParserFacadeImpl.createMethodFromText(PsiJavaParserFacadeImpl.java:227)
    at com.intellij.psi.impl.PsiElementFactoryImpl.createMethodFromText(PsiElementFactoryImpl.java:744)
    at com.intellij.psi.impl.PsiJavaParserFacadeImpl.createMethodFromText(PsiJavaParserFacadeImpl.java:236)
    at com.thoughtworks.gauge.annotator.CreateStepImplFix$2.addStepImplMethod(CreateStepImplFix.java:178)
    at com.thoughtworks.gauge.annotator.CreateStepImplFix$2.access$500(CreateStepImplFix.java:149)
    at com.thoughtworks.gauge.annotator.CreateStepImplFix$2$1.run(CreateStepImplFix.java:159)
    at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:162)
    at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
    at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:108)
    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.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:103)
    at com.intellij.openapi.command.WriteCommandAction.access$000(WriteCommandAction.java:34)
    at com.intellij.openapi.command.WriteCommandAction$1.run(WriteCommandAction.java:85)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:723)
    at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:82)
    at com.thoughtworks.gauge.annotator.CreateStepImplFix$2.run(CreateStepImplFix.java:166)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:345)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:329)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:857)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:658)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
    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)

Version

Gauge version: 0.6.3.nightly-2016-10-27

Plugins
-------
csharp (0.9.2.nightly-2016-09-14)
html-report (2.2.0.nightly-2016-10-27)
java (0.5.1.nightly-2016-10-26)
ruby (0.3.2.nightly-2016-08-22)
spectacle (0.0.1)
xml-report (0.1.4.nightly-2016-07-25)

sswaroopgupta avatar Nov 03 '16 11:11 sswaroopgupta

I am unable to replicate this issue on my machine.

mahendrakariya avatar Nov 07 '16 09:11 mahendrakariya