sampig / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

VerifyError Stack size too large #344

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Run this repo case: https://gist.github.com/Pyrolistical/8741574

Run with "groovy bug.groovy"

Version:
Spock: 0.7-groovy-2.0
$ groovy -v
Groovy Version: 2.2.1 JVM: 1.7.0_40 Vendor: Oracle Corporation OS: Mac OS X

I get the failure:
$ groovy bug.groovy 
Caught: java.lang.VerifyError: (class: BuggedTest, method: $spock_feature_0_0 
signature: ()V) Stack size too large
java.lang.VerifyError: (class: BuggedTest, method: $spock_feature_0_0 
signature: ()V) Stack size too large

There is something wrong with the generated code.  There is some poor 
interaction with calling helperMethod() and putting the result into an array.

Things that avoid this bug:
1. inline the helperMethod()
2. change the then: to "assert true"
3. change the when: to "assert thing == null"
4. move the def thing into the given:
5. remove the list literal around helperMethod()

It has been talked about here: 
https://groups.google.com/forum/#!topic/spockframework/vKRej9PJ5B0
But never solved.

Original issue reported on code.google.com by ronald.p...@gmail.com on 31 Jan 2014 at 7:56

GoogleCodeExporter commented 9 years ago
Another way to avoid the bug is to put new line char after [

The fact whitespace avoids the bug tells me something is seriously wrong with 
the way the spec is transformed into the generated code

Original comment by ronald.p...@gmail.com on 31 Jan 2014 at 8:00

GoogleCodeExporter commented 9 years ago
Works just fine for me.

Original comment by pnied...@gmail.com on 31 Jan 2014 at 11:44

GoogleCodeExporter commented 9 years ago
I have a situation that I think is the same bug. In a Geb spec, I have the 
following class:

@Stepwise
abstract class AbstractAboutPageSpec extends Specification {
    abstract Class<? extends AboutPage> page()

    def "page loads"() {
        when: to page();
        then: {}
    }
}

This produces a VerifyError on run:
java.lang.VerifyError: (class: 
com/artsquare/gallery/acceptance/ui/AbstractAboutPageSpec, method: 
$spock_feature_3_0 signature: ()V) Stack size too large
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2575)
    at java.lang.Class.getDeclaredFields(Class.java:1908)
    at org.spockframework.runtime.SpecInfoBuilder.buildFields(SpecInfoBuilder.java:98)
    at org.spockframework.runtime.SpecInfoBuilder.doBuild(SpecInfoBuilder.java:69)
    at org.spockframework.runtime.SpecInfoBuilder.buildSuperSpec(SpecInfoBuilder.java:80)
    at org.spockframework.runtime.SpecInfoBuilder.doBuild(SpecInfoBuilder.java:67)
    at org.spockframework.runtime.SpecInfoBuilder.build(SpecInfoBuilder.java:54)
    at org.spockframework.runtime.Sputnik.getSpec(Sputnik.java:80)
    at org.spockframework.runtime.Sputnik.runExtensionsIfNecessary(Sputnik.java:88)
    at org.spockframework.runtime.Sputnik.getDescription(Sputnik.java:55)
    at org.junit.runner.Runner.testCount(Runner.java:41)

Modifying the spec so that the method is called in a given: block fixes the 
problem:

    def "page loads"() {
        given: Class<AboutPage> page = page()
        when: to page
        then: {}
    }

Original comment by christop...@artsquare.com on 27 Feb 2015 at 9:21