test/tools/javac/processing/6413690/T6413690.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 6413690 6380018 26 * @bug 6413690 6380018
27 * @summary JavacProcessingEnvironment does not enter trees from preceding rounds 27 * @summary JavacProcessingEnvironment does not enter trees from preceding rounds
28 * @author Peter von der Ah\u00e9 28 * @author Peter von der Ah\u00e9
29 * @library ../../lib
30 * @build JavacTestingAbstractProcessor
29 * @compile T6413690.java 31 * @compile T6413690.java
30 * @compile -XDfatalEnterError -verbose -processor T6413690 src/Super.java TestMe.java 32 * @compile -XDfatalEnterError -verbose -processor T6413690 src/Super.java TestMe.java
31 */ 33 */
32 34
33 import java.io.IOException; 35 import java.io.IOException;
40 import javax.lang.model.element.Element; 42 import javax.lang.model.element.Element;
41 import javax.lang.model.element.TypeElement; 43 import javax.lang.model.element.TypeElement;
42 import javax.lang.model.util.Elements; 44 import javax.lang.model.util.Elements;
43 45
44 @SupportedAnnotationTypes("TestMe") 46 @SupportedAnnotationTypes("TestMe")
45 public class T6413690 extends AbstractProcessor { 47 public class T6413690 extends JavacTestingAbstractProcessor {
46 public boolean process(Set<? extends TypeElement> annotations, 48 public boolean process(Set<? extends TypeElement> annotations,
47 RoundEnvironment roundEnvironment) { 49 RoundEnvironment roundEnvironment) {
48 Elements elements = processingEnv.getElementUtils();
49 Filer filer = processingEnv.getFiler();
50 TypeElement testMe = elements.getTypeElement(TestMe.class.getName()); 50 TypeElement testMe = elements.getTypeElement(TestMe.class.getName());
51 Set<? extends Element> supers = roundEnvironment.getElementsAnnotatedWith(testMe); 51 Set<? extends Element> supers = roundEnvironment.getElementsAnnotatedWith(testMe);
52 try { 52 try {
53 for (Element sup : supers) { 53 for (Element sup : supers) {
54 Writer sub = filer.createSourceFile(sup.getSimpleName() + "_GENERATED").openWriter(); 54 Writer sub = filer.createSourceFile(sup.getSimpleName() + "_GENERATED").openWriter();

mercurial