[
https://issues.apache.org/jira/browse/GROOVY-11411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17856357#comment-17856357
]
Paul King commented on GROOVY-11411:
------------------------------------
[~emilles] You are correct. I updated the earlier comment.
> 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)