handlebars.java
handlebars.java copied to clipboard
Add Java 21 to CI
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.
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 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 Other than staying at Java 17, no.
@jknack Any idea how to get Java 21 support working?
@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.