spock
spock copied to clipboard
Allow @Shared fields in traits mixed into Spock Specifications
Hi,
I tried to refactor common behaviour into traits and reuse them by implementing them in my Specifications. I noticed that Spock does not handle @Shared fields declared in a trait.
Would it be possible to support this?
It looks like a duplication of issue 370 and I have even created test cases reproducing this problem.
Cool. Haven't seen this :)
Just for linking this issue to the pr #42
Btw, the problem is only with getting annotations from fields in a trait, so a workaround those fields can be marked as static.
@szpak your comment relates to peters last comment on #203
Came here to ask for this.
The main problem is that Spock works via AST transformations and the combination of AST+Traits is unsupported by groovy as you can see in the section Compatibility with AST transformations of the groovy docs.