Gracefully fail when submit_rule/1 has no solutions

If a submit_rule is coded with no solution for a change, e.g.:

  submit_rule(submit()) :- fail.

the server used to crash with 500s from a number of REST APIs,
caused by a ClassCastException inside of SubmitRuleEvaluator.

An empty result list is not a ListTerm, it is a SymbolTerm and using
the NIL instance '[]'. This cannot be cast to a ListTerm for return
to the caller.

Instead return List<Term> and handle the conversion, ensuring an
empty list is returned to callers when there are no results.

Change-Id: Iea1211afb2f3970ba98ea1eff14df07452cf5ccd
4 files changed