mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8058373: Group 10a: golden files for tests in tools/javac dir
Reviewed-by: jjg, darcy
This commit is contained in:
parent
56a33e4541
commit
274f997aee
18 changed files with 60 additions and 245 deletions
|
@ -1,34 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 4854628
|
||||
* @summary include Throwable subclasses in missing serialVersionUID warning
|
||||
* @author gafter
|
||||
*
|
||||
* @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 {}
|
||||
|
|
4
langtools/test/tools/javac/SerialWarn.out
Normal file
4
langtools/test/tools/javac/SerialWarn.out
Normal file
|
@ -0,0 +1,4 @@
|
|||
SerialWarn.java:11:1: compiler.warn.missing.SVUID: SerialWarn
|
||||
- compiler.err.warnings.and.werror
|
||||
1 error
|
||||
1 warning
|
|
@ -1,33 +1,10 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6229758
|
||||
* @summary deprecatedNOT! is
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @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 {
|
||||
|
|
4
langtools/test/tools/javac/T4994049/DeprecatedYES.out
Normal file
4
langtools/test/tools/javac/T4994049/DeprecatedYES.out
Normal 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
|
|
@ -1,9 +1,8 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6231847
|
||||
* @summary Crash in com.sun.tools.javac.comp.Attr.visitNewClass:1352
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile/fail -XDdev T6231847.java
|
||||
* @compile/fail/ref=T6231847.out -XDdev -XDrawDiagnostics T6231847.java
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
T6231847.java:15:21: compiler.err.anon.class.impl.intf.no.typeargs
|
||||
T6231847.java:16:30: compiler.err.anon.class.impl.intf.no.args
|
||||
T6231847.java:14:21: compiler.err.anon.class.impl.intf.no.typeargs
|
||||
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:18:16: compiler.err.anon.class.impl.intf.no.qual.for.new
|
||||
T6231847.java:18:41: compiler.err.anon.class.impl.intf.no.args
|
||||
T6231847.java:18:23: compiler.err.anon.class.impl.intf.no.typeargs
|
||||
T6231847.java:19:16: compiler.err.qualified.new.of.static.class: T6231847.T6231847C
|
||||
T6231847.java:19:34: compiler.err.illegal.qual.not.icls: T6231847.T6231847C
|
||||
T6231847.java:17:41: compiler.err.anon.class.impl.intf.no.args
|
||||
T6231847.java:17:23: compiler.err.anon.class.impl.intf.no.typeargs
|
||||
T6231847.java:18:16: compiler.err.qualified.new.of.static.class: T6231847.T6231847C
|
||||
T6231847.java:18:34: compiler.err.illegal.qual.not.icls: T6231847.T6231847C
|
||||
8 errors
|
||||
|
|
|
@ -1,33 +1,10 @@
|
|||
/*
|
||||
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 4909690
|
||||
* @summary AssertionError(com.sun.tools.javac.v8.code.Symbol$MethodSymbol.isOverridableIn)
|
||||
* @author gafter
|
||||
*
|
||||
* @compile/fail B.java
|
||||
* @compile/fail/ref=B.out -XDrawDiagnostics B.java
|
||||
*/
|
||||
|
||||
public class B extends A
|
||||
|
|
3
langtools/test/tools/javac/overrridecrash/B.out
Normal file
3
langtools/test/tools/javac/overrridecrash/B.out
Normal 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
|
|
@ -1,28 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6365040 6358129
|
||||
* @summary Test -processor foo,bar,baz
|
||||
* @author Joseph D. Darcy
|
||||
|
@ -34,8 +11,8 @@
|
|||
* @compile -processor ProcFoo,ProcBar,T6365040 -proc:only T6365040.java
|
||||
* @compile -processor T6365040 -proc:only T6365040.java
|
||||
* @compile -processor T6365040,NotThere, -proc:only T6365040.java
|
||||
* @compile/fail -processor NotThere -proc:only T6365040.java
|
||||
* @compile/fail -processor NotThere,T6365040 -proc:only T6365040.java
|
||||
* @compile/fail/ref=T6365040.out -XDrawDiagnostics -processor NotThere -proc:only T6365040.java
|
||||
* @compile/fail/ref=T6365040.out -XDrawDiagnostics -processor NotThere,T6365040 -proc:only T6365040.java
|
||||
*/
|
||||
|
||||
import java.util.Set;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
- compiler.err.proc.processor.not.found: NotThere
|
||||
- compiler.warn.proc.proc-only.requested.no.procs
|
||||
1 error
|
||||
1 warning
|
|
@ -1,35 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6511613
|
||||
* @summary javac unexpectedly doesn't fail in some cases if an annotation processor specified
|
||||
*
|
||||
* @library /tools/javac/lib
|
||||
* @build JavacTestingAbstractProcessor DummyProcessor
|
||||
* @compile/fail clss41701.java
|
||||
* @compile/fail -processor DummyProcessor clss41701.java
|
||||
* @compile/fail/ref=clss41701.out -XDrawDiagnostics clss41701.java
|
||||
* @compile/fail/ref=clss41701.out -XDrawDiagnostics -processor DummyProcessor clss41701.java
|
||||
*/
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
clss41701.java:19:30: compiler.err.type.var.may.not.be.followed.by.other.bounds
|
||||
1 error
|
|
@ -1,28 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6403459
|
||||
* @summary Test that generating programs with syntax errors is a fatal condition
|
||||
* @author Joseph D. Darcy
|
||||
|
@ -30,7 +7,7 @@
|
|||
* @build JavacTestingAbstractProcessor
|
||||
* @compile TestReturnCode.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;
|
||||
|
@ -49,41 +26,12 @@ import java.io.IOException;
|
|||
* is marked as an error.
|
||||
*/
|
||||
public class TestFatalityOfParseErrors extends JavacTestingAbstractProcessor {
|
||||
int round = 0;
|
||||
|
||||
public boolean process(Set<? extends TypeElement> annotations,
|
||||
RoundEnvironment roundEnvironment) {
|
||||
try {
|
||||
PrintWriter pw = null;
|
||||
round++;
|
||||
|
||||
switch (round) {
|
||||
case 1:
|
||||
pw = new PrintWriter(filer.createSourceFile("SyntaxError").openWriter());
|
||||
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);
|
||||
}
|
||||
try (PrintWriter pw = new PrintWriter(filer.createSourceFile("SyntaxError").openWriter())) {
|
||||
pw.println("class SyntaxError {");
|
||||
} catch (IOException ioException) {
|
||||
throw new RuntimeException(ioException);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -1,28 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6341173 6341072
|
||||
* @summary Test presence of Messager methods
|
||||
* @author Joseph D. Darcy
|
||||
|
@ -30,9 +7,9 @@
|
|||
* @build JavacTestingAbstractProcessor
|
||||
* @compile 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/fail -processor MessagerBasics -AfinalError MessagerBasics.java
|
||||
* @compile/fail/ref=MessagerBasics.out -XDrawDiagnostics -processor MessagerBasics -AfinalError MessagerBasics.java
|
||||
*/
|
||||
|
||||
import java.util.Set;
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
- compiler.err.proc.messager: Does not compute
|
||||
1 error
|
|
@ -1,33 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 4295650
|
||||
* @summary Verify that qualified 'new' of static class is forbidden.
|
||||
* @author maddox (after gbracha)
|
||||
*
|
||||
* @compile/fail StaticQualifiedNew.java
|
||||
* @compile/fail/ref=StaticQualifiedNew.out -XDrawDiagnostics StaticQualifiedNew.java
|
||||
*/
|
||||
|
||||
import p2.X;
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
StaticQualifiedNew.java:13:11: compiler.err.qualified.new.of.static.class: p2.X.M
|
||||
1 error
|
Loading…
Add table
Add a link
Reference in a new issue