931N/A/*
931N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
931N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
931N/A *
931N/A * This code is free software; you can redistribute it and/or modify it
931N/A * under the terms of the GNU General Public License version 2 only, as
931N/A * published by the Free Software Foundation.
931N/A *
931N/A * This code is distributed in the hope that it will be useful, but WITHOUT
931N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
931N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
931N/A * version 2 for more details (a copy is included in the LICENSE file that
931N/A * accompanied this code).
931N/A *
931N/A * You should have received a copy of the GNU General Public License version
931N/A * 2 along with this work; if not, write to the Free Software Foundation,
931N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
931N/A *
931N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
931N/A * or visit www.oracle.com if you need additional information or have any
931N/A * questions.
931N/A */
931N/A
931N/A/*
931N/A * @test
931N/A * @bug 6987384
931N/A * @summary -XprintProcessorRoundsInfo message printed with different timing than previous
931N/A * @library ../../../lib
931N/A * @build JavacTestingAbstractProcessor Test
931N/A * @compile/fail/ref=Test.out -XDrawDiagnostics -XprintProcessorInfo -Werror -proc:only -processor Test Test.java
931N/A */
931N/A
931N/Aimport java.io.*;
931N/Aimport java.util.*;
931N/Aimport javax.annotation.processing.*;
931N/Aimport javax.lang.model.*;
931N/Aimport javax.lang.model.element.*;
931N/Aimport javax.lang.model.util.*;
931N/Aimport javax.tools.*;
931N/A
931N/Apublic class Test extends JavacTestingAbstractProcessor {
931N/A final int MAX_ROUNDS = 3;
931N/A int round = 0;
931N/A
931N/A @Override
931N/A public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
931N/A round++;
931N/A messager.printMessage(Diagnostic.Kind.NOTE, "round " + round);
931N/A if (round <= MAX_ROUNDS)
931N/A generateSource("Gen" + round);
931N/A if (roundEnv.processingOver())
931N/A messager.printMessage(Diagnostic.Kind.WARNING, "last round");
931N/A return true;
931N/A }
931N/A
931N/A void generateSource(String name) {
931N/A String text = "class " + name + " { }\n";
931N/A
931N/A // avoid try-with-resources so test can be run on older builds
931N/A try {
931N/A Writer out = filer.createSourceFile(name).openWriter();
931N/A try {
931N/A out.write(text);
931N/A } finally {
931N/A out.close();
931N/A }
931N/A } catch (IOException e) {
931N/A throw new Error(e);
931N/A }
931N/A }
931N/A}
931N/A
931N/A
931N/A