Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.14, 3.0.8, 4.0.0-beta-1
-
None
Description
Follow up from GROOVY-6851 and GROOVY-9151. Consider the following:
@groovy.transform.CompileStatic void greet(Object o = 'world', String s = o.toString()) { print "hello $s" } /*void greet() { Object o = 'world' greet(o, (String)o.toString()) // IncompatibleClassChangeError: Expected static method java.lang.Object.toString()Ljava/lang/String; }*/ greet()
The STCV only looks at the default argument expressions, not the generated methods. So there still can be issues in the statically compiled result.