Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quarkus Qute broken in 3.16 #44797

Closed
Madere opened this issue Nov 28, 2024 · 6 comments · Fixed by #44817
Closed

Quarkus Qute broken in 3.16 #44797

Madere opened this issue Nov 28, 2024 · 6 comments · Fixed by #44817
Labels
area/qute The template engine kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.
Milestone

Comments

@Madere
Copy link

Madere commented Nov 28, 2024

Describe the bug

Hi,
we used Quarkus Qute 3.15.2 and all worked fine. Since 3.16.1 we have an issue with calling a Java method. The parameter in the Java method is always the same value where in the HTML file the field has the correct value within a loop.

Html fragments:

{#for project in schedules.projects}
  {#for name in schedules.names}
    <script>console.log("Name: Project.name = [{project.name}]");</script>
    {#let schedule = schedules.forProjectAndName(project, name, project_index)}
    ........
  {/for}
{/for}

In the browser console logging, the value for project.name is correct for each project in 'schedules.projects'

Java Code:

public PipelineSchedule forProjectAndName(final Project project, final String scheduleName, final int indexCount) {
log.info("Name: Project.Name = [{}], ScheduleName = [{}], indexCount = [{}]", project.name(), scheduleName, indexCount);

The java logging shows always the first project name from the loop in the html code. Anyone an idea what is going on? And how to solve this?

Expected behavior

That the loop works the same as in Quarkus version 3.15

Actual behavior

The value of the parameter in the Java method is always of the first entry in the loop.

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.15 versus 3.16

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

mvn

Additional information

No response

@Madere Madere added the kind/bug Something isn't working label Nov 28, 2024
@quarkus-bot quarkus-bot bot added the area/qute The template engine label Nov 28, 2024
Copy link

quarkus-bot bot commented Nov 28, 2024

/cc @mkouba (qute)

@mkouba
Copy link
Contributor

mkouba commented Nov 28, 2024

Hi @Madere and thanks for the report. Would it be possible to extract the relevant code in a minimal reproducer project? It's hard to guess without something concrete in hand.

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label Nov 28, 2024
@Madere
Copy link
Author

Madere commented Nov 28, 2024

Hi @mkouba find attached a zip file with a short demo project. Zipfile removed.

Compiled with Java-21

usage:
java -jar target/documentation-runner.jar list-schedules

The Html ouput is in: pages/schedules.html

Screenshots:
Html Output with Quarkus 3.15.2 (correct) Image

Html Output with Quarkus 3.16.1 (incorrect) Image

@mkouba
Copy link
Contributor

mkouba commented Nov 28, 2024

Hi @mkouba find attached a zip file with a short demo project. Quarkus Qute issue.zip

Compiled with Java-21

usage: java -jar target/documentation-runner.jar list-schedules

The Html ouput is in: pages/schedules.html

Screenshots: Html Output with Quarkus 3.15.2 (correct) Image

Html Output with Quarkus 3.16.1 (incorrect) Image

Thanks. I'll take a look.

@mkouba
Copy link
Contributor

mkouba commented Nov 28, 2024

Ok, found it. It's a regression caused by #43308.

I've sent a PR with a fix. This is the fix: https://github.com/quarkusio/quarkus/pull/44817/files#diff-172c5b92001e43b2cc32c9a8025b0730084d360fa398a1600dc4e4a8b88cc3d3R65 🤦 😦

Workarounds exists: do not use the reflection fallback value resolver, but instead:

@Madere
Copy link
Author

Madere commented Nov 28, 2024

Hi @mkouba , thanks.
Adding @TemplateData made it work again.
Regards,
Martin.

@Madere Madere closed this as completed Nov 28, 2024
@quarkus-bot quarkus-bot bot added this to the 3.18 - main milestone Nov 29, 2024
@gsmet gsmet modified the milestones: 3.18 - main, 3.17.3 Nov 30, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/qute The template engine kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants