Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Groovy 3 compatibility #1075
This pull request provides expermental Spock compatibility (compilation + tests) with Groovy 3.
In addition the Groovy 2.5 compatibility is kept. There are 2 variants available known from the previous Spock versions. There is a compatibility layer to cover breaking changes in Groovy 3.
The builds pass on Travis with Groovy 3.0 and 2.5 variants on supported range of Java versions.
Known issues/limitations (to be fixed - or acknowledged - before merge):
Long term known issues (to be fixed before 2.0-final is released in separate PRs):
It is recommended to merge this pull request WITHOUT squashing, to keep the original commit separation. They contain extra information about incompatibilities and, in addition, would be easier to selectively revert something, if needed.
Feel free to comment and propose possible improvements!
@@ Coverage Diff @@ ## master #1075 +/- ## ============================================ - Coverage 74.02% 73.99% -0.03% - Complexity 3437 3445 +8 ============================================ Files 383 385 +2 Lines 10630 10657 +27 Branches 1297 1301 +4 ============================================ + Hits 7869 7886 +17 - Misses 2299 2309 +10 Partials 462 462
The error has nothing to do with my changes.
Btw. I'm curious, is there a reason you used
@Vampire I just said that you added those tests which started to fail after switch to Groovy 3 and therefore, I suspected, you might be more situation oriented than me. But if you are not, and you don't want to face the challenge, I can understand that ;-).
Btw, having your PR merged day or two later would cause it to fail before merge (or right after) ;-).
The only reason is that I notoriously forget about that extension :). I changed it in some places, thanks for you suggestion.
To detect problems and know how problematic it will be. Compiling, but with several broken tests.
Power assertions in Groovy 3 renders resolved values at the beginning of the expression, not in the middle of it.
It fixed mock.getProperty("foo") stubbing while preserving previous fix for property access to stubbed getters in Groovy 3.
The one related to constructor declaration. The implementation of SpecParser.constructorMayHaveBeenAddedByCompiler no longer detect specification constructor and should be enhanced to support Groovy 3. As it is not a critical bug I postponed it to work on building the same Spock code base with Groovy 2 and 3.
Added compatibility layer and conditional module inclusion to keep codebase compilable (and buildable) with both Groovy 2.5 and 3.0.
Groovy script execution line in stacktrace format has changed since RC2: script15791055931181262955476.groovy:3 -> Script_eb303fa8835e8a0c4ec6558372940b3d.groovy:3