Difficulties in running Grails tests in IntelliJ: Illegal use of a non-virtual function call

Recently, I have been trying to run Spock tests in IntelliJ (which worked fine and perfectly debugged / tested repeated work on failures), and over the last few months I started getting the following error

| Error Error executing script TestApp: (class: com/company/MyServiceSpec, method: super$2$oldImpl signature: (Ljava/lang/Object;)Ljava/lang/Object;) Illegal use of nonvirtual function call (Use --stacktrace to see the full trace) 

This is a spock test that works great from the command line, either separately (by specifying a class) or in the entire series of test applications. Almost all the spots and simple old Unit or Integration tests that I have in this project give similar crashes in IntelliJ.

I tried to hide with the functions of running the test (with turning the classpath on or off, running the individual method, the entire test class or the entire test series), unable to cope with the situation. I also did grails clean and tried to restart them from IntelliJ: it looked like it worked once, and I was able to run the tests for a while, but then quickly after doing some work, the problem now persists.

I know this is a slightly vague question, but did anyone see such setbacks and find a reliable remedy? I'm on Grails 2.1 and Spock 0.7, same problem in IntelliJ 12 and 13

+6
source share
2 answers

I was able to solve this problem by adding the following env variable to my configuration:

  _JAVA_OPTIONS='-Xverify:none' 
+3
source

First check your configurations and clear those tests that you run that are now failing. You may have run tests like JUnit, and now that you run them again, they do not execute this behavior.

Note. If this is a problem, you can determine by running tests through the command line (for example, grails test-app unit com.yourPackage.Whatever) if they go as expected, and then follow these steps to clear the saved test configurations in IntelliJ

IntelliJ Steps

  • Click Run
  • Click "Edit Configurations"
  • In the left pane of the popup, click the arrow to expand the jUnit tests.
  • Next Click on the test, and then click the minus icon (do this for everyone to clear them all)
  • Go to your test you want to run and right click on it and make sure you select grails instead of jUnit.
0
source

All Articles