question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Template compiler does not support preview features

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
casidcommented, Nov 25, 2020

Awesome, thanks for testing it so quickly!

I will adjust the maven plugin and then close this issue, if that’s okay with you.

1reaction
spinscalecommented, Nov 25, 2020

tested and works!

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found