quarkus: Minus not working with Integer in qute after upgrading to 3.0.1.Final

Describe the bug

After upgrading quarkus version to 3.0.1.Final, without changing anything else, appeared an error in qute templates:

io.quarkus.qute.TemplateException: Rendering error in template [HtmlPagesController/commentaries.html] line 60:
Method "minus(2)" not found on the base object "java.lang.Integer" in expression {commentariesRenderingInformation.renderingPageNumber.minus(2)}

It appeared in this line: {#let indexOfPreviousPage = commentariesRenderingInformation.renderingPageNumber.minus(2)}

Expected behavior

This expression worked fine until quarkus version upgrade, so the expected behavior is a correct subtraction.

Actual behavior

Subtraction falls with an error

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

17.0.2

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.0.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.1

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Is it an expected behavior that it is not possible to use minus(-) for assigning values to qute variables like this: {#let indexOfPreviousPage = commentariesRenderingInformation.renderingPageNumber - 2}

You can only the minus - sign in output expressions; i.e. {commentariesRenderingInformation.renderingPageNumber - 2} is supported. In section params you either need to use the method notation (commentariesRenderingInformation.renderingPageNumber.minu(2)) or parentheses: {#let indexOfPreviousPage = (commentariesRenderingInformation.renderingPageNumber - 2)} (see https://quarkus.io/guides/qute-reference#sections).

Thanks. I was able to reproduce the problem with qute-quickstart. It’s actually a regression introduced in https://github.com/quarkusio/quarkus/pull/32653 (3.0.1.Final). I’m working on a fix.

Or I may create another reproducer

Please do 😉

I have added reproducer to logn.html file. Please, get the latest commit of the same branch, start the application as before and go to /pages/login(it will work fine), after that trigger live reload(for example, comment line 152 of HtmlPagesController) and refresh the page and you will get the error

Hm, that’s not a build time validation error but a runtime problem. That’s weird as we have tests for this. Would you care to create a simple reproducer app?

It is strange but this error appears after live reload as @rasmushaglund said. On the first start of the application it works fine. After first live reload it crashes with this error. Here is a reproducer. To get the error you should clone the repo, checkout the branch 9-connect-backend-with-frontend, start the application, after that please comment line 152 in HtmlPagesController.kt to trigger live reload and to see the page without authentication and then if you go to http://localhost:8080/pages/resumes?pageIndex=0&pageSize=5 you will get that error.

After upgrading quarkus version to 3.0.1.Final,…

What was the previous quarkus version?

2.16.6.Final