handlebars.java icon indicating copy to clipboard operation
handlebars.java copied to clipboard

Add Java 21 to CI

Open dsvensson opened this issue 1 year ago • 3 comments
trafficstars

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 avatar Jul 08 '24 14:07 dsvensson

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}}

dsvensson avatar Jul 08 '24 14:07 dsvensson

@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?

mimranfaruqi avatar Sep 02 '24 22:09 mimranfaruqi

@mimranfaruqi Other than staying at Java 17, no.

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

dsvensson avatar Sep 27 '24 15:09 dsvensson

@jknack thanks for merging and dealing with the Java 21 fallout, perhaps best to also add Java 24 (and later change to 25) to the build matrix as Java 25 Long Term Support is due next month.

dsvensson avatar Aug 15 '25 07:08 dsvensson