Major Problems in Rules Execution since openHAB5

script.model.ScriptInterpreter: emit what cannot be casted to what after a single evaluation of the cast by dilyanpalauzov · Pull Request #5329 · openhab/openhab-core · GitHub allows catching ClassCastExceptions in DSL Rules/Scripts/Transformations:

rule "System started"
when
    System reached start level 100
then
    try {
       s.state as Number
    } catch (ClassCastException e) {
       logError("A", "Caught ClassCastException")
    } finally {
       logError("A", "finally")
    }
end

will print “Caught ClassCastExceptionandfinally` instead of aborting.