Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The attached traitissue.zip contains the following code:
src/main/groovy/demo/SomeTrait.groovy
package demo trait SomeTrait { static getSomeValue() { someHelperMethod() } private static someHelperMethod() { 42 } }
src/test/groovy/demo/SomeTraitSpec.groovy
package demo import spock.lang.Specification class SomeTraitSpec extends Specification { void 'test static method'() { expect: SomeClass.getSomeValue() == 42 } } class SomeClass implements SomeTrait {}
Using the current 2.4.0-SNAPSHOT that test fails with the following:
groovy.lang.MissingMethodException: No signature of method: static demo.SomeClass.someHelperMethod() is applicable for argument types: () values: [] at demo.SomeTrait$Trait$Helper.getSomeValue(SomeTrait.groovy:6) at demo.SomeTraitSpec.test static method(SomeTraitSpec.groovy:9)
If the private method in SomeTrait is promoted to public, the test passes. If build.gradle is edited to use either Groovy 2.3.7 or 2.3.8 or 2.4.0-beta-4 the test passes.
Attachments
Attachments
Issue Links
- is related to
-
GROOVY-7191 CompileStatic Will Not Allow Instance Method In Trait To Call Static Method
- Closed