mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8046618: .out files for enum tests in tools/javac/dir
Reviewed-by: jjg
This commit is contained in:
parent
0718a280b0
commit
3ecb57ccc0
20 changed files with 61 additions and 258 deletions
|
@ -1,33 +1,10 @@
|
|||
/*
|
||||
* Copyright (c) 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 5009601
|
||||
* @summary empty enum cannot be abstract
|
||||
* @author Joseph D. Darcy
|
||||
*
|
||||
* @compile/fail AbstractEmptyEnum.java
|
||||
* @compile/fail/ref=AbstractEmptyEnum.out -XDrawDiagnostics AbstractEmptyEnum.java
|
||||
*/
|
||||
|
||||
public enum AbstractEmptyEnum {
|
||||
|
|
2
langtools/test/tools/javac/enum/AbstractEmptyEnum.out
Normal file
2
langtools/test/tools/javac/enum/AbstractEmptyEnum.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
AbstractEmptyEnum.java:10:8: compiler.err.does.not.override.abstract: AbstractEmptyEnum, m(), AbstractEmptyEnum
|
||||
1 error
|
|
@ -1,32 +1,8 @@
|
|||
/*
|
||||
* 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/
|
||||
* @summary enums: an enumeration type may not be extended
|
||||
* @author gafter
|
||||
*
|
||||
* @compile/fail Enum2.java
|
||||
* @compile/fail/ref=Enum2.out -XDrawDiagnostics Enum2.java
|
||||
*/
|
||||
|
||||
public class Enum2 {
|
||||
|
|
3
langtools/test/tools/javac/enum/Enum2.out
Normal file
3
langtools/test/tools/javac/enum/Enum2.out
Normal file
|
@ -0,0 +1,3 @@
|
|||
Enum2.java:10:29: compiler.err.cant.inherit.from.final: Enum2.e1
|
||||
Enum2.java:10:12: compiler.err.enum.types.not.extensible
|
||||
2 errors
|
|
@ -1,33 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 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 5019609
|
||||
* @summary javac fails to reject local enums
|
||||
* @author gafter
|
||||
*
|
||||
* @compile/fail LocalEnum.java
|
||||
* @compile/fail/ref=LocalEnum.out -XDrawDiagnostics LocalEnum.java
|
||||
*/
|
||||
|
||||
public class LocalEnum {
|
||||
|
|
2
langtools/test/tools/javac/enum/LocalEnum.out
Normal file
2
langtools/test/tools/javac/enum/LocalEnum.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
LocalEnum.java:11:9: compiler.err.local.enum
|
||||
1 error
|
|
@ -1,33 +1,10 @@
|
|||
/*
|
||||
* Copyright (c) 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 5071831
|
||||
* @summary javac allows enum in an inner class
|
||||
* @author gafter
|
||||
*
|
||||
* @compile/fail NestedEnum.java
|
||||
* @compile/fail/ref=NestedEnum.out -XDrawDiagnostics NestedEnum.java
|
||||
*/
|
||||
|
||||
class NestedEnum {
|
||||
|
|
2
langtools/test/tools/javac/enum/NestedEnum.out
Normal file
2
langtools/test/tools/javac/enum/NestedEnum.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
NestedEnum.java:12:9: compiler.err.enums.must.be.static
|
||||
1 error
|
|
@ -1,32 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2004, 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 5097250 5087624
|
||||
* @summary Finalize methods on enums must be compile time error
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile/fail NoFinal.java
|
||||
* @compile/fail/ref=NoFinal.out -XDrawDiagnostics NoFinal.java
|
||||
*/
|
||||
|
||||
enum NoFinal {
|
||||
|
|
2
langtools/test/tools/javac/enum/NoFinal.out
Normal file
2
langtools/test/tools/javac/enum/NoFinal.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
NoFinal.java:11:24: compiler.err.enum.no.finalize
|
||||
1 error
|
|
@ -1,32 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2004, 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 5097250 5087624
|
||||
* @summary Finalize methods on enums must be compile time error
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile/fail NoFinal2.java
|
||||
* @compile/fail/ref=NoFinal2.out -XDrawDiagnostics NoFinal2.java
|
||||
*/
|
||||
|
||||
enum NoFinal2 {
|
||||
|
|
2
langtools/test/tools/javac/enum/NoFinal2.out
Normal file
2
langtools/test/tools/javac/enum/NoFinal2.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
NoFinal2.java:11:20: compiler.err.enum.no.finalize
|
||||
1 error
|
|
@ -1,32 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2004, 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 5097250 5087624
|
||||
* @summary Finalize methods on enums must be compile time error
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile/fail NoFinal3.java
|
||||
* @compile/fail/ref=NoFinal3.out -XDrawDiagnostics NoFinal3.java
|
||||
*/
|
||||
|
||||
enum NoFinal3 {
|
||||
|
|
2
langtools/test/tools/javac/enum/NoFinal3.out
Normal file
2
langtools/test/tools/javac/enum/NoFinal3.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
NoFinal3.java:11:17: compiler.err.enum.no.finalize
|
||||
1 error
|
|
@ -1,32 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2004, 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 5097250 5087624
|
||||
* @summary Finalize methods on enums must be compile time error
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile/fail NoFinal4.java
|
||||
* @compile/fail/ref=NoFinal4.out -XDrawDiagnostics NoFinal4.java
|
||||
*/
|
||||
|
||||
enum NoFinal4 {
|
||||
|
|
2
langtools/test/tools/javac/enum/NoFinal4.out
Normal file
2
langtools/test/tools/javac/enum/NoFinal4.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
NoFinal4.java:11:18: compiler.err.enum.no.finalize
|
||||
1 error
|
|
@ -1,32 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2004, 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 5097250 5087624
|
||||
* @summary Finalize methods on enums must be compile time error
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile/fail NoFinal5.java
|
||||
* @compile/fail/ref=NoFinal5.out -XDrawDiagnostics NoFinal5.java
|
||||
*/
|
||||
|
||||
enum NoFinal5 {
|
||||
|
|
2
langtools/test/tools/javac/enum/NoFinal5.out
Normal file
2
langtools/test/tools/javac/enum/NoFinal5.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
NoFinal5.java:11:10: compiler.err.enum.no.finalize
|
||||
1 error
|
|
@ -1,43 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 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 5081785
|
||||
*
|
||||
* @summary Empty Enums allowed in non-static contexts
|
||||
* @author Peter von der Ah\u00e9
|
||||
*
|
||||
* @compile/fail T5081785.java
|
||||
* @compile/fail T5081785a.java
|
||||
* @compile/fail T5081785b.java
|
||||
* @compile/fail T5081785c.java
|
||||
* @compile/fail/ref=T5081785.out -XDrawDiagnostics T5081785.java
|
||||
*/
|
||||
|
||||
class A {
|
||||
class A1 {
|
||||
public void check() {
|
||||
class Foo {
|
||||
enum STRENGTH{};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class A2 {
|
||||
public A2 check() {
|
||||
return new A2() { enum STRENGTH{}; };
|
||||
}
|
||||
}
|
||||
|
||||
class A3 {
|
||||
Object o = new Object() { enum STRENGTH{}; };
|
||||
}
|
||||
|
||||
class A4 {
|
||||
class B {
|
||||
enum C { X, Y, Z }
|
||||
}
|
||||
}
|
||||
|
|
5
langtools/test/tools/javac/enum/T5081785.out
Normal file
5
langtools/test/tools/javac/enum/T5081785.out
Normal file
|
@ -0,0 +1,5 @@
|
|||
T5081785.java:29:9: compiler.err.enums.must.be.static
|
||||
T5081785.java:12:13: compiler.err.enums.must.be.static
|
||||
T5081785.java:19:27: compiler.err.enums.must.be.static
|
||||
T5081785.java:24:31: compiler.err.enums.must.be.static
|
||||
4 errors
|
Loading…
Add table
Add a link
Reference in a new issue