[ https://issues.apache.org/jira/browse/GROOVY-11411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17856345#comment-17856345 ]
Paul King commented on GROOVY-11411: ------------------------------------ Here is what I get with a standalone reproducer for Groovy 3.0.21 and 4.0.21: {code} def getAll(Iterable<Serializable> items) { } @groovy.transform.CompileStatic def method() { List<Long> longIds = '3,4'.split(',')?.collect { String id -> id.toLong() } getAll(longIds as Iterable<Serializable>) // Okay getAll(longIds) // Cannot call ConsoleScript22#getAll(java.lang.Iterable<java.io.Serializable>) with arguments [java.util.List<java.lang.Long>] } method() {code} Are you saying that the first {{getAll}} isn't working? > Static Compilation fails for Grails domain class method getAll() > ---------------------------------------------------------------- > > Key: GROOVY-11411 > URL: https://issues.apache.org/jira/browse/GROOVY-11411 > Project: Groovy > Issue Type: Bug > Components: Static compilation, Static Type Checker > Affects Versions: 3.0.21 > Reporter: Tyler VanZanten > Priority: Minor > > Hello, > > The following code results in a static compilation error after upgrading from > Grails 6.1.2 (which uses Groovy 3.0.11) to Grails 6.2.0 (which uses Groovy > 3.0.21): > > > {code:java} > import grails.compiler.GrailsCompileStatic > import static org.springframework.http.HttpStatus.NO_CONTENT > @GrailsCompileStatic > class SessionItemGroupController { > def deleteMultiple() { > List<Long> longIds = ((String) params.ids)?.split(',')?.collect { > String id -> id.toLong() } > List<SessionItemGroup> sessionItemGroups = > SessionItemGroup.getAll(longIds as Iterable<Serializable>) // This line > causes the error > response.status = NO_CONTENT.value() > } > }{code} > > > SessionItemGroup is a Grails domain class and this is the error I'm getting > when trying to run a Gradle task such as `bootRun` or `build`: > > ``` > > Task :compileGroovy FAILED > startup failed: > grails-app/controllers/myapp/sessionitem/SessionItemGroupController.groovy: > 57: [Static type checking] - Cannot call > myapp.sessionitem.SessionItemGroup#getAll(java.lang.Iterable > <java.io.Serializable>) with arguments [java.util.List <java.lang.Long>] > @ line 41, column 56. > temGroup> sessionItemGroups = SessionIte > ``` > > I have created a sample application repository which reproduces the issue: > https://github.com/tylervz/grails620-groovy-bug-compile-static -- This message was sent by Atlassian Jira (v8.20.10#820010)