[#13086] - Use Target-typing for expressions

Category:
Feature request
Priority:
Normal
Status:
New
Project: Severity:
Minor
Resolution:
Open
Component: Reproducibility:
N/A
Assigned to:
0

Expressions now, via the parameter, variable or field declaration, allow fully generic types which is great.

However it would be helpful for these types to be used to condition how the expression is parsed.

It is often useful to add local 'functions' to the report as variables (or more often parameters). For example, currently you could declare a local function as a param (say of type java.util.function.BiFunction<Integer, Integer, String>) with:

(java.util.function.BiFunction<Integer, Integer, String>) ((a, b) -> {
... statements, possibly with control flow, to declare and compute foo
return foo;
})

Such that it can be invoked in another expression with $P{myFunction}.apply($F{field1}, $F{field2})

With target typing the expression becomes...

(a, b) -> {
... statements, possibly with control flow
return foo;
}

It's possible that this could be implemented purely by wrapping the expression in a cast using the parameter type information but you may not want to always do so a property may be desirable.

v6
alpha.sierra.nz's picture
Joined: Oct 28 2019 - 5:28pm
Last seen: 4 months 1 week ago
Feedback
randomness