With Java 8/11, we successfully managed to call static methods inside our templates.
For example, it works fine with this class :
public class DateUtil {
public static String format(String date) {
return "...";
}
}
and this configuration :
assembler = new DocumentAssembler();
assembler.getKnownTypes().add(DateUtil.class);
assembler.assembleDocument(..., ..., ...);
But, when we try the same thing with Java17, we’re facing this issue :
Caused by: java.lang.IllegalStateException: An error has been encountered at the end of expression 'DateUtil.format("..."))]'. Can not resolve method 'format' on type 'class [...].DateUtil'.
Is there anything else we have to do if we want to make it work with Java17 ?
@Samoth
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): ASSEMBLYJAVA-34
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The problem arises from the newly introduced constraints on reflection usage in Java 17. This issue is acknowledged and essentially not a bug. To address it, insert the following code before assembling a document:
It’s important to note that this setting can be established just once, perhaps during application startup, as it impacts all subsequent documents being constructed.