package Coba.DoesNotTerminate; /** * A class with an non-terminating method, that would cause stack overflow. Because * Java itself detects the overflow, and throws an exception, this case can be handled * by T3's internal itself. */ public class DoesNotTerminate { public DoesNotTerminate() { } public long endless1(long x1, long x2, long x3, long x4, long x5, long x21, long x22, long x23, long x24, long x25, long x31, long x32, long x33, long x34, long x35, long x41, long x42, long x43, long x44, long x45, long x51, long x52, long x53, long x54, long x55) { return endless1(x51,x52,x53,x54,x55, x41,x42,x43,x44,x45, x31,x32,x33,x34,x35, x21,x22,x23,x24,x25, x1,x2,x3,x4,x5 ) + 1 ; } // this variant will print the thrown exception, but due to the printing, // will take much longer to run.... private long endless2(long x1, long x2, long x3, long x4, long x5, long x21, long x22, long x23, long x24, long x25, long x31, long x32, long x33, long x34, long x35, long x41, long x42, long x43, long x44, long x45, long x51, long x52, long x53, long x54, long x55) { try { return endless2(x51,x52,x53,x54,x55, x41,x42,x43,x44,x45, x31,x32,x33,x34,x35, x21,x22,x23,x24,x25, x1,x2,x3,x4,x5 ) + 1 ; } catch(Throwable e) { System.err.println(">>>>>>" + e) ; throw e ; } } }