andresteingress / gcontracts

GContracts: Programming by Contract for Groovy
http://gcontracts.org
114 stars 11 forks source link

Ensure Groovy 2.0 @CompileStatic compability #29

Closed andresteingress closed 12 years ago

jmisur commented 11 years ago

Hi, I cannot make this simple example run with @CompileStatic (groovy-all 2.0.4, gcontracts-core 1.2.10, java 1.6, inside Groovy/Grails Tool Suite - groovy compiler set to 2.0.4) What am I doing wrong?

import org.gcontracts.annotations.Requires

@CompileStatic
public class App {

    @Requires({x == null})   // x undeclared
    String yyy(String x) {
        println x
        x
    }

    @Requires({x > 3})   // x undeclared
    String xxx(int x){
        yyy('aa')
    }

    public static void main( String[] args ) {
        new App().xxx(4)
    }
}