0

I have search everywhere for this answer, and I thinking it can't be done.

Here is my compiler-config.groovy file:

import groovy.transform.CompileStatic

withConfig(configuration) {
  ast(CompileStatic)
}

What i want to do is add some additional config params to turn off Type Checking. In essence I want my entire groovy project compiled static but I dont want it to do any type checking. Is this possible?

Szymon Stepniak
  • 40,216
  • 10
  • 104
  • 131
Jeff S.
  • 11
  • Quick question - have you tried the configuration you have shown in the question? It looks like your compiler configuration adds `@CompileStatic` only. – Szymon Stepniak Jul 22 '18 at 14:43
  • Uh, yeah. That is the problem. CompileStatic by default applies TypeChecking. I want static compiling, that checks class methods etc and other compiler issues, but I dont want it to do any TypeChecking. – Jeff S. Jul 23 '18 at 09:50

1 Answers1

0

Normally your compiler-config file should looks like this:

import groovy.transform.CompileStatic
import groovy.transform.TypeCheckingMode

withConfig(configuration)  {
    ast(CompileStatic, value: TypeCheckingMode.SKIP)
}

But in my case (Groovy 2.5.1), groovy ignore the "value" and still use TypeCheckingMode.PASS. I guess it could be a bug.

Workaround what I found is use @CompileStatic(TypeCheckingMode.SKIP) or @CompileDynamic (this is shortcut for previous one) annotations on the class which should skip TypeChecking.