Tue, 15 Mar 2011 11:41:21 -0700
6987384: -XprintProcessorRoundsInfo message printed with different timing than previous
Reviewed-by: darcy
1.1 --- a/test/tools/javac/lib/JavacTestingAbstractProcessor.java Tue Mar 15 11:04:56 2011 -0700 1.2 +++ b/test/tools/javac/lib/JavacTestingAbstractProcessor.java Tue Mar 15 11:41:21 2011 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -24,8 +24,6 @@ 1.11 import java.util.*; 1.12 import javax.annotation.processing.*; 1.13 import javax.lang.model.SourceVersion; 1.14 -import static javax.lang.model.SourceVersion.*; 1.15 -import javax.lang.model.element.*; 1.16 import javax.lang.model.util.*; 1.17 1.18 /**
2.1 --- a/test/tools/javac/processing/6430209/b6341534.java Tue Mar 15 11:04:56 2011 -0700 2.2 +++ b/test/tools/javac/processing/6430209/b6341534.java Tue Mar 15 11:41:21 2011 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -56,7 +56,9 @@ 2.11 // on round 1, expect errorRaised == false && processingOver == false 2.12 // on round 2, expect errorRaised == true && processingOver == true 2.13 if( renv.errorRaised() != renv.processingOver()) { 2.14 - messager.printMessage(ERROR, "FAILED"); 2.15 + messager.printMessage(ERROR, "FAILED: round:" + r 2.16 + + ", errorRaised:" + renv.errorRaised() 2.17 + + ", processingOver:" + renv.processingOver()); 2.18 } 2.19 return true; 2.20 }
3.1 --- a/test/tools/javac/processing/environment/round/TestContext.java Tue Mar 15 11:04:56 2011 -0700 3.2 +++ b/test/tools/javac/processing/environment/round/TestContext.java Tue Mar 15 11:41:21 2011 -0700 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -34,7 +34,6 @@ 3.11 import java.util.*; 3.12 import javax.annotation.processing.*; 3.13 import javax.lang.model.element.*; 3.14 -import javax.tools.*; 3.15 import static javax.tools.Diagnostic.Kind.*; 3.16 3.17 import com.sun.source.util.Trees;
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/tools/javac/processing/options/testPrintProcessorInfo/Test.java Tue Mar 15 11:41:21 2011 -0700 4.3 @@ -0,0 +1,74 @@ 4.4 +/* 4.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 + * or visit www.oracle.com if you need additional information or have any 4.24 + * questions. 4.25 + */ 4.26 + 4.27 +/* 4.28 + * @test 4.29 + * @bug 6987384 4.30 + * @summary -XprintProcessorRoundsInfo message printed with different timing than previous 4.31 + * @library ../../../lib 4.32 + * @build JavacTestingAbstractProcessor Test 4.33 + * @compile/fail/ref=Test.out -XDrawDiagnostics -XprintProcessorInfo -Werror -proc:only -processor Test Test.java 4.34 + */ 4.35 + 4.36 +import java.io.*; 4.37 +import java.util.*; 4.38 +import javax.annotation.processing.*; 4.39 +import javax.lang.model.*; 4.40 +import javax.lang.model.element.*; 4.41 +import javax.lang.model.util.*; 4.42 +import javax.tools.*; 4.43 + 4.44 +public class Test extends JavacTestingAbstractProcessor { 4.45 + final int MAX_ROUNDS = 3; 4.46 + int round = 0; 4.47 + 4.48 + @Override 4.49 + public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { 4.50 + round++; 4.51 + messager.printMessage(Diagnostic.Kind.NOTE, "round " + round); 4.52 + if (round <= MAX_ROUNDS) 4.53 + generateSource("Gen" + round); 4.54 + if (roundEnv.processingOver()) 4.55 + messager.printMessage(Diagnostic.Kind.WARNING, "last round"); 4.56 + return true; 4.57 + } 4.58 + 4.59 + void generateSource(String name) { 4.60 + String text = "class " + name + " { }\n"; 4.61 + 4.62 + // avoid try-with-resources so test can be run on older builds 4.63 + try { 4.64 + Writer out = filer.createSourceFile(name).openWriter(); 4.65 + try { 4.66 + out.write(text); 4.67 + } finally { 4.68 + out.close(); 4.69 + } 4.70 + } catch (IOException e) { 4.71 + throw new Error(e); 4.72 + } 4.73 + } 4.74 +} 4.75 + 4.76 + 4.77 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/test/tools/javac/processing/options/testPrintProcessorInfo/Test.out Tue Mar 15 11:41:21 2011 -0700 5.3 @@ -0,0 +1,13 @@ 5.4 +Processor Test matches [java.lang.Override] and returns true. 5.5 +- compiler.note.proc.messager: round 1 5.6 +Processor Test matches [] and returns true. 5.7 +- compiler.note.proc.messager: round 2 5.8 +Processor Test matches [] and returns true. 5.9 +- compiler.note.proc.messager: round 3 5.10 +Processor Test matches [] and returns true. 5.11 +- compiler.note.proc.messager: round 4 5.12 +- compiler.note.proc.messager: round 5 5.13 +- compiler.warn.proc.messager: last round 5.14 +- compiler.err.warnings.and.werror 5.15 +1 error 5.16 +1 warning