static public int test_0_npe_still_happens() { OpenFinal x = null; SealedFinal y = null; try { y.method1(); return(1); } catch (NullReferenceException e) { ;//ok } try { y.method2(); return(2); } catch (NullReferenceException e) { ;//ok } try { y.method3(); return(3); } catch (NullReferenceException e) { ;//ok } try { x.method4(); return(4); } catch (NullReferenceException e) { ;//ok } try { x.method5(); return(5); } catch (NullReferenceException e) { ;//ok } return(0); }
static public int test_0_sealed_class_devirt_right_method() { SealedFinal x = new SealedFinal(); if (x.method1() != 4) { return(1); } if (x.method2() != 2) { return(2); } if (x.method3() != 1) { return(1); } return(0); }
static public int test_0_sealed_class_devirt_right_method_using_delegates() { SealedFinal x = new SealedFinal(); IntNoArgs d1 = new IntNoArgs(x.method1); IntNoArgs d2 = new IntNoArgs(x.method2); IntNoArgs d3 = new IntNoArgs(x.method3); if (d1() != 4) { return(1); } if (d2() != 2) { return(2); } if (d3() != 1) { return(1); } return(0); }
static public int test_0_sealed_class_devirt_right_method () { SealedFinal x = new SealedFinal (); if (x.method1 () != 4) return 1; if (x.method2 () != 2) return 2; if (x.method3 () != 1) return 1; return 0; }
static public int test_0_sealed_class_devirt_right_method_using_delegates () { SealedFinal x = new SealedFinal (); IntNoArgs d1 = new IntNoArgs(x.method1); IntNoArgs d2 = new IntNoArgs(x.method2); IntNoArgs d3 = new IntNoArgs(x.method3); if (d1 () != 4) return 1; if (d2 () != 2) return 2; if (d3 () != 1) return 1; return 0; }