jamesfredley commented on issue #9444: URL: https://github.com/apache/grails-core/issues/9444#issuecomment-5960351834
This is fixed. A constraints call such as `list nullable: true` was dispatched to `GormEntity.list(Map)` while `@Mock` was still building the mapping, which is the `IllegalStateException` in the report (`Method on class [...] was used outside of a Grails application`). `DefaultMappingConfigurationBuilder.evaluate` now sets the constraints closure to `Closure.DELEGATE_ONLY` before calling it. `list(Map)` is then handled by `DefaultMappingConfigurationBuilder.invokeMethod`, which records a constraint named `list` on the mapping `Entity`. The domain class is no longer the call target. The builder's `target` is that mapping `Entity`, not the domain class, so `setList` on the domain is not involved. That assignment was changed from `DELEGATE_FIRST` to `DELEGATE_ONLY` in `8759259efd` on 2016-06-17 (`Use DELEGATE_ONLY due to GROOVY-7866 and other issues with delegates in a static context`). The same line is on `8.0.x`, `8.1.x`, and `9.0.x`. It is in the 7.0.0 line from `v7.0.0-M4` through `v7.2.4`, including `v7.0.16`, and in `v8.0.0-M1` through `v8.0.0-RC2`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
