apache / apache/grails-intellij-plugin
Resolve unrolled chained named queries on Grails domain classes
- Dominant language
- Java
- Stars
- 17
- Forks
- 4
- Avg merge
- 5d 15h
- Merged PRs (30d)
- 4
Description
Say we have a domain class in Grails (2.5.6):
```groovy
class Member implements Serializable {
Short type
String name
static namedQueries = {
withNameContaining { name ->
and {
ilike('name', "%${name}%")
}
}
withType { type ->
and {
eq('type', type)
}
}
}
```
Now, by virtue of these "named queries" returning `NamedCriteriaProxy` this is valid code:
```groovy
def someMembers = Member.withNameContaining('foo').withType('7')
```
Here, IDEA resolves everything just fine.
However, in this:
```groovy
def someMembers = Member.withNameContaining('foo')
someMembers = someMembers.withType('7')
```
IDEA does not resolve `Member.withType`.
---
*Imported from [IDEA-206171](https://youtrack.jetbrains.com/issue/IDEA-206171) · 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 reproducing the two chained named-query examples in IntelliJ using Grails 2.5.6. Trace how Member.withNameContaining returns NamedCriteriaProxy and how the separate assignment is resolved; done means the second form resolves withType just like the direct chain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100