Currently type-safe templates still allows unknown variable names, with no error neither at compile time (compile) nor at runtime (apply) defeating the whole purpose of type safety.
It's not clear what this project's type-safe support even refers to.
Additionally, the following piece of documentation is wrong:
By default, Handlebars.java throws an java.lang.IllegalArgumentException() if a helper cannot be resolved.
Test:
public class Test {
static class Data {
Data(String name) { this.name = name; }
private String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}
interface DataTemplate extends TypeSafeTemplate<Data> { }
public static void main(String[] args) throws IOException {
Handlebars handlebars = new Handlebars();
Template tpl = handlebars.compileInline("Hello, {{missingName}}!");
DataTemplate dtpl = tpl.as(DataTemplate.class);
Data data = new Data("World");
System.out.println(dtpl.apply(data));
}
}
Expected output: an exception, either at compile-time (preferred) or at runtime.
Actual output: Hello, !
Currently type-safe templates still allows unknown variable names, with no error neither at compile time (
compile
) nor at runtime (apply
) defeating the whole purpose of type safety.It's not clear what this project's type-safe support even refers to.
Additionally, the following piece of documentation is wrong:
Test:
Expected output: an exception, either at compile-time (preferred) or at runtime.
Actual output:
Hello, !