test/tools/javac/enum/6424358/T6424358.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 21,34 ****
* questions.
*/
/*
* @test
! * @bug 6424358
* @summary Synthesized static enum method values() is final
* @author Peter von der Ah\u00e9
! * @compile T6424358.java
* @compile -processor T6424358 -proc:only T6424358.java
*/
import java.util.Set;
import javax.annotation.processing.*;
--- 21,35 ----
* questions.
*/
/*
* @test
! * @bug 6424358 7025809
* @summary Synthesized static enum method values() is final
* @author Peter von der Ah\u00e9
! * @library ../../lib
! * @build JavacTestingAbstractProcessor T6424358
* @compile -processor T6424358 -proc:only T6424358.java
*/
import java.util.Set;
import javax.annotation.processing.*;
*** 37,56 ****
import javax.lang.model.SourceVersion;
import static javax.tools.Diagnostic.Kind.*;
@interface TestMe {}
! @SupportedAnnotationTypes("*")
! public class T6424358 extends AbstractProcessor {
@TestMe enum Test { FOO; }
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnvironment) {
final Messager log = processingEnv.getMessager();
final Elements elements = processingEnv.getElementUtils();
final TypeElement testMe = elements.getTypeElement("TestMe");
! class Scan extends ElementScanner7<Void,Void> {
@Override
public Void visitExecutable(ExecutableElement e, Void p) {
System.err.println("Looking at " + e);
if ("values".contentEquals(e.getSimpleName()) &&
e.getModifiers().contains(Modifier.FINAL)) {
--- 38,56 ----
import javax.lang.model.SourceVersion;
import static javax.tools.Diagnostic.Kind.*;
@interface TestMe {}
! public class T6424358 extends JavacTestingAbstractProcessor {
@TestMe enum Test { FOO; }
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnvironment) {
final Messager log = processingEnv.getMessager();
final Elements elements = processingEnv.getElementUtils();
final TypeElement testMe = elements.getTypeElement("TestMe");
! class Scan extends ElementScanner<Void,Void> {
@Override
public Void visitExecutable(ExecutableElement e, Void p) {
System.err.println("Looking at " + e);
if ("values".contentEquals(e.getSimpleName()) &&
e.getModifiers().contains(Modifier.FINAL)) {
*** 63,73 ****
Scan scan = new Scan();
for (Element e : roundEnvironment.getElementsAnnotatedWith(testMe))
scan.scan(e);
return true;
}
-
- @Override
- public SourceVersion getSupportedSourceVersion() {
- return SourceVersion.latest();
- }
}
--- 63,68 ----