Convert many examples to java backend

**do not review yet**
Why is this needed?  And in general, why do we need to get the SMT involved here?  It looks like all we need is unification.  Also, the rule above is incorrect in some type systems, for example ones with infinite types.  @andreistefanescu can you please step in here and help us simplify things out?