author | alundblad |
Wed, 26 Aug 2015 09:02:02 +0200 | |
changeset 32337 | c9d3ab9f601c |
parent 14554 | 4e29b285c723 |
permissions | -rw-r--r-- |
14554
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
1 |
/* |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
2 |
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
4 |
* |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
32337 | 7 |
* published by the Free Software Foundation. |
14554
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
8 |
* |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
13 |
* accompanied this code). |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
14 |
* |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
18 |
* |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
21 |
* questions. |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
22 |
*/ |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
23 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
24 |
package org.openjdk.tests.shapegen; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
25 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
26 |
import java.util.HashSet; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
27 |
import java.util.Set; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
28 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
29 |
import static org.openjdk.tests.shapegen.ClassCase.Kind.*; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
30 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
31 |
/** |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
32 |
* |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
33 |
* @author Robert Field |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
34 |
*/ |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
35 |
public class RuleGroup { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
36 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
37 |
final String name; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
38 |
private final Rule[] rules; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
39 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
40 |
public RuleGroup(String name, Rule[] rules) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
41 |
this.name = name; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
42 |
this.rules = rules; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
43 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
44 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
45 |
public boolean exec(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
46 |
boolean found = false; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
47 |
for (Rule rule : rules) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
48 |
if (rule.guard(cc)) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
49 |
if (found) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
50 |
throw new RuntimeException("Bad rules -- multiple matches " + toString() + " for " + cc); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
51 |
} else { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
52 |
rule.eval(cc); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
53 |
found = true; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
54 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
55 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
56 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
57 |
return found; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
58 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
59 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
60 |
@Override |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
61 |
public String toString() { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
62 |
return name; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
63 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
64 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
65 |
public static RuleGroup PROVENENCE = new RuleGroup("Provenence", new Rule[] { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
66 |
new Rule("P-CDeclare") { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
67 |
boolean guard(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
68 |
return cc.isa(CCONCRETE, CABSTRACT); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
69 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
70 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
71 |
void eval(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
72 |
cc.set_mprov(cc); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
73 |
cc.set_HasClassMethod(true); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
74 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
75 |
}, |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
76 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
77 |
new Rule("P-IDeclare") { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
78 |
boolean guard(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
79 |
return cc.isa(IDEFAULT, IPRESENT); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
80 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
81 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
82 |
void eval(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
83 |
cc.set_mprov(cc); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
84 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
85 |
}, |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
86 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
87 |
new Rule("P-IntfInh") { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
88 |
boolean guard(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
89 |
return cc.isa(IVAC, CNONE) && !(cc.hasSuperclass() && cc.getSuperclass().get_HasClassMethod()); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
90 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
91 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
92 |
void eval(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
93 |
Set<ClassCase> _S = new HashSet<>(); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
94 |
for (ClassCase t : cc.getSupertypes()) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
95 |
_S.addAll(t.get_mprov()); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
96 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
97 |
Set<ClassCase> tops = new HashSet<>(); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
98 |
for (ClassCase _W : _S) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
99 |
for (ClassCase _V : _S) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
100 |
if (_V.equals(_W) || !(_V.isSubtypeOf(_W))) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
101 |
tops.add(_W); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
102 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
103 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
104 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
105 |
cc.set_mprov(tops); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
106 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
107 |
}, |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
108 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
109 |
new Rule("P-ClassInh") { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
110 |
boolean guard(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
111 |
return cc.isa(CNONE) && (cc.hasSuperclass() && cc.getSuperclass().get_HasClassMethod()); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
112 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
113 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
114 |
void eval(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
115 |
cc.set_mprov(cc.getSuperclass()); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
116 |
cc.set_HasClassMethod(true); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
117 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
118 |
}, |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
119 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
120 |
}); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
121 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
122 |
public static RuleGroup MARKER = new RuleGroup("Marker", new Rule[] { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
123 |
new Rule("M-Default") { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
124 |
boolean guard(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
125 |
return cc.isa(IDEFAULT); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
126 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
127 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
128 |
void eval(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
129 |
cc.set_HasDefault(true); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
130 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
131 |
}, |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
132 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
133 |
new Rule("M-Conc") { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
134 |
boolean guard(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
135 |
return cc.isa(CCONCRETE); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
136 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
137 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
138 |
void eval(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
139 |
cc.set_IsConcrete(true); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
140 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
141 |
}, |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
142 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
143 |
}); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
144 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
145 |
public static RuleGroup RESOLUTION = new RuleGroup("Resolution", new Rule[] { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
146 |
new Rule("R-Resolve") { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
147 |
boolean guard(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
148 |
if (!(cc.isClass() && cc.get_mprov().size() == 1)) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
149 |
return false; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
150 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
151 |
ClassCase _V = cc.get_mprov().iterator().next(); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
152 |
return _V.get_IsConcrete() || _V.get_HasDefault(); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
153 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
154 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
155 |
void eval(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
156 |
ClassCase _V = cc.get_mprov().iterator().next(); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
157 |
cc.set_mres(_V); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
158 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
159 |
}, |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
160 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
161 |
}); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
162 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
163 |
public static RuleGroup DEFENDER = new RuleGroup("Defender", new Rule[] { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
164 |
new Rule("D-Defend") { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
165 |
boolean guard(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
166 |
ClassCase mresSuper = cc.hasSuperclass() ? cc.getSuperclass().get_mres() : null; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
167 |
boolean eq = cc.get_mres() == null ? mresSuper == null : cc.get_mres().equals(mresSuper); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
168 |
return cc.isa(CNONE) && !eq; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
169 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
170 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
171 |
void eval(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
172 |
cc.set_mdefend(cc.get_mres()); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
173 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
174 |
}, |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
175 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
176 |
}); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
177 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
178 |
public static RuleGroup CHECKING = new RuleGroup("Checking", new Rule[] { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
179 |
new Rule("C-Check") { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
180 |
boolean guard(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
181 |
for (ClassCase t : cc.getSupertypes()) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
182 |
if (! t.get_OK()) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
183 |
return false; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
184 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
185 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
186 |
int defenderCount = 0; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
187 |
int provCount = 0; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
188 |
for (ClassCase prov : cc.get_mprov()) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
189 |
if (prov.get_HasDefault()) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
190 |
defenderCount++; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
191 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
192 |
provCount++; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
193 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
194 |
return provCount <= 1 || defenderCount == 0; |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
195 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
196 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
197 |
void eval(ClassCase cc) { |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
198 |
cc.set_OK(true); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
199 |
} |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
200 |
}, |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
201 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
202 |
}); |
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
203 |
|
4e29b285c723
8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff
changeset
|
204 |
} |