Jump to content
  • Use Target-typing for expressions

    CategoryFeature request

    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) with:


    (java.util.function.BiFunction) ((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.

    User Feedback

    Recommended Comments

    There are no comments to display.

  • Create New...