[ 
https://issues.apache.org/jira/browse/SLING-7207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Radu Cotescu reassigned SLING-7207:
-----------------------------------

    Assignee: Radu Cotescu

> 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.20, Scripting HTL Compiler 
> 1.0.0, Scripting HTL Java Compiler 1.0.0
>            Reporter: Vlad Bailescu
>            Assignee: Radu Cotescu
>
> 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.class, 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)

Reply via email to