You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Vlad Bailescu (JIRA)" <ji...@apache.org> on 2017/10/19 11:08:00 UTC
[jira] [Created] (SLING-7207) Get rid of runtime reflection in HTL
expression evaluation
Vlad Bailescu created SLING-7207:
------------------------------------
Summary: Get rid of runtime reflection in HTL expression evaluation
Key: SLING-7207
URL: https://issues.apache.org/jira/browse/SLING-7207
Project: Sling
Issue Type: Improvement
Components: Scripting
Affects Versions: Scripting HTL Engine 1.0.42, Scripting HTL Java Compiler 1.0.14, Scripting HTL Compiler 1.0.14
Reporter: Vlad Bailescu
Fix For: Scripting HTL Java Compiler 1.0.16, Scripting HTL Engine 1.0.44
At the moment the following expression
{code}
<sly data-sly-use.obj="com.my.Obj">${obj.message}</sly>
{code}
generates this Java code:
{code}
Object _global_obj = null;
_global_obj = renderContext.call("use", "com.my.Obj", obj());
{
Object var_0 = renderContext.call("xss", renderContext.getObjectModel().resolveProperty(_global_obj, "message"), "text");
out.write(renderContext.getObjectModel().toString(var_0));
}
{code}
Resolving the property is done via reflection at runtime. Given the fact that for most use providers (JS is an exception) we know the type of {{_global_obj}} we could determine the right method to call at compile time. Resulting code might look something like:
{code}
com.my.Obj _global_obj = renderContext.call("use", "com.my.Obj", obj());
{
Object var_0 = renderContext.call("xss", _global_obj.getMessage()), "text");
out.write(renderContext.getObjectModel().toString(var_0));
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)