apache / apache/grails-core

Data service JPA query doesnt compile when invoked from a Java class

Open
#14,519 1 comment 0 reactions 0 assignees View on GitHub
relates-to: gorm relates-to: groovy
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

### Steps to Reproduce

1. Build the application

### Expected Behaviour

No compile error

### Actual Behaviour
```
/home/olav/dataquerybug/build/tmp/compileGroovy/groovy-java-stubs/com/example/BookService.java:13: error: element value must be a constant expression
@grails.gorm.services.Query(value=null) java.util.List getTitles();
^
1 error
startup failed:
Compilation failed; see the compiler error output for details.

1 error

FAILURE: Build failed with an exception.
```

### Environment Information

- **Operating System**: Ubuntu 18.04
- **GORM Version:** 7.0.0
- **Grails Version ** 4:00
- **JDK Version:** Openjdk 11

### Example Application

https://github.com/olavgg/dataquerybug

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure by building the linked example application with the stated Grails, GORM, and JDK versions. Start with the generated compileGroovy stub at build/tmp/compileGroovy/groovy-java-stubs/com/example/BookService.java and the data service query that produces it. Done means the application builds without the reported constant-expression compile error.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.