test/tools/javac/processing/model/util/filter/TestIterables.java

changeset 699
d2aaaec153e8
parent 554
9d9f26857129
child 1466
b52a38d4536c
equal deleted inserted replaced
698:f94af0667151 699:d2aaaec153e8
1 /* 1 /*
2 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
24 /* 24 /*
25 * @test 25 * @test
26 * @bug 6406164 26 * @bug 6406164
27 * @summary Test that ElementFilter iterable methods behave properly. 27 * @summary Test that ElementFilter iterable methods behave properly.
28 * @author Joseph D. Darcy 28 * @author Joseph D. Darcy
29 * @library ../../../../lib
30 * @build JavacTestingAbstractProcessor
29 * @compile TestIterables.java 31 * @compile TestIterables.java
30 * @compile -processor TestIterables -proc:only Foo1.java 32 * @compile -processor TestIterables -proc:only Foo1.java
31 * @compile Foo1.java 33 * @compile Foo1.java
32 * @compile -processor TestIterables Foo1 TestIterables.java 34 * @compile -processor TestIterables Foo1 TestIterables.java
33 */ 35 */
49 * Verify that the {@code ElementFilter} methods taking iterables 51 * Verify that the {@code ElementFilter} methods taking iterables
50 * behave correctly by comparing ExpectedElementCounts with actual 52 * behave correctly by comparing ExpectedElementCounts with actual
51 * results. 53 * results.
52 */ 54 */
53 @SupportedAnnotationTypes("ExpectedElementCounts") 55 @SupportedAnnotationTypes("ExpectedElementCounts")
54 @ExpectedElementCounts(methods=3) 56 @ExpectedElementCounts(methods=2)
55 public class TestIterables extends AbstractProcessor { 57 public class TestIterables extends JavacTestingAbstractProcessor {
56
57 public boolean process(Set<? extends TypeElement> annotations, 58 public boolean process(Set<? extends TypeElement> annotations,
58 RoundEnvironment roundEnv) { 59 RoundEnvironment roundEnv) {
59 if (!roundEnv.processingOver()) { 60 if (!roundEnv.processingOver()) {
60 boolean error = false; 61 boolean error = false;
61 int topLevelCount = 0; 62 int topLevelCount = 0;
116 if (count1 != count2) 117 if (count1 != count2)
117 throw new RuntimeException("Inconsistent counts from iterator."); 118 throw new RuntimeException("Inconsistent counts from iterator.");
118 119
119 return count1; 120 return count1;
120 } 121 }
121
122 @Override
123 public SourceVersion getSupportedSourceVersion() {
124 return SourceVersion.latest();
125 }
126
127 } 122 }

mercurial