0
votes

I write on Groovy and use Spock framework for testing. Some time ago, IDEA completely supports Spock. When I've writing the code inside feature (test method) in where-block something like this:

with(someObject) {
 intField == 1
 ...
}

IDEA correctly recognize the someObject and understand that intField is field of the object, also, it was offering me other fields of the object. So, inside Spock's with() block I've felt like inside any closure from DefaultGroovyMethods (with{}, each{}, find{}, etc.), but haven't need to use explicit it param.

(So, I's writing with(someObject) { intField == 1 } what is the same is someObject.with { assert it.intField == 1 }.

After a moment IDEA missed Spock's with() method support. Now, it don't recognize the class of the parameter (ex. someObject) in think that it's object of Object class. Any fields inside closure don't be recognized. Explicit it usage didn't help.

enter image description here

After some IDEA update everything have repaired, but after reboot the problem has come back.

Does anybody know how to fix it??

I'm using the last version of the IDE - 2018.2

1

1 Answers

0
votes

I just tested this out with 2018.1 and have the same issue as you. I didn't run the code but I am fairly certain that the code would be recognized and executed. This to me looks like a bug with Intellij, and it might be worth it to submit a bug report in their ticket tracking system.