@GrailsCompileStatic(TypeCheckingMode.SKIP) is generating an Index 0 out of bounds for length 0 error
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
### Expected Behavior
My application was using Grails _5.1.2_ and I decided to update to Grails _5.1.4_ today.
The project is getting some errors related to **@GrailsCompileStatic(TypeCheckingMode.SKIP)**. On the previous version (_5.1.2_) was working as expected. I use this annotation on Controllers, Services and Domains.
this is the error **Index 0 out of bounds for length 0**
Any idea?
### Actual Behaviour
* What went wrong:
Execution failed for task ':compileGroovy'.
> BUG! exception in phase 'semantic analysis' in source unit '/Users/adrian/Sites/hulimotors/myapp/grails-app/controllers/myapp/RestaurantController.groovy' Index 0 out of bounds for length 0

### Steps To Reproduce
1. curl -O https://start.grails.org/myapp.zip -d profile=rest-api -d features=events,mongodb,security
2. cd myapp
3. grails create-domain-class Restaurant
4. grails generate-all myapp.Restaurant
5. Add new action method on the Controller

6. Add @GrailsCompileStatic to the Controller

.
### Environment Information
macOS Monterey
version 12.3
openjdk version "11.0.14" 2022-01-18
OpenJDK Runtime Environment Temurin-11.0.14+9 (build 11.0.14+9)
OpenJDK 64-Bit Server VM Temurin-11.0.14+9 (build 11.0.14+9, mixed mode)
### Example Application
_No response_
### Version
5.1.4
Contributor guide
Research direction
Start by reproducing the reported failure in myapp/grails-app/controllers/myapp/RestaurantController.groovy using the listed Grails 5.1.4 setup and @GrailsCompileStatic(TypeCheckingMode.SKIP). Compare compilation with Grails 5.1.2, focusing on the :compileGroovy semantic-analysis error. Done means the reproduction project compiles successfully with the annotation in place.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- backend, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100