Jochen Eddelbuettel created GROOVY-9558: -------------------------------------------
Summary: Wrong code for putAt on Map that is member of closure delegate Key: GROOVY-9558 URL: https://issues.apache.org/jira/browse/GROOVY-9558 Project: Groovy Issue Type: Bug Components: Static compilation Affects Versions: 3.0.3 Environment: Oracle JDK8 1.8.0_162, IntelliJ CE 2019.3.4, indy enabled Reporter: Jochen Eddelbuettel I'm compiling this little Closure with @CompileStatic enabled {code:java} scriptEngine.config.tap { // Code generation goes wrong here optimizationOptions["indy"] = true // This code is generated correctly optimizationOptions.indy = true }{code} {code:java} // Generated fault code - obviously no call to getOptimizationOptions() boolean var2 = true;DefaultGroovyMethods.putAt(((Class)((_main_closure1)this).getDelegate()).cast<invokedynamic>(((_main_closure1)this).getDelegate()), "indy", var2); // Correct code for the second line, via setProperty boolean bool1 = true;ScriptBytecodeAdapter.setProperty(Boolean.valueOf(bool1), null, ((CompilerConfiguration)((_main_closure1)this).getDelegate()).getOptimizationOptions(), (String)"indy"); {code} Compilation works, but I get a runtime error, which is easily explicable given the generated code: Exception in thread "main" org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'org.codehaus.groovy.control.CompilerConfiguration@15d9bc04' with class 'org.codehaus.groovy.control.CompilerConfiguration' to class 'java.util.Map' -- This message was sent by Atlassian Jira (v8.3.4#803005)