WError1.java revision 1465:b52a38d4536c
11541Srgrimes/*
214500Shsu * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
31541Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41541Srgrimes *
51541Srgrimes * This code is free software; you can redistribute it and/or modify it
61541Srgrimes * under the terms of the GNU General Public License version 2 only, as
71541Srgrimes * published by the Free Software Foundation.
81541Srgrimes *
91541Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT
101541Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
111541Srgrimes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
121541Srgrimes * version 2 for more details (a copy is included in the LICENSE file that
131541Srgrimes * accompanied this code).
141541Srgrimes *
151541Srgrimes * You should have received a copy of the GNU General Public License version
161541Srgrimes * 2 along with this work; if not, write to the Free Software Foundation,
171541Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
181541Srgrimes *
191541Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
201541Srgrimes * or visit www.oracle.com if you need additional information or have any
211541Srgrimes * questions.
221541Srgrimes */
231541Srgrimes
241541Srgrimes/*
251541Srgrimes * @test 6403456
261541Srgrimes * @summary -Werror should work with annotation processing
271541Srgrimes * @library /tools/javac/lib
281541Srgrimes * @build   JavacTestingAbstractProcessor
291541Srgrimes * @compile WError1.java
301541Srgrimes * @compile -proc:only -processor WError1 WError1.java
311541Srgrimes * @compile/fail/ref=WError1.out -XDrawDiagnostics -Werror -proc:only -processor WError1 WError1.java
321541Srgrimes */
331541Srgrimes
341541Srgrimesimport java.io.*;
351541Srgrimesimport java.util.*;
361541Srgrimesimport javax.annotation.processing.*;
371541Srgrimesimport javax.lang.model.*;
3814500Shsuimport javax.lang.model.element.*;
3950477Speterimport javax.tools.*;
401541Srgrimes
411541Srgrimespublic class WError1 extends JavacTestingAbstractProcessor {
421541Srgrimes    @Override
431541Srgrimes    public boolean process(Set<? extends TypeElement> annotations,
441541Srgrimes                           RoundEnvironment roundEnv) {
4533778Sbde        if (++round == 1) {
4633778Sbde            messager.printMessage(Diagnostic.Kind.WARNING, "round 1");
471541Srgrimes        }
4890868Smike        return true;
4993514Smike    }
501541Srgrimes
51104341Smike    int round = 0;
521541Srgrimes}
531541Srgrimes