redhat-developer / intellij-quarkus

IntelliJ Quarkus Tools
Eclipse Public License 2.0
113 stars 43 forks source link

Invalid char(s) in expression. quarkus (9) #1325

Closed gastaldi closed 1 week ago

gastaldi commented 2 weeks ago

When creating a @Scheduled method in a Quarkus application like the following, the IDE complains with Invalid char(s) in expression. quarkus (9) when hovering the cron expression:

@ApplicationScoped
@Startup
public class MavenCacheState {

    @PostConstruct
    @Scheduled(cron = "{quarkus.registry.cache.cron:*/10 * * * * ?}")
    void checkDbState() {
    }
}
angelozerr commented 2 weeks ago

I dont master the validation of cron expression.

I Wonder if there is the same problem with vscode-quarkus?

gastaldi commented 2 weeks ago

@angelozerr yes, I confirm this also happens in vscode

image
fbricon commented 2 weeks ago

This is caused by the cron validator not supporting variable injection:

https://github.com/redhat-developer/intellij-quarkus/blob/25ce1d6e9172bfcd753e18ef8403e6e95629fa73/src/main/java/com/redhat/microprofile/psi/internal/quarkus/scheduler/SchedulerUtils.java#L74-L89

fbricon commented 2 weeks ago

My bad the error seems to come from

https://github.com/redhat-developer/intellij-quarkus/blob/25ce1d6e9172bfcd753e18ef8403e6e95629fa73/src/main/java/com/redhat/microprofile/psi/internal/quarkus/scheduler/SchedulerUtils.java#L117-L120