|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| package edu.rice.cs.javalanglevels; |
|
38 |
| |
|
39 |
| import edu.rice.cs.javalanglevels.tree.*; |
|
40 |
| import edu.rice.cs.javalanglevels.parser.*; |
|
41 |
| import edu.rice.cs.plt.reflect.JavaVersion; |
|
42 |
| |
|
43 |
| import java.util.*; |
|
44 |
| import java.io.*; |
|
45 |
| |
|
46 |
| import junit.framework.TestCase; |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
| public class BodyBodyFullJavaVisitor extends FullJavaVisitor { |
|
54 |
| |
|
55 |
| |
|
56 |
| private BodyData _bodyData; |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| |
|
63 |
| |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
| |
|
69 |
| |
|
70 |
| |
|
71 |
52
| public BodyBodyFullJavaVisitor(BodyData bodyData,
|
|
72 |
| File file, |
|
73 |
| String packageName, |
|
74 |
| String enclosingClassName, |
|
75 |
| LinkedList<String> importedFiles, |
|
76 |
| LinkedList<String> importedPackages, |
|
77 |
| HashSet<String> classesInThisFile, |
|
78 |
| Hashtable<String, Triple<SourceInfo, LanguageLevelVisitor, SymbolData>> continuations, |
|
79 |
| LinkedList<Command> fixUps, |
|
80 |
| HashSet<String> innerClassesInThisBody, |
|
81 |
| HashMap<String, SymbolData> genericTypes) { |
|
82 |
52
| super(file, packageName, enclosingClassName, importedFiles, importedPackages, classesInThisFile, continuations,
|
|
83 |
| fixUps, genericTypes); |
|
84 |
| |
|
85 |
52
| _bodyData = bodyData;
|
|
86 |
| |
|
87 |
52
| SymbolData objectSD = symbolTable.get("java.lang.Object");
|
|
88 |
52
| SymbolData integerSD = symbolTable.get("java.lang.Integer");
|
|
89 |
52
| assert objectSD != null && integerSD != null;
|
|
90 |
52
| assert integerSD.isAssignableTo(objectSD, JavaVersion.JAVA_5);
|
|
91 |
| } |
|
92 |
| |
|
93 |
| |
|
94 |
| |
|
95 |
| |
|
96 |
| |
|
97 |
| |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
| |
|
102 |
| |
|
103 |
| |
|
104 |
| |
|
105 |
18
| public BodyBodyFullJavaVisitor(BodyData bodyData,
|
|
106 |
| File file, |
|
107 |
| String packageName, |
|
108 |
| String enclosingClassName, |
|
109 |
| LinkedList<String> importedFiles, |
|
110 |
| LinkedList<String> importedPackages, |
|
111 |
| HashSet<String> classesInThisFile, |
|
112 |
| Hashtable<String, Triple<SourceInfo, LanguageLevelVisitor, SymbolData>> continuations, |
|
113 |
| LinkedList<Command> fixUps, |
|
114 |
| HashSet<String> innerClassesInThisBody) { |
|
115 |
18
| super(file, packageName, enclosingClassName, importedFiles, importedPackages, classesInThisFile, continuations, fixUps);
|
|
116 |
18
| _bodyData = bodyData;
|
|
117 |
| |
|
118 |
18
| SymbolData objectSD = symbolTable.get("java.lang.Object");
|
|
119 |
18
| SymbolData integerSD = symbolTable.get("java.lang.Integer");
|
|
120 |
18
| assert objectSD != null && integerSD != null;
|
|
121 |
18
| assert integerSD.isAssignableTo(objectSD, JavaVersion.JAVA_5);
|
|
122 |
| } |
|
123 |
| |
|
124 |
| |
|
125 |
1
| public Void forMethodDefDoFirst(MethodDef that) { return null; }
|
|
126 |
| |
|
127 |
| |
|
128 |
| |
|
129 |
| |
|
130 |
| |
|
131 |
| |
|
132 |
0
| public Void forInstanceInitializer(InstanceInitializer that) { return forBlock(that.getCode()); }
|
|
133 |
| |
|
134 |
| |
|
135 |
10
| public Void forBlock(Block that) {
|
|
136 |
10
| forBlockDoFirst(that);
|
|
137 |
0
| if (prune(that)) return null;
|
|
138 |
10
| BlockData bd = new BlockData(_bodyData);
|
|
139 |
10
| _bodyData.addBlock(bd);
|
|
140 |
10
| that.getStatements().visit(new BodyBodyFullJavaVisitor(bd, _file, _package, _enclosingClassName, _importedFiles,
|
|
141 |
| _importedPackages, _classesInThisFile, continuations, fixUps, |
|
142 |
| new HashSet<String>(), _genericTypes)); |
|
143 |
10
| return forBlockOnly(that);
|
|
144 |
| } |
|
145 |
| |
|
146 |
| |
|
147 |
1
| public Void forCatchBlock(CatchBlock that) {
|
|
148 |
1
| forCatchBlockDoFirst(that);
|
|
149 |
0
| if (prune(that)) return null;
|
|
150 |
| |
|
151 |
1
| Block b = that.getBlock();
|
|
152 |
1
| forBlockDoFirst(b);
|
|
153 |
0
| if (prune(b)) return null;
|
|
154 |
1
| BlockData bd = new BlockData(_bodyData);
|
|
155 |
1
| _bodyData.addBlock(bd);
|
|
156 |
| |
|
157 |
1
| SymbolData enclosing = getQualifiedSymbolData(_enclosingClassName);
|
|
158 |
1
| VariableData exceptionVar =
|
|
159 |
| formalParameters2VariableData(new FormalParameter[]{ that.getException() }, enclosing)[0]; |
|
160 |
1
| bd.addVar(exceptionVar);
|
|
161 |
| |
|
162 |
1
| BodyBodyFullJavaVisitor bbfjv =
|
|
163 |
| new BodyBodyFullJavaVisitor(bd, _file, _package, _enclosingClassName, _importedFiles, |
|
164 |
| _importedPackages, _classesInThisFile, continuations, fixUps, |
|
165 |
| new HashSet<String>(), _genericTypes); |
|
166 |
1
| b.getStatements().visit(bbfjv);
|
|
167 |
1
| forBlockOnly(b);
|
|
168 |
1
| return forCatchBlockOnly(that);
|
|
169 |
| } |
|
170 |
| |
|
171 |
| |
|
172 |
14
| public Void forVariableDeclarationOnly(VariableDeclaration that) {
|
|
173 |
| |
|
174 |
14
| if (! _bodyData.addVars(_variableDeclaration2VariableData(that, _bodyData))) {
|
|
175 |
| |
|
176 |
| |
|
177 |
| |
|
178 |
| } |
|
179 |
14
| return null;
|
|
180 |
| } |
|
181 |
| |
|
182 |
| |
|
183 |
4
| public Void forTryCatchStatementDoFirst(TryCatchStatement that) { return null; }
|
|
184 |
| |
|
185 |
| |
|
186 |
7
| public Void forInnerClassDef(InnerClassDef that) {
|
|
187 |
| |
|
188 |
7
| SymbolData enclosingClass = _bodyData.getSymbolData();
|
|
189 |
7
| assert _enclosingClassName.equals(getQualifiedClassName(enclosingClass.getName()));
|
|
190 |
| |
|
191 |
7
| String relName = that.getName().getText();
|
|
192 |
7
| String fullName = _enclosingClassName + '$' + enclosingClass.preincrementLocalClassNum() + relName;
|
|
193 |
| |
|
194 |
| |
|
195 |
7
| handleInnerClassDef(that, _bodyData, relName, fullName);
|
|
196 |
| |
|
197 |
7
| return null;
|
|
198 |
| } |
|
199 |
| |
|
200 |
| |
|
201 |
3
| public Void forInnerInterfaceDef(InnerInterfaceDef that) {
|
|
202 |
3
| _addAndIgnoreError("Local interfaces are illegal in Java.", that);
|
|
203 |
3
| return null;
|
|
204 |
| } |
|
205 |
| |
|
206 |
| |
|
207 |
| |
|
208 |
| |
|
209 |
| |
|
210 |
| |
|
211 |
| |
|
212 |
| |
|
213 |
| |
|
214 |
| |
|
215 |
| |
|
216 |
| |
|
217 |
| |
|
218 |
| |
|
219 |
| |
|
220 |
| |
|
221 |
0
| public Void forSimpleAnonymousClassInstantiation(SimpleAnonymousClassInstantiation that) {
|
|
222 |
0
| SymbolData enclosing = getQualifiedSymbolData(_enclosingClassName);
|
|
223 |
0
| assert enclosing != null;
|
|
224 |
0
| simpleAnonymousClassInstantiationHelper(that, enclosing);
|
|
225 |
0
| return null;
|
|
226 |
| } |
|
227 |
| |
|
228 |
| |
|
229 |
0
| public Void forComplexAnonymousClassInstantiation(ComplexAnonymousClassInstantiation that) {
|
|
230 |
0
| SymbolData enclosing = getQualifiedSymbolData(_enclosingClassName);
|
|
231 |
0
| assert enclosing != null;
|
|
232 |
0
| complexAnonymousClassInstantiationHelper(that, enclosing);
|
|
233 |
0
| return null;
|
|
234 |
| } |
|
235 |
| |
|
236 |
| |
|
237 |
| public static class BodyBodyFullJavaVisitorTest extends TestCase { |
|
238 |
| |
|
239 |
| private BodyBodyFullJavaVisitor _bfv; |
|
240 |
| |
|
241 |
| private SymbolData _sd1; |
|
242 |
| private MethodData _md1; |
|
243 |
| private ModifiersAndVisibility _publicMav = new ModifiersAndVisibility(SourceInfo.NONE, new String[] {"public"}); |
|
244 |
| private ModifiersAndVisibility _protectedMav = |
|
245 |
| new ModifiersAndVisibility(SourceInfo.NONE, new String[] {"protected"}); |
|
246 |
| private ModifiersAndVisibility _privateMav = |
|
247 |
| new ModifiersAndVisibility(SourceInfo.NONE, new String[] {"private"}); |
|
248 |
| private ModifiersAndVisibility _packageMav = new ModifiersAndVisibility(SourceInfo.NONE, new String[0]); |
|
249 |
| private ModifiersAndVisibility _abstractMav = |
|
250 |
| new ModifiersAndVisibility(SourceInfo.NONE, new String[] {"abstract"}); |
|
251 |
| private ModifiersAndVisibility _finalMav = new ModifiersAndVisibility(SourceInfo.NONE, new String[] {"final"}); |
|
252 |
| private ModifiersAndVisibility _staticMav = new ModifiersAndVisibility(SourceInfo.NONE, new String[] {"static"}); |
|
253 |
| |
|
254 |
| |
|
255 |
0
| public BodyBodyFullJavaVisitorTest() { this(""); }
|
|
256 |
| |
|
257 |
7
| public BodyBodyFullJavaVisitorTest(String name) { super(name); }
|
|
258 |
| |
|
259 |
7
| public void setUp() {
|
|
260 |
7
| _sd1 = new SymbolData("i.like.monkey");
|
|
261 |
7
| _md1 = new MethodData("methodName", _publicMav, new TypeParameter[0], SymbolData.INT_TYPE,
|
|
262 |
| new VariableData[0], |
|
263 |
| new String[0], |
|
264 |
| _sd1, |
|
265 |
| null); |
|
266 |
| |
|
267 |
7
| errors = new LinkedList<Pair<String, JExpressionIF>>();
|
|
268 |
7
| LanguageLevelConverter.symbolTable.clear();
|
|
269 |
7
| LanguageLevelConverter._newSDs.clear();
|
|
270 |
| |
|
271 |
7
| LanguageLevelConverter.symbolTable.put("i.like.monkey", _sd1);
|
|
272 |
7
| visitedFiles = new LinkedList<Pair<LanguageLevelVisitor, edu.rice.cs.javalanglevels.tree.SourceFile>>();
|
|
273 |
| |
|
274 |
7
| _bfv = new BodyBodyFullJavaVisitor(_md1,
|
|
275 |
| new File(""), |
|
276 |
| "", |
|
277 |
| "i.like.monkey", |
|
278 |
| new LinkedList<String>(), |
|
279 |
| new LinkedList<String>(), |
|
280 |
| new HashSet<String>(), |
|
281 |
| new Hashtable<String, Triple<SourceInfo, LanguageLevelVisitor, SymbolData>>(), |
|
282 |
| new LinkedList<Command>(), |
|
283 |
| new HashSet<String>()); |
|
284 |
7
| assert _bfv._enclosingClassName.equals("i.like.monkey");
|
|
285 |
7
| _bfv._classesInThisFile = new HashSet<String>();
|
|
286 |
7
| _bfv.continuations = new Hashtable<String, Triple<SourceInfo, LanguageLevelVisitor, SymbolData>>();
|
|
287 |
| |
|
288 |
7
| _bfv._importedPackages.addFirst("java.lang");
|
|
289 |
7
| _errorAdded = false;
|
|
290 |
7
| _sd1.setIsContinuation(false);
|
|
291 |
7
| _sd1.setInterface(false);
|
|
292 |
7
| _sd1.setPackage("");
|
|
293 |
7
| _sd1.setTypeParameters(new TypeParameter[0]);
|
|
294 |
7
| SymbolData objectSD = _bfv.getQualifiedSymbolData("java.lang.Object", SourceInfo.NONE);
|
|
295 |
7
| _sd1.setSuperClass(objectSD);
|
|
296 |
7
| _sd1.setInterfaces(new ArrayList<SymbolData>());
|
|
297 |
| } |
|
298 |
| |
|
299 |
1
| public void testSetUp() {
|
|
300 |
1
| assertFalse("i.like.monkey is present", _bfv.getQualifiedSymbolData("i.like.monkey", SourceInfo.NONE) == null);
|
|
301 |
1
| assertEquals("_enclosingClassName is set", "i.like.monkey", _bfv._enclosingClassName);
|
|
302 |
| } |
|
303 |
| |
|
304 |
1
| public void testForMethodDefDoFirst() {
|
|
305 |
1
| ConcreteMethodDef cmd = new ConcreteMethodDef(SourceInfo.NONE,
|
|
306 |
| _packageMav, |
|
307 |
| new TypeParameter[0], |
|
308 |
| new PrimitiveType(SourceInfo.NONE, "int"), |
|
309 |
| new Word(SourceInfo.NONE, "methodName"), |
|
310 |
| new FormalParameter[0], |
|
311 |
| new ReferenceType[0], |
|
312 |
| new BracedBody(SourceInfo.NONE, new BodyItemI[0])); |
|
313 |
1
| cmd.visit(_bfv);
|
|
314 |
1
| assertEquals("There should be no errors", 0, errors.size());
|
|
315 |
| |
|
316 |
| |
|
317 |
| |
|
318 |
| } |
|
319 |
| |
|
320 |
| |
|
321 |
| |
|
322 |
| |
|
323 |
1
| public void testForVariableDeclarationOnly() {
|
|
324 |
| |
|
325 |
1
| VariableDeclarator[] vdecs = new VariableDeclarator[] {
|
|
326 |
| new UninitializedVariableDeclarator(SourceInfo.NONE, |
|
327 |
| new PrimitiveType(SourceInfo.NONE, "double"), |
|
328 |
| new Word (SourceInfo.NONE, "field1")), |
|
329 |
| new UninitializedVariableDeclarator(SourceInfo.NONE, |
|
330 |
| new PrimitiveType(SourceInfo.NONE, "boolean"), |
|
331 |
| new Word (SourceInfo.NONE, "field2"))}; |
|
332 |
1
| VariableDeclaration vdecl = new VariableDeclaration(SourceInfo.NONE, _packageMav, vdecs);
|
|
333 |
| |
|
334 |
1
| VariableData vd1 = new VariableData("field1", _packageMav, SymbolData.DOUBLE_TYPE, false, _bfv._bodyData);
|
|
335 |
1
| VariableData vd2 = new VariableData("field2", _packageMav, SymbolData.BOOLEAN_TYPE, false, _bfv._bodyData);
|
|
336 |
1
| vdecl.visit(_bfv);
|
|
337 |
1
| assertEquals("There should not be any errors.", 0, errors.size());
|
|
338 |
1
| LinkedList<VariableData> vars = _md1.getVars();
|
|
339 |
| |
|
340 |
| |
|
341 |
| |
|
342 |
| |
|
343 |
| |
|
344 |
| |
|
345 |
1
| assertTrue("field1 was added.", vars.contains(vd1));
|
|
346 |
1
| assertTrue("field2 was added.", vars.contains(vd2));
|
|
347 |
| |
|
348 |
| |
|
349 |
1
| VariableDeclaration vdecl2 = new VariableDeclaration(SourceInfo.NONE,
|
|
350 |
| _packageMav, |
|
351 |
| new VariableDeclarator[] { |
|
352 |
| new UninitializedVariableDeclarator(SourceInfo.NONE, |
|
353 |
| new PrimitiveType(SourceInfo.NONE, "double"), |
|
354 |
| new Word (SourceInfo.NONE, "field3")), |
|
355 |
| new UninitializedVariableDeclarator(SourceInfo.NONE, |
|
356 |
| new PrimitiveType(SourceInfo.NONE, "int"), |
|
357 |
| new Word (SourceInfo.NONE, "field3"))}); |
|
358 |
1
| VariableData vd3 = new VariableData("field3", _packageMav, SymbolData.DOUBLE_TYPE, false, _bfv._bodyData);
|
|
359 |
1
| vdecl2.visit(_bfv);
|
|
360 |
1
| assertEquals("There should still be no errors.", 0, errors.size());
|
|
361 |
| |
|
362 |
| |
|
363 |
| |
|
364 |
| |
|
365 |
| |
|
366 |
1
| assertTrue("field3 was added.", _md1.getVars().contains(vd3));
|
|
367 |
| } |
|
368 |
| |
|
369 |
1
| public void testForTryCatchStatement() {
|
|
370 |
| |
|
371 |
1
| BracedBody emptyBody = new BracedBody(SourceInfo.NONE, new BodyItemI[0]);
|
|
372 |
1
| Block b = new Block(SourceInfo.NONE, emptyBody);
|
|
373 |
| |
|
374 |
1
| NormalTryCatchStatement ntcs = new NormalTryCatchStatement(SourceInfo.NONE, b, new CatchBlock[0]);
|
|
375 |
1
| TryCatchFinallyStatement tcfs = new TryCatchFinallyStatement(SourceInfo.NONE, b, new CatchBlock[0], b);
|
|
376 |
1
| ntcs.visit(_bfv);
|
|
377 |
1
| tcfs.visit(_bfv);
|
|
378 |
1
| assertEquals("After visiting NormalTryCatchStatement and TryCatchFinallyStatement, there should be no errors",
|
|
379 |
| 0, errors.size()); |
|
380 |
| |
|
381 |
| |
|
382 |
1
| BracedBody errorBody = new BracedBody(SourceInfo.NONE, new BodyItemI[] {
|
|
383 |
| new ExpressionStatement(SourceInfo.NONE, |
|
384 |
| new BitwiseOrExpression(SourceInfo.NONE, |
|
385 |
| new IntegerLiteral(SourceInfo.NONE, 1), |
|
386 |
| new IntegerLiteral(SourceInfo.NONE, 2)))}); |
|
387 |
1
| Block errorBlock = new Block(SourceInfo.NONE, errorBody);
|
|
388 |
| |
|
389 |
1
| ntcs = new NormalTryCatchStatement(SourceInfo.NONE, errorBlock, new CatchBlock[0]);
|
|
390 |
1
| ntcs.visit(_bfv);
|
|
391 |
| |
|
392 |
1
| assertEquals("Should be no errors", 0, errors.size());
|
|
393 |
| |
|
394 |
| |
|
395 |
1
| UninitializedVariableDeclarator uvd =
|
|
396 |
| new UninitializedVariableDeclarator(SourceInfo.NONE, |
|
397 |
| new PrimitiveType(SourceInfo.NONE, "int"), |
|
398 |
| new Word(SourceInfo.NONE, "i")); |
|
399 |
1
| FormalParameter fp = new FormalParameter(SourceInfo.NONE, uvd, false);
|
|
400 |
| |
|
401 |
1
| tcfs = new TryCatchFinallyStatement(SourceInfo.NONE, b, new CatchBlock[] {
|
|
402 |
| new CatchBlock(SourceInfo.NONE, fp, errorBlock)}, b); |
|
403 |
| |
|
404 |
1
| tcfs.visit(_bfv);
|
|
405 |
| |
|
406 |
1
| assertEquals("Should be no errors", 0, errors.size());
|
|
407 |
| } |
|
408 |
| |
|
409 |
1
| public void testForInnerClassDef() {
|
|
410 |
| |
|
411 |
| |
|
412 |
1
| InnerClassDef cd0 =
|
|
413 |
| new InnerClassDef(SourceInfo.NONE, |
|
414 |
| _packageMav, |
|
415 |
| new Word(SourceInfo.NONE, "Rod"), |
|
416 |
| new TypeParameter[0], |
|
417 |
| new ClassOrInterfaceType(SourceInfo.NONE, "java.lang.Object", new Type[0]), |
|
418 |
| new ReferenceType[0], |
|
419 |
| new BracedBody(SourceInfo.NONE, new BodyItemI[0])); |
|
420 |
1
| cd0.visit(_bfv);
|
|
421 |
1
| assertEquals("There should be no errors", 0, errors.size());
|
|
422 |
1
| SymbolData innerClass = _bfv._bodyData.getInnerClassOrInterface("Rod");
|
|
423 |
1
| assertNotNull("Should have a inner class named Rod", innerClass);
|
|
424 |
| |
|
425 |
| |
|
426 |
1
| InnerClassDef cd1 =
|
|
427 |
| new InnerClassDef(SourceInfo.NONE, |
|
428 |
| _publicMav, |
|
429 |
| new Word(SourceInfo.NONE, "Todd"), |
|
430 |
| new TypeParameter[0], |
|
431 |
| new ClassOrInterfaceType(SourceInfo.NONE, "java.lang.Object", new Type[0]), |
|
432 |
| new ReferenceType[0], |
|
433 |
| new BracedBody(SourceInfo.NONE, new BodyItemI[0])); |
|
434 |
1
| cd1.visit(_bfv);
|
|
435 |
1
| assertEquals("There should be no errors", 0, errors.size());
|
|
436 |
| } |
|
437 |
| |
|
438 |
1
| public void testForInnerInterfaceDef() {
|
|
439 |
| |
|
440 |
1
| InnerInterfaceDef iid =
|
|
441 |
| new InnerInterfaceDef(SourceInfo.NONE, |
|
442 |
| _packageMav, |
|
443 |
| new Word(SourceInfo.NONE, "Broken"), |
|
444 |
| new TypeParameter[0], |
|
445 |
| new ReferenceType[0], |
|
446 |
| new BracedBody(SourceInfo.NONE, new BodyItemI[0])); |
|
447 |
1
| iid.visit(_bfv);
|
|
448 |
1
| assertEquals("There should be one error", 1, errors.size());
|
|
449 |
1
| assertEquals("The error message should be correct",
|
|
450 |
| "Local interfaces are illegal in Java.", errors.get(0).getFirst()); |
|
451 |
1
| SymbolData innerInterface = _bfv._bodyData.getInnerClassOrInterface("Broken");
|
|
452 |
1
| assertNull("Should NOT have a inner interface named Broken", innerInterface);
|
|
453 |
| |
|
454 |
| |
|
455 |
1
| InnerInterfaceDef id0 =
|
|
456 |
| new InnerInterfaceDef(SourceInfo.NONE, |
|
457 |
| _packageMav, |
|
458 |
| new Word(SourceInfo.NONE, "RodInterface"), |
|
459 |
| new TypeParameter[0], |
|
460 |
| new ReferenceType[0], |
|
461 |
| new BracedBody(SourceInfo.NONE, new BodyItemI[0])); |
|
462 |
1
| id0.visit(_bfv);
|
|
463 |
1
| assertEquals("There should be 2 errors", 2, errors.size());
|
|
464 |
1
| assertEquals("The error message should be correct",
|
|
465 |
| "Local interfaces are illegal in Java.", errors.get(1).getFirst()); |
|
466 |
1
| innerInterface = _bfv._bodyData.getInnerClassOrInterface("RodInterface");
|
|
467 |
1
| assertNull("Should NOT have a inner interface named RodInterface", innerInterface);
|
|
468 |
| |
|
469 |
| |
|
470 |
1
| InnerInterfaceDef id1 =
|
|
471 |
| new InnerInterfaceDef(SourceInfo.NONE, |
|
472 |
| _publicMav, |
|
473 |
| new Word(SourceInfo.NONE, "Todd"), |
|
474 |
| new TypeParameter[0], |
|
475 |
| new ReferenceType[0], |
|
476 |
| new BracedBody(SourceInfo.NONE, new BodyItemI[0])); |
|
477 |
1
| id1.visit(_bfv);
|
|
478 |
1
| assertEquals("There should be three errors", 3, errors.size());
|
|
479 |
1
| assertEquals("The error message should be correct",
|
|
480 |
| "Local interfaces are illegal in Java.", errors.get(2).getFirst()); |
|
481 |
1
| innerInterface = _bfv._bodyData.getInnerClassOrInterface("Todd");
|
|
482 |
1
| assertNull("Should NOT have a inner interface named Todd", innerInterface);
|
|
483 |
| } |
|
484 |
1
| public void testDummy() { }
|
|
485 |
| } |
|
486 |
| } |