8058373: Group 10a: golden files for tests in tools/javac dir

Reviewed-by: jjg, darcy
This commit is contained in:
Sonali Goel 2015-01-08 22:01:20 -08:00
parent 56a33e4541
commit 274f997aee
18 changed files with 60 additions and 245 deletions

View file

@ -1,34 +1,11 @@
/* /*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. * @test /nodynamiccopyright/
* 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4854628 * @bug 4854628
* @summary include Throwable subclasses in missing serialVersionUID warning * @summary include Throwable subclasses in missing serialVersionUID warning
* @author gafter * @author gafter
* *
* @compile -Werror SerialWarn.java * @compile -Werror SerialWarn.java
* @compile/fail -Xlint:serial -Werror SerialWarn.java * @compile/fail/ref=SerialWarn.out -XDrawDiagnostics -Xlint:serial -Werror SerialWarn.java
*/ */
class SerialWarn extends Throwable {} class SerialWarn extends Throwable {}

View file

@ -0,0 +1,4 @@
SerialWarn.java:11:1: compiler.warn.missing.SVUID: SerialWarn
- compiler.err.warnings.and.werror
1 error
1 warning

View file

@ -1,33 +1,10 @@
/* /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. * @test /nodynamiccopyright/
* 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6229758 * @bug 6229758
* @summary deprecatedNOT! is * @summary deprecatedNOT! is
* @author Peter von der Ah\u00e9 * @author Peter von der Ah\u00e9
* @compile -Xlint:deprecation DeprecatedYES.java * @compile -Xlint:deprecation DeprecatedYES.java
* @compile/fail -Werror -Xlint:deprecation DeprecatedYES.java * @compile/fail/ref=DeprecatedYES.out -XDrawDiagnostics -Werror -Xlint:deprecation DeprecatedYES.java
*/ */
class A { class A {

View file

@ -0,0 +1,4 @@
DeprecatedYES.java:18:10: compiler.warn.has.been.deprecated: foo(), A
- compiler.err.warnings.and.werror
1 error
1 warning

View file

@ -3,7 +3,6 @@
* @bug 6231847 * @bug 6231847
* @summary Crash in com.sun.tools.javac.comp.Attr.visitNewClass:1352 * @summary Crash in com.sun.tools.javac.comp.Attr.visitNewClass:1352
* @author Peter von der Ah\u00e9 * @author Peter von der Ah\u00e9
* @compile/fail -XDdev T6231847.java
* @compile/fail/ref=T6231847.out -XDdev -XDrawDiagnostics T6231847.java * @compile/fail/ref=T6231847.out -XDdev -XDrawDiagnostics T6231847.java
*/ */

View file

@ -1,9 +1,9 @@
T6231847.java:15:21: compiler.err.anon.class.impl.intf.no.typeargs T6231847.java:14:21: compiler.err.anon.class.impl.intf.no.typeargs
T6231847.java:16:30: compiler.err.anon.class.impl.intf.no.args T6231847.java:15:30: compiler.err.anon.class.impl.intf.no.args
T6231847.java:16:16: compiler.err.anon.class.impl.intf.no.qual.for.new
T6231847.java:17:16: compiler.err.anon.class.impl.intf.no.qual.for.new T6231847.java:17:16: compiler.err.anon.class.impl.intf.no.qual.for.new
T6231847.java:18:16: compiler.err.anon.class.impl.intf.no.qual.for.new T6231847.java:17:41: compiler.err.anon.class.impl.intf.no.args
T6231847.java:18:41: compiler.err.anon.class.impl.intf.no.args T6231847.java:17:23: compiler.err.anon.class.impl.intf.no.typeargs
T6231847.java:18:23: compiler.err.anon.class.impl.intf.no.typeargs T6231847.java:18:16: compiler.err.qualified.new.of.static.class: T6231847.T6231847C
T6231847.java:19:16: compiler.err.qualified.new.of.static.class: T6231847.T6231847C T6231847.java:18:34: compiler.err.illegal.qual.not.icls: T6231847.T6231847C
T6231847.java:19:34: compiler.err.illegal.qual.not.icls: T6231847.T6231847C
8 errors 8 errors

View file

@ -1,33 +1,10 @@
/* /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * @test /nodynamiccopyright/
* 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4909690 * @bug 4909690
* @summary AssertionError(com.sun.tools.javac.v8.code.Symbol$MethodSymbol.isOverridableIn) * @summary AssertionError(com.sun.tools.javac.v8.code.Symbol$MethodSymbol.isOverridableIn)
* @author gafter * @author gafter
* *
* @compile/fail B.java * @compile/fail/ref=B.out -XDrawDiagnostics B.java
*/ */
public class B extends A public class B extends A

View file

@ -0,0 +1,3 @@
B.java:12:27: compiler.err.illegal.combination.of.modifiers: private, protected
A.java:25:27: compiler.err.illegal.combination.of.modifiers: private, protected
2 errors

View file

@ -1,28 +1,5 @@
/* /*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. * @test /nodynamiccopyright/
* 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6365040 6358129 * @bug 6365040 6358129
* @summary Test -processor foo,bar,baz * @summary Test -processor foo,bar,baz
* @author Joseph D. Darcy * @author Joseph D. Darcy
@ -34,8 +11,8 @@
* @compile -processor ProcFoo,ProcBar,T6365040 -proc:only T6365040.java * @compile -processor ProcFoo,ProcBar,T6365040 -proc:only T6365040.java
* @compile -processor T6365040 -proc:only T6365040.java * @compile -processor T6365040 -proc:only T6365040.java
* @compile -processor T6365040,NotThere, -proc:only T6365040.java * @compile -processor T6365040,NotThere, -proc:only T6365040.java
* @compile/fail -processor NotThere -proc:only T6365040.java * @compile/fail/ref=T6365040.out -XDrawDiagnostics -processor NotThere -proc:only T6365040.java
* @compile/fail -processor NotThere,T6365040 -proc:only T6365040.java * @compile/fail/ref=T6365040.out -XDrawDiagnostics -processor NotThere,T6365040 -proc:only T6365040.java
*/ */
import java.util.Set; import java.util.Set;

View file

@ -0,0 +1,4 @@
- compiler.err.proc.processor.not.found: NotThere
- compiler.warn.proc.proc-only.requested.no.procs
1 error
1 warning

View file

@ -1,35 +1,11 @@
/* /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * @test /nodynamiccopyright/
* 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6511613 * @bug 6511613
* @summary javac unexpectedly doesn't fail in some cases if an annotation processor specified * @summary javac unexpectedly doesn't fail in some cases if an annotation processor specified
*
* @library /tools/javac/lib * @library /tools/javac/lib
* @build JavacTestingAbstractProcessor DummyProcessor * @build JavacTestingAbstractProcessor DummyProcessor
* @compile/fail clss41701.java * @compile/fail/ref=clss41701.out -XDrawDiagnostics clss41701.java
* @compile/fail -processor DummyProcessor clss41701.java * @compile/fail/ref=clss41701.out -XDrawDiagnostics -processor DummyProcessor clss41701.java
*/ */
import java.io.PrintStream; import java.io.PrintStream;

View file

@ -0,0 +1,2 @@
clss41701.java:19:30: compiler.err.type.var.may.not.be.followed.by.other.bounds
1 error

View file

@ -1,28 +1,5 @@
/* /*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. * @test /nodynamiccopyright/
* 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6403459 * @bug 6403459
* @summary Test that generating programs with syntax errors is a fatal condition * @summary Test that generating programs with syntax errors is a fatal condition
* @author Joseph D. Darcy * @author Joseph D. Darcy
@ -30,7 +7,7 @@
* @build JavacTestingAbstractProcessor * @build JavacTestingAbstractProcessor
* @compile TestReturnCode.java * @compile TestReturnCode.java
* @compile TestFatalityOfParseErrors.java * @compile TestFatalityOfParseErrors.java
* @compile/fail -XprintRounds -processor TestFatalityOfParseErrors -proc:only TestFatalityOfParseErrors.java * @compile/fail/ref=TestFatalityOfParseErrors.out -XDrawDiagnostics -XprintRounds -processor TestFatalityOfParseErrors -proc:only TestFatalityOfParseErrors.java
*/ */
import java.util.Set; import java.util.Set;
@ -49,41 +26,12 @@ import java.io.IOException;
* is marked as an error. * is marked as an error.
*/ */
public class TestFatalityOfParseErrors extends JavacTestingAbstractProcessor { public class TestFatalityOfParseErrors extends JavacTestingAbstractProcessor {
int round = 0;
public boolean process(Set<? extends TypeElement> annotations, public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnvironment) { RoundEnvironment roundEnvironment) {
try { try (PrintWriter pw = new PrintWriter(filer.createSourceFile("SyntaxError").openWriter())) {
PrintWriter pw = null;
round++;
switch (round) {
case 1:
pw = new PrintWriter(filer.createSourceFile("SyntaxError").openWriter());
pw.println("class SyntaxError {"); pw.println("class SyntaxError {");
pw.close();
break;
case 2:
pw = new PrintWriter(filer.createSourceFile("SimpleClass").openWriter());
pw.println("class SimpleClass {}");
pw.close();
if (!roundEnvironment.errorRaised() || !roundEnvironment.processingOver() ) {
System.err.println(roundEnvironment);
throw new RuntimeException("Second round not erroneous as expected.");
}
if (!roundEnvironment.getRootElements().isEmpty()) {
System.err.println(roundEnvironment);
throw new RuntimeException("Root elements not empty as expected.");
}
break;
default:
throw new RuntimeException("Unexpected round number " + round);
}
} catch (IOException ioException) { } catch (IOException ioException) {
throw new RuntimeException(ioException);
} }
return true; return true;
} }

View file

@ -0,0 +1,10 @@
Round 1:
input files: {TestFatalityOfParseErrors}
annotations: []
last round: false
Round 2:
input files: {}
annotations: []
last round: true
SyntaxError.java:1:20: compiler.err.premature.eof
1 error

View file

@ -1,28 +1,5 @@
/* /*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * @test /nodynamiccopyright/
* 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6341173 6341072 * @bug 6341173 6341072
* @summary Test presence of Messager methods * @summary Test presence of Messager methods
* @author Joseph D. Darcy * @author Joseph D. Darcy
@ -30,9 +7,9 @@
* @build JavacTestingAbstractProcessor * @build JavacTestingAbstractProcessor
* @compile MessagerBasics.java * @compile MessagerBasics.java
* @compile -processor MessagerBasics -proc:only MessagerBasics.java * @compile -processor MessagerBasics -proc:only MessagerBasics.java
* @compile/fail -processor MessagerBasics -proc:only -AfinalError MessagerBasics.java * @compile/fail/ref=MessagerBasics.out -XDrawDiagnostics -processor MessagerBasics -proc:only -AfinalError MessagerBasics.java
* @compile -processor MessagerBasics MessagerBasics.java * @compile -processor MessagerBasics MessagerBasics.java
* @compile/fail -processor MessagerBasics -AfinalError MessagerBasics.java * @compile/fail/ref=MessagerBasics.out -XDrawDiagnostics -processor MessagerBasics -AfinalError MessagerBasics.java
*/ */
import java.util.Set; import java.util.Set;

View file

@ -0,0 +1,2 @@
- compiler.err.proc.messager: Does not compute
1 error

View file

@ -1,33 +1,9 @@
/* /*
* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * @test /nodynamiccopyright/
* 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4295650 * @bug 4295650
* @summary Verify that qualified 'new' of static class is forbidden. * @summary Verify that qualified 'new' of static class is forbidden.
* @author maddox (after gbracha) * @author maddox (after gbracha)
* * @compile/fail/ref=StaticQualifiedNew.out -XDrawDiagnostics StaticQualifiedNew.java
* @compile/fail StaticQualifiedNew.java
*/ */
import p2.X; import p2.X;

View file

@ -0,0 +1,2 @@
StaticQualifiedNew.java:13:11: compiler.err.qualified.new.of.static.class: p2.X.M
1 error