test/tools/javac/processing/model/element/TestElement.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 6453386 26 * @bug 6453386
27 * @summary Test basic properties of javax.lang.element.Element 27 * @summary Test basic properties of javax.lang.element.Element
28 * @author Joseph D. Darcy 28 * @author Joseph D. Darcy
29 * @build TestElement 29 * @library ../../../lib
30 * @build JavacTestingAbstractProcessor TestElement
30 * @compile -processor TestElement -proc:only TestElement.java 31 * @compile -processor TestElement -proc:only TestElement.java
31 */ 32 */
32 33
33 import java.util.Set; 34 import java.util.Set;
34 import javax.annotation.processing.*; 35 import javax.annotation.processing.*;
41 import static javax.tools.StandardLocation.*; 42 import static javax.tools.StandardLocation.*;
42 43
43 /** 44 /**
44 * Test basic workings of javax.lang.element.Element 45 * Test basic workings of javax.lang.element.Element
45 */ 46 */
46 @SupportedAnnotationTypes("*") 47 public class TestElement extends JavacTestingAbstractProcessor {
47 public class TestElement extends AbstractProcessor {
48 /** 48 /**
49 * For now, just check that constructors have a simple name of 49 * For now, just check that constructors have a simple name of
50 * "<init>". 50 * "<init>".
51 */ 51 */
52 public boolean process(Set<? extends TypeElement> annotations, 52 public boolean process(Set<? extends TypeElement> annotations,
64 if (!hasRun) 64 if (!hasRun)
65 throw new RuntimeException("No constructors!"); 65 throw new RuntimeException("No constructors!");
66 } 66 }
67 return true; 67 return true;
68 } 68 }
69
70 public SourceVersion getSupportedSourceVersion() {
71 return SourceVersion.latest();
72 }
73
74 } 69 }

mercurial