Affects Version/s: None
Fix Version/s: 3.1
Follow up from
As an implementation to the extension of statement executions in JEXL we could introduce the use of annotations to each statement or block in the script, i.e.
Each statement block should be allowed to have only one annotation but it would be convenient to allow the syntax
which should be syntaxically equivalent to:
From the JexlEngine point of view, each annotation could be implemented in the form of Interceptor interface, for example
The annotation syntax should allow for zero, one or more parameters. Those parameters should be evaluated before interceptor execution and submitted to the Interceptor.onExecute() method via args parameter.
JexlEngine should be given a method to register annotation interceptor based on annotation name, and the one for default interceptor, which should be called before each statement execution as if @default annotation is declared in each statement in script.
The JexlStatement is the proposed new interface to somehow identify the statement or block of code which may also provide some info about it's stack frame.
The JexlStatement.interpret() method should trigger the execution of the statement block, returning statement's result as its return value.
In the absence of a matching interceptor corresponding to the annotation name, JexlEngine should simply ignore that, or write some diagnostic message in the log file.
Such implementation could provide developers with excellent tool to add various checks and enhancements to scripting without pushing for new features that eventually would mess up the basic code. The JEXL-185 issue could also be dropped since tracing could be added easily via interceptors.