Björn Kautler created GROOVY-11780:
--------------------------------------
Summary: Nest Host and Nest Members not always right for Closures
Key: GROOVY-11780
URL: https://issues.apache.org/jira/browse/GROOVY-11780
Project: Groovy
Issue Type: Bug
Affects Versions: 5.0.1
Reporter: Björn Kautler
This is a regression in Groovy 5.
Groovy 2.5, 3.0, and 4.0 it works fine.
It also still happens on the current published 5.0.2-SNAPSHOT.
To reproduce:
* checkout my {{groovy5}} PR branch of
[https://github.com/spockframework/spock/pull/2213]
* go to {{spock.util.AstNodeToScriptVisitor#visitClass}}
* Remove or comment the {{@CompileDynamic}}
* Execute {{./gradlew -Dvariant=5.0 -DjavaVersion=11 :spock-specs:test --tests
org.spockframework.smoke.ast.AstSpec --info}}
As a result you get an {{IncompatibleClassChangeError}} because the closure
calling the private method {{visitObjectInitializerBlocks}} is not properly
added to the nest.
If you do the same with {{{}-DjavaVersion=17{}}}, the error slightly changes to
an {{{}IllegalAccessError{}}}, but the cause is the same.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)