Wed, 02 Mar 2011 21:06:17 -0800
6986892: confusing warning given after errors in annotation processing
Reviewed-by: darcy
jjg@903 | 1 | /* |
jjg@903 | 2 | * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
jjg@903 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@903 | 4 | * |
jjg@903 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@903 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jjg@903 | 7 | * published by the Free Software Foundation. |
jjg@903 | 8 | * |
jjg@903 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@903 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@903 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@903 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@903 | 13 | * accompanied this code). |
jjg@903 | 14 | * |
jjg@903 | 15 | * You should have received a copy of the GNU General Public License version |
jjg@903 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@903 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@903 | 18 | * |
jjg@903 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
jjg@903 | 20 | * or visit www.oracle.com if you need additional information or have any |
jjg@903 | 21 | * questions. |
jjg@903 | 22 | */ |
jjg@903 | 23 | |
jjg@903 | 24 | /* |
jjg@903 | 25 | * @test |
jjg@903 | 26 | * @bug 6986892 |
jjg@903 | 27 | * @summary confusing warning given after errors in annotation processing |
jjg@903 | 28 | * @library ../../../lib |
jjg@903 | 29 | * @build JavacTestingAbstractProcessor TestProcUseImplicitWarning |
jjg@903 | 30 | * @clean C1 p.C2 |
jjg@903 | 31 | * @compile/fail/ref=err.out -XDrawDiagnostics -processor TestProcUseImplicitWarning -Aerror C1.java |
jjg@903 | 32 | * @clean C1 p.C2 |
jjg@903 | 33 | * @compile/ref=warn.out -XDrawDiagnostics -processor TestProcUseImplicitWarning C1.java |
jjg@903 | 34 | */ |
jjg@903 | 35 | |
jjg@903 | 36 | import java.util.*; |
jjg@903 | 37 | import javax.annotation.processing.*; |
jjg@903 | 38 | import javax.lang.model.element.*; |
jjg@903 | 39 | import static javax.tools.Diagnostic.Kind.*; |
jjg@903 | 40 | |
jjg@903 | 41 | @SupportedOptions("error") |
jjg@903 | 42 | public class TestProcUseImplicitWarning extends JavacTestingAbstractProcessor { |
jjg@903 | 43 | |
jjg@903 | 44 | int round = 0; |
jjg@903 | 45 | |
jjg@903 | 46 | @Override |
jjg@903 | 47 | public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { |
jjg@903 | 48 | round++; |
jjg@903 | 49 | |
jjg@903 | 50 | if (round == 1) { |
jjg@903 | 51 | boolean error = options.containsKey("error"); |
jjg@903 | 52 | if (error) |
jjg@903 | 53 | messager.printMessage(ERROR, "error generated per option"); |
jjg@903 | 54 | } |
jjg@903 | 55 | |
jjg@903 | 56 | return false; |
jjg@903 | 57 | } |
jjg@903 | 58 | |
jjg@903 | 59 | } |