test/tools/javac/T6403466.java

changeset 494
af18e3956985
parent 1
9a66ca7c79fa
child 554
9d9f26857129
equal deleted inserted replaced
493:7d9e3a15d2b3 494:af18e3956985
39 import javax.tools.*; 39 import javax.tools.*;
40 import com.sun.tools.javac.api.JavacTool; 40 import com.sun.tools.javac.api.JavacTool;
41 41
42 @Wrap 42 @Wrap
43 @SupportedAnnotationTypes("Wrap") 43 @SupportedAnnotationTypes("Wrap")
44 @SupportedSourceVersion(SourceVersion.RELEASE_6)
45 public class T6403466 extends AbstractProcessor { 44 public class T6403466 extends AbstractProcessor {
46 45
47 static final String testSrcDir = System.getProperty("test.src"); 46 static final String testSrcDir = System.getProperty("test.src");
48 static final String testClassDir = System.getProperty("test.classes"); 47 static final String testClassDir = System.getProperty("test.classes");
49 static final String self = T6403466.class.getName(); 48 static final String self = T6403466.class.getName();
71 if (vtl.iter.hasNext() || vtl.errors) 70 if (vtl.iter.hasNext() || vtl.errors)
72 throw new AssertionError("comparison against golden file failed."); 71 throw new AssertionError("comparison against golden file failed.");
73 } 72 }
74 73
75 public boolean process(Set<? extends TypeElement> annos, RoundEnvironment rEnv) { 74 public boolean process(Set<? extends TypeElement> annos, RoundEnvironment rEnv) {
76 Filer filer = processingEnv.getFiler(); 75 if (!rEnv.processingOver()) {
77 for (TypeElement anno: annos) { 76 Filer filer = processingEnv.getFiler();
78 Set<? extends Element> elts = rEnv.getElementsAnnotatedWith(anno); 77 for (TypeElement anno: annos) {
79 System.err.println("anno: " + anno); 78 Set<? extends Element> elts = rEnv.getElementsAnnotatedWith(anno);
80 System.err.println("elts: " + elts); 79 System.err.println("anno: " + anno);
81 for (TypeElement te: ElementFilter.typesIn(elts)) { 80 System.err.println("elts: " + elts);
82 try { 81 for (TypeElement te: ElementFilter.typesIn(elts)) {
83 Writer out = filer.createSourceFile(te.getSimpleName() + "Wrapper").openWriter(); 82 try {
84 out.write("class " + te.getSimpleName() + "Wrapper { }"); 83 Writer out = filer.createSourceFile(te.getSimpleName() + "Wrapper").openWriter();
85 out.close(); 84 out.write("class " + te.getSimpleName() + "Wrapper { }");
86 } catch (IOException ex) { 85 out.close();
87 ex.printStackTrace(); 86 } catch (IOException ex) {
87 ex.printStackTrace();
88 }
88 } 89 }
90
89 } 91 }
90
91 } 92 }
92 return true; 93 return true;
94 }
95
96 @Override
97 public SourceVersion getSupportedSourceVersion() {
98 return SourceVersion.latest();
93 } 99 }
94 } 100 }
95 101
96 @Retention(RetentionPolicy.SOURCE) 102 @Retention(RetentionPolicy.SOURCE)
97 @Target(ElementType.TYPE) 103 @Target(ElementType.TYPE)

mercurial