jknack / handlebars.java

Logic-less and semantic Mustache templates with Java
http://jknack.github.io/handlebars.java
Other
1.47k stars 383 forks source link

Add Java 21 to CI #1134

Open dsvensson opened 4 months ago

dsvensson commented 4 months ago

I was about to write a test case for handlebars 4.4.0 with Java 21, but apparently the project doesn't compile yet with 21. Running tests locally results in 13 test failures under Java 21. Opened PR to have CI reflect that state. All failures locally are i18n related and throw java.lang.UnsupportedOperationException so hopefully just that one module change to fix them all.

dsvensson commented 4 months ago

The test case I was going to add, which is not covered by the failing tests, was that when running under Java 21, @last is always true in some loops - iirc not all, so when using that to splice in , between list entries for example, that results in no , being inserted.

Something like this (stripped from content so maybe looks a bit barren):

        {{#each coll as | subcoll | }}
              {{#each subcoll as | entry |}}
                  {{entry.name}}: {{serialize entry.value}}
                  {{#unless @last}},{{/unless}}
              {{/each}}
        {{#unless @last}},{{/unless}}
        {{/each}}
mimranfaruqi commented 2 months ago

@dsvensson I have this issue as well. I use @last in a nested loop but it is always false. I am using it with #unless. When I use #unless 2 > 3 the condition is always true, although it has to be false IMO.

Have you found a workaround to this or have you stopped working with this for now?

dsvensson commented 1 month ago

@mimranfaruqi Other than staying at Java 17, no.

@jknack Any idea how to get Java 21 support working?