You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2025/02/10 20:41:00 UTC
[jira] [Resolved] (GROOVY-11567) Field transform does not handle closure or anonymous class in assert, return, etc.
[ https://issues.apache.org/jira/browse/GROOVY-11567?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-11567.
----------------------------------
Fix Version/s: 5.0.0-alpha-13
Resolution: Fixed
https://github.com/apache/groovy/commit/186ff3f20ca6df634eb3e028e36d6b1b2e7dd809
> Field transform does not handle closure or anonymous class in assert, return, etc.
> ----------------------------------------------------------------------------------
>
> Key: GROOVY-11567
> URL: https://issues.apache.org/jira/browse/GROOVY-11567
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
> Fix For: 5.0.0-alpha-13
>
>
> Consider the following:
> {code:groovy}
> @Field String foo = 'bar'
> assert({ ->
> new Object() {
> String toString() { foo + 'baz' }
> }
> }.call().toString() == 'barbaz')
> {code}
> Not the best example, but this fails with an NPE in the compiler. The {{@Field}} transform navigates expression statements, but not other statement types.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)