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 6362178 |
26 * @bug 6362178 |
27 * @summary MirroredType[s]Exception shouldn't be created too eagerly |
27 * @summary MirroredType[s]Exception shouldn't be created too eagerly |
28 * @author Scott Seligman |
28 * @author Scott Seligman |
|
29 * @library ../../../../lib |
|
30 * @build JavacTestingAbstractProcessor |
29 * @compile -g OverEager.java |
31 * @compile -g OverEager.java |
30 * @compile -processor OverEager -proc:only OverEager.java |
32 * @compile -processor OverEager -proc:only OverEager.java |
31 */ |
33 */ |
32 |
34 |
33 import java.util.Set; |
35 import java.util.Set; |
38 import javax.lang.model.util.*; |
40 import javax.lang.model.util.*; |
39 import static javax.lang.model.util.ElementFilter.*; |
41 import static javax.lang.model.util.ElementFilter.*; |
40 |
42 |
41 @SupportedAnnotationTypes("IAm") |
43 @SupportedAnnotationTypes("IAm") |
42 @IAm(OverEager.class) |
44 @IAm(OverEager.class) |
43 public class OverEager extends AbstractProcessor { |
45 public class OverEager extends JavacTestingAbstractProcessor { |
44 |
|
45 Elements elements; |
|
46 Types types; |
|
47 |
|
48 public void init(ProcessingEnvironment penv) { |
|
49 super.init(penv); |
|
50 elements = penv.getElementUtils(); |
|
51 types = penv.getTypeUtils(); |
|
52 } |
|
53 |
|
54 public boolean process(Set<? extends TypeElement> annoTypes, |
46 public boolean process(Set<? extends TypeElement> annoTypes, |
55 RoundEnvironment round) { |
47 RoundEnvironment round) { |
56 if (!round.processingOver()) |
48 if (!round.processingOver()) |
57 doit(annoTypes, round); |
49 doit(annoTypes, round); |
58 return true; |
50 return true; |
59 } |
|
60 |
|
61 @Override |
|
62 public SourceVersion getSupportedSourceVersion() { |
|
63 return SourceVersion.latest(); |
|
64 } |
51 } |
65 |
52 |
66 private void doit(Set<? extends TypeElement> annoTypes, |
53 private void doit(Set<? extends TypeElement> annoTypes, |
67 RoundEnvironment round) { |
54 RoundEnvironment round) { |
68 for (TypeElement t : typesIn(round.getRootElements())) { |
55 for (TypeElement t : typesIn(round.getRootElements())) { |