23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 6519115 |
26 * @bug 6519115 |
27 * @summary Verify MirroredTypeException vs MirroredTypesException is thrown |
27 * @summary Verify MirroredTypeException vs MirroredTypesException is thrown |
|
28 * @library ../../../../lib |
|
29 * @build JavacTestingAbstractProcessor |
28 * @compile Plurality.java |
30 * @compile Plurality.java |
29 * @compile -processor Plurality -proc:only Plurality.java |
31 * @compile -processor Plurality -proc:only Plurality.java |
30 * @author Joseph D. Darcy |
32 * @author Joseph D. Darcy |
31 */ |
33 */ |
32 import java.lang.annotation.*; |
34 import java.lang.annotation.*; |
36 import javax.lang.model.*; |
38 import javax.lang.model.*; |
37 import javax.lang.model.element.*; |
39 import javax.lang.model.element.*; |
38 import javax.lang.model.type.*; |
40 import javax.lang.model.type.*; |
39 import javax.lang.model.util.*; |
41 import javax.lang.model.util.*; |
40 |
42 |
41 @SupportedAnnotationTypes("*") |
|
42 @P0 |
43 @P0 |
43 @P1 |
44 @P1 |
44 @P2 |
45 @P2 |
45 @S1 |
46 @S1 |
46 public class Plurality extends AbstractProcessor { |
47 public class Plurality extends JavacTestingAbstractProcessor { |
47 private boolean executed = false; |
48 private boolean executed = false; |
48 |
|
49 Elements elements; |
|
50 Types types; |
|
51 |
|
52 @Override |
|
53 public void init(ProcessingEnvironment penv) { |
|
54 super.init(penv); |
|
55 elements = penv.getElementUtils(); |
|
56 types = penv.getTypeUtils(); |
|
57 } |
|
58 |
|
59 |
49 |
60 public boolean process(Set<? extends TypeElement> annotations, |
50 public boolean process(Set<? extends TypeElement> annotations, |
61 RoundEnvironment roundEnv) { |
51 RoundEnvironment roundEnv) { |
62 if (!roundEnv.processingOver()) { |
52 if (!roundEnv.processingOver()) { |
63 executed = true; |
53 executed = true; |
162 throw new RuntimeException("Mismatched names: " + |
152 throw new RuntimeException("Mismatched names: " + |
163 canonicalName + "\t" + |
153 canonicalName + "\t" + |
164 toStringName); |
154 toStringName); |
165 } |
155 } |
166 } |
156 } |
167 |
|
168 @Override |
|
169 public SourceVersion getSupportedSourceVersion() { |
|
170 return SourceVersion.latest(); |
|
171 } |
|
172 } |
157 } |
173 |
158 |
174 @Retention(RetentionPolicy.RUNTIME) |
159 @Retention(RetentionPolicy.RUNTIME) |
175 @interface P0 { |
160 @interface P0 { |
176 Class[] value() default {}; |
161 Class[] value() default {}; |