1 /* |
1 /* |
2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2006, 2011, 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. |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 6424358 |
26 * @bug 6424358 7025809 |
27 * @summary Synthesized static enum method values() is final |
27 * @summary Synthesized static enum method values() is final |
28 * @author Peter von der Ah\u00e9 |
28 * @author Peter von der Ah\u00e9 |
29 * @compile T6424358.java |
29 * @library ../../lib |
|
30 * @build JavacTestingAbstractProcessor T6424358 |
30 * @compile -processor T6424358 -proc:only T6424358.java |
31 * @compile -processor T6424358 -proc:only T6424358.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.*; |
37 import javax.lang.model.SourceVersion; |
38 import javax.lang.model.SourceVersion; |
38 import static javax.tools.Diagnostic.Kind.*; |
39 import static javax.tools.Diagnostic.Kind.*; |
39 |
40 |
40 @interface TestMe {} |
41 @interface TestMe {} |
41 |
42 |
42 @SupportedAnnotationTypes("*") |
43 public class T6424358 extends JavacTestingAbstractProcessor { |
43 public class T6424358 extends AbstractProcessor { |
|
44 @TestMe enum Test { FOO; } |
44 @TestMe enum Test { FOO; } |
45 |
45 |
46 public boolean process(Set<? extends TypeElement> annotations, |
46 public boolean process(Set<? extends TypeElement> annotations, |
47 RoundEnvironment roundEnvironment) { |
47 RoundEnvironment roundEnvironment) { |
48 final Messager log = processingEnv.getMessager(); |
48 final Messager log = processingEnv.getMessager(); |
49 final Elements elements = processingEnv.getElementUtils(); |
49 final Elements elements = processingEnv.getElementUtils(); |
50 final TypeElement testMe = elements.getTypeElement("TestMe"); |
50 final TypeElement testMe = elements.getTypeElement("TestMe"); |
51 class Scan extends ElementScanner7<Void,Void> { |
51 class Scan extends ElementScanner<Void,Void> { |
52 @Override |
52 @Override |
53 public Void visitExecutable(ExecutableElement e, Void p) { |
53 public Void visitExecutable(ExecutableElement e, Void p) { |
54 System.err.println("Looking at " + e); |
54 System.err.println("Looking at " + e); |
55 if ("values".contentEquals(e.getSimpleName()) && |
55 if ("values".contentEquals(e.getSimpleName()) && |
56 e.getModifiers().contains(Modifier.FINAL)) { |
56 e.getModifiers().contains(Modifier.FINAL)) { |