apache / apache/grails-intellij-plugin

Grails 4.x.y Controllers: params injected variable confusion

Open
#357 0 comments 0 reactions 0 assignees View on GitHub
bug imported-from-youtrack
Dominant language
Java
Stars
17
Forks
4
Avg merge
5d 15h
Merged PRs (30d)
4

Description

When editing a Controller, usage of **params** is always marked as needing to be cast when using **@GrailsCompileStatic** annotation on Controller class.

Intellij believes that **params** is of type **org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap**, when in fact, it is of type **grails.web.servlet.mvc.GrailsParameterMap**

Code example marked as needing to be cast:
```
User u = new User(params)
[. . .]
u.properties = params
```
Important note: class implementing **WebAttributes** traits are not affected by this bug

This bug is annoying because Intellij is almost perfect for Grails development.

Thanks for your support,
Adrien

---

*Imported from [IDEA-245842](https://youtrack.jetbrains.com/issue/IDEA-245842) · Type: Bug · Votes: 0*
*Comments, attachments, dates and reporter are not part of the export — follow the link above for the full history.*

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how @GrailsCompileStatic resolves the injected params variable in Grails controllers, then compare the org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap type with grails.web.servlet.mvc.GrailsParameterMap. Done means IntelliJ no longer reports unnecessary casts for the User(params) and u.properties = params examples, while WebAttributes traits remain unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.