Template compiler does not support preview features
See original GitHub issueI am using jte with java 15 and enabled previews, as I want to use records. However, if I have a record used in a template I get the following exception:
gg.jte.TemplateException: Failed to compile template, error at
error: classfile for /Users/alr/devel/spinscale/javalin-elasticsearch-client/out/production/classes/model/Person.class uses preview features of Java SE 15.
(use --enable-preview to allow loading of classfiles which contain preview features)
1 error
So, having this record, using --enable-preview
to activate such features for regular compilation seems it is not passed through the template compiler.
public record Person(String firstName, String lastName, String employer) {}
Template can look like this
@import model.Person;
@param Person person
{ "name" : { "first" : "${person.firstName()}", "last" : "${person.lastName()}"}, "employer" : "${person.employer()}" }
try (StringOutput output = new StringOutput()) {
templateEngine.render("person.jte", Map.of("person", person), output);
return output.toString();
}
Is there any possibility to enable preview features for the template compiler? The ClassFilesCompiler
class did not look like it.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
vue-template-compiler - npm
This package can be used to pre-compile Vue 2.0 templates into render functions to avoid runtime-compilation overhead and CSP restrictions.
Read more >Preview Features in .NET 6 - Generic Math
Because preview features are not supported for use in production and the APIs will likely have breaking changes before becoming supported, ...
Read more >I downloaded VS 2019 Enterprise. When I tried compile .net ...
Developers using VS2019 Version 16.1.0 or later can find this option under " Tools -> Options -> Environment -> Preview Features ".
Read more >Compile Your Template - Oracle Help Center
Detail Page Compilation. In the preceding example, you'll see warnings about no content layout map entries for the Starter-Blog-Author page. However ...
Read more >Xcode 14 Release Notes | Apple Developer Documentation
Fixed: Xcode doesn't provide semantic highlighting and jump-to-definition support for C++20 concept declarations and the requires clauses in templates.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome, thanks for testing it so quickly!
I will adjust the maven plugin and then close this issue, if that’s okay with you.
tested and works!