samskivert / jmustache

A Java implementation of the Mustache templating language.
Other
834 stars 128 forks source link

Java 9+ support? #117

Closed frehov closed 4 years ago

frehov commented 4 years ago

Will there be an update to support java 9+ and get rid of the following warning?

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.samskivert.mustache.DefaultCollector (file:/C:/Users/frh/.m2/repository/com/samskivert/jmustache/1.15/jmustache-1.15.jar) to method java.util.concurrent.ConcurrentHashMap$MapEntry.getKey() WARNING: Please consider reporting this to the maintainers of com.samskivert.mustache.DefaultCollector WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

Using Spring-Boot 2.2.2 and Java 11

samskivert commented 4 years ago

I added support for configuring the Collector to not use access coercion. You can configure this wherever the Mustache compiler is configured, with something like the following:

Mustache.Compiler comp = Mustache.compiler().
            withCollector(new DefaultCollector(false))

I don't know exactly where to put this code to make Spring create its Mustache compiler in that way, but I think there are Stack Overflow posts on how to customize the Mustache compiler used with Spring, so those should help.

uqmat commented 2 years ago

@samskivert I am also struggling with the original poster's problems on Java 17. Are there any plans to release a version > 1.15 any time soon? Unfortunately v1.15 (the latest version available on Maven Central) came out prior to this change.