PageRenderTime 28ms CodeModel.GetById 19ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/test/kilim/test/ex/ExInvalid.java

http://github.com/kilim/kilim
Java | 80 lines | 63 code | 9 blank | 8 comment | 0 complexity | 3c387dcee9b42c18938cfa636e7d2ec6 MD5 | raw file
 1package kilim.test.ex;
 2
 3import kilim.Pausable;
 4import kilim.Task;
 5
 6// Just a ununsed public class to make it easy to have a bunch of related test
 7// classes in one file
 8public class ExInvalid {
 9}
10
11class ExInvalidConstructor {
12    ExInvalidConstructor() throws Pausable {}
13}
14class ExInvalidConstructor2 {
15    ExInvalidConstructor2() throws Exception {
16        Task.sleep(1000);
17    }
18}
19class ExInvalidConstructor3 {
20    ExInvalidConstructor3() throws Pausable {
21        Task.sleep(1000);
22    }
23}
24class ExInvalidStaticBlock {
25    static void foo() throws Pausable {}
26    static {
27        try { foo(); }
28        catch (Exception ex) {}
29    }
30}
31class ExInvalidCallP_NP {
32    void foo() throws Pausable {}
33    void bar() throws Exception {
34        foo();
35    }
36}
37
38// illegal to override a non-pausable method with a pausable one
39class ExNPSuper {
40    void foo() throws Exception {}
41}
42class ExInvalidPDerived extends ExNPSuper {
43    void foo() throws Pausable {}
44}
45
46//illegal to override a pausable method with a non-pausable one
47class ExPSuper {
48    void foo() throws Pausable {}
49}
50class ExInvalidNPDerived extends ExPSuper {
51    void foo() {
52        
53    }   
54}
55
56
57//------------------------------------------------
58// Illegal to override an pausable interface method with a non-pausable one
59interface ExPFoo {
60    void foo() throws Pausable;
61}
62interface ExInvalidNPFace extends ExPFoo {
63    void foo();
64}
65class ExInvalidNPImp implements ExPFoo {
66    public void foo() {
67    }
68}
69
70//------------------------------------------------
71//Illegal to override a non-pausable interface method with a pausable one
72interface ExNPFoo {
73    void foo() throws Exception;
74}
75class ExInvalidPImp implements ExNPFoo {
76    public void foo() throws Pausable {}
77}
78interface ExInvalidPFace extends ExNPFoo {
79    void foo() throws Pausable;
80}