(0) Obligation:
JBC Problem based on JBC Program:
/**
* A loop that might potentially throw a <tt>NullPointerException</tt>
* because of the instance field access <tt>exc.f</tt>. If that happened,
* the loop would diverge since the exception handler does not include any
* progress statement. However, Julia can prove that <tt>exc</tt> is not
* <tt>null</tt> at the point where <tt>exc.f</tt> is accessed, so that
* no exception can be thrown there. Hence the loop is proved to terminate.
*
* All calls terminate.
*
* Julia + BinTerm prove that all calls terminate.
*
* Note: without a preliminary nullness analysis, termination could not
* be proved.
*
* @author <A HREF="mailto:fausto.spoto@univr.it">Fausto Spoto</A>
*/
public class Exc {
private int f;
public static void main(String[] args) {
Exc exc = new Exc();
int i = 0;
while (i < 20) {
try {
if (i > 10) exc.f = 5;
i += 2;
}
catch (NullPointerException e) {
}
}
}
}
(1) JBCToGraph (SOUND transformation)
Constructed TerminationGraph.
(2) Obligation:
Termination Graph based on JBC Program:
Exc.main([Ljava/lang/String;)V: Graph of 129 nodes with 0 SCCs.
(3) TerminationGraphToSCCProof (SOUND transformation)
Proven termination by absence of SCCs
(4) TRUE