3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-26 10:35:33 +00:00

Do not needlessly catch exceptions in Java bindings

A lot of existing code in Java bindings catches exceptions just to
silence them later.

This is:
a) Unnecessary: it is OK for a function to throw a RuntimeException
without declaring it.
b) Highly unidiomatic and not recommended by Java experts (see Effective
Java and others)
c) Confusing as has the potential to hide the existing bugs and have
them resurface at the most inconvenient/unexpected moment.
This commit is contained in:
George Karpenkov 2016-06-12 14:14:11 +02:00
parent 19f98547f7
commit dfc80d3b69
19 changed files with 34 additions and 161 deletions

View file

@ -68,12 +68,6 @@ public class FiniteDomainNum extends FiniteDomainExpr
@Override
public String toString()
{
try
{
return Native.getNumeralString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e)
{
return "Z3Exception: " + e.getMessage();
}
return Native.getNumeralString(getContext().nCtx(), getNativeObject());
}
}