sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Radu Cotescu (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (SLING-7207) Get rid of runtime reflection in HTL expression evaluation
Date Wed, 29 Aug 2018 14:53:00 GMT

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

Radu Cotescu resolved SLING-7207.
---------------------------------
    Resolution: Won't Do

> 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
>            Priority: Major
>
> 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
(v7.6.3#76005)

Mime
View raw message