Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.2.0-beta-1
-
None
Description
import groovy.transform.CompileStatic @CompileStatic class MyCar { String brand String model } @CompileStatic class MyCarMain { static void main(String[] args) { def main = new MyCarMain() def car = main.configureCar { brand = "BMW" model = brand + " X5" } println car.model } MyCar configureCar(@DelegatesTo(MyCar) Closure closure) { def car = new MyCar() closure.delegate = car closure.resolveStrategy = Closure.DELEGATE_FIRST closure() car } }
The line model = brand + " X5" produces this compile error:
Groovyc: Access to java.lang.Object#brand is forbidden
There is no such compile error when using @TypeChecked.