diff --git a/langtools/test/tools/javac/generics/wildcards/neg/AmbiguousCast.java b/langtools/test/tools/javac/generics/wildcards/neg/AmbiguousCast.java index fb8991ee619..a7b76440fd9 100644 --- a/langtools/test/tools/javac/generics/wildcards/neg/AmbiguousCast.java +++ b/langtools/test/tools/javac/generics/wildcards/neg/AmbiguousCast.java @@ -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 4897892 * @summary cast to parameterized type is accepted although it should be rejected * @author gafter * - * @compile/fail -Werror -Xlint:unchecked AmbiguousCast.java + * @compile/ref=AmbiguousCast.out -XDrawDiagnostics -Xlint:unchecked AmbiguousCast.java */ class Test { diff --git a/langtools/test/tools/javac/generics/wildcards/neg/AmbiguousCast.out b/langtools/test/tools/javac/generics/wildcards/neg/AmbiguousCast.out new file mode 100644 index 00000000000..05f1bd43fed --- /dev/null +++ b/langtools/test/tools/javac/generics/wildcards/neg/AmbiguousCast.out @@ -0,0 +1,2 @@ +AmbiguousCast.java:25:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Object, Test.GenericWrapper +1 warning diff --git a/langtools/test/tools/javac/generics/wildcards/neg/Capture.java b/langtools/test/tools/javac/generics/wildcards/neg/Capture.java index 24d02d1e241..084ae7dd56f 100644 --- a/langtools/test/tools/javac/generics/wildcards/neg/Capture.java +++ b/langtools/test/tools/javac/generics/wildcards/neg/Capture.java @@ -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 4916634 * @summary Wildcard capture * @author gafter * - * @compile/fail Capture.java + * @compile/fail/ref=Capture.out -XDrawDiagnostics Capture.java */ class X {} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/Capture.out b/langtools/test/tools/javac/generics/wildcards/neg/Capture.out new file mode 100644 index 00000000000..5ec8a5f6f7b --- /dev/null +++ b/langtools/test/tools/javac/generics/wildcards/neg/Capture.out @@ -0,0 +1,2 @@ +Capture.java:14:9: compiler.err.cant.apply.symbol: kindname.method, f4, X>, X>, kindname.class, Capture, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: X>, X>)) +1 error diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail.java new file mode 100644 index 00000000000..71245dab0f7 --- /dev/null +++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2003, 2015, 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 + * @bug 4916607 + * @summary Test casts (errors) + * @author gafter + * + * @compile/fail/ref=CastFail.out -XDrawDiagnostics CastFail.java + */ + +import java.util.*; + +class CastFail { + + // --- Directly transferring parameters --- + + private class AA { } + + private class AB extends AA { } + private class AC extends AA> { } + private class AD extends AA> { } + private class AE extends AA> { } + private class AF extends AA { } + private class AG extends AA { } + + private void parameterTransfer() { + Object o; + + o = (AB) (AA) null; // <> + o = (AC) (AA>) null; // <> + o = (AC) (AA>) null; // <> + o = (AD) (AA>) null; // <> + o = (AE) (AA>) null; // <> + o = (AF) (AA) null; // <> + o = (AG) (AA) null; // <> + } + + // --- Inconsistent matches --- + + private class BA { } + private class BB { } + + private class BC extends BA { } + private class BD extends BB { } + + private void inconsistentMatches() { + Object o; + + o = (BC) (BA) null; // <> + o = (BD) (BB) null; // <> + o = (BD) (BB) null; // <> + } + + // --- Transferring parameters via supertypes --- + + private interface CA { } + private interface CB extends CA { } + private interface CC extends CA { } + + private class CD implements CB { } + private interface CE extends CC { } + + private interface CF { } + private interface CG { } + private class CH implements CF, CG { } + private interface CI extends CF { } + private interface CJ extends CG { } + private interface CK extends CI, CJ { } + + private void supertypeParameterTransfer() { + Object o; + CD cd = (CE) null; // <> + CE ce = (CD) null; // <> + o = (CE) (CD) null; // <> + + // 4916622: unnecessary warning with cast + // o = (CH) (CK) null; // <> <> + } + + // --- Disjoint --- + + private interface DA { } + private interface DB extends DA { } + private interface DC extends DA { } + + private void disjointness() { + Object o; + + // Classes + o = (DA) (DA) null; // <> + o = (DA) (DA) null; // <> + o = (DA) (DA) null; // <> + o = (DA) (DA) null; // <> + o = (DA) (DA) null; // <> + + // Typevars + o = (DA) (DA) null; // <> + o = (DA) (DA) null; // <> + + // Raw (asymmetrical!) + o = (DC) (DA) null; // <> + } +} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail.out b/langtools/test/tools/javac/generics/wildcards/neg/CastFail.out new file mode 100644 index 00000000000..410b9d569d0 --- /dev/null +++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail.out @@ -0,0 +1,22 @@ +CastFail.java:51:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.AA, CastFail.AB) +CastFail.java:52:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.AA>, CastFail.AC) +CastFail.java:53:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.AA>, CastFail.AC) +CastFail.java:54:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.AA>, CastFail.AD) +CastFail.java:55:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.AA>, CastFail.AE) +CastFail.java:56:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.AA, CastFail.AF) +CastFail.java:57:21: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.AA, CastFail.AG) +CastFail.java:71:21: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.BA, CastFail.BC) +CastFail.java:72:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.BB, CastFail.BD) +CastFail.java:73:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.BB, CastFail.BD) +CastFail.java:94:20: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.CE, CastFail.CD) +CastFail.java:95:20: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.CD, CastFail.CE) +CastFail.java:96:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.CD, CastFail.CE) +CastFail.java:112:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.DA, CastFail.DA) +CastFail.java:113:37: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.DA, CastFail.DA) +CastFail.java:114:34: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.DA, CastFail.DA) +CastFail.java:115:38: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.DA, CastFail.DA) +CastFail.java:116:34: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.DA, CastFail.DA) +CastFail.java:119:36: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.DA, CastFail.DA) +CastFail.java:120:21: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.DA, CastFail.DA) +CastFail.java:123:21: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: CastFail.DA, CastFail.DC) +21 errors diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail1.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail1.java deleted file mode 100644 index d4c649abdda..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail1.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail1.java - */ - -import java.util.*; - -class CastTest { - - // --- Directly transferring parameters --- - - private class AA { } - - private class AB extends AA { } - private class AC extends AA> { } - private class AD extends AA> { } - private class AE extends AA> { } - private class AF extends AA { } - private class AG extends AA { } - - private void parameterTransfer() { - Object o; - - o = (AB) (AA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail10.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail10.java deleted file mode 100644 index d7bb6ffd003..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail10.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail10.java - */ - -import java.util.*; - -class CastTest { - - // --- Inconsistent matches --- - - private class BA { } - private class BB { } - - private class BC extends BA { } - private class BD extends BB { } - - private void inconsistentMatches() { - Object o; - - o = (BD) (BB) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail11.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail11.java deleted file mode 100644 index 5a126c879d0..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail11.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail11.java - */ - -import java.util.*; - -class CastTest { - - // --- Transferring parameters via supertypes --- - - private interface CA { } - private interface CB extends CA { } - private interface CC extends CA { } - - private class CD implements CB { } - private interface CE extends CC { } - - private interface CF { } - private interface CG { } - private class CH implements CF, CG { } - private interface CI extends CF { } - private interface CJ extends CG { } - private interface CK extends CI, CJ { } - - private void supertypeParameterTransfer() { - Object o; - CD cd = (CE) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail12.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail12.java deleted file mode 100644 index 8478786992a..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail12.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail12.java - */ - -import java.util.*; - -class CastTest { - - // --- Transferring parameters via supertypes --- - - private interface CA { } - private interface CB extends CA { } - private interface CC extends CA { } - - private class CD implements CB { } - private interface CE extends CC { } - - private interface CF { } - private interface CG { } - private class CH implements CF, CG { } - private interface CI extends CF { } - private interface CJ extends CG { } - private interface CK extends CI, CJ { } - - private void supertypeParameterTransfer() { - Object o; - CE ce = (CD) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail13.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail13.java deleted file mode 100644 index 4d5de8f525a..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail13.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail13.java - */ - -import java.util.*; - -class CastTest { - - // --- Transferring parameters via supertypes --- - - private interface CA { } - private interface CB extends CA { } - private interface CC extends CA { } - - private class CD implements CB { } - private interface CE extends CC { } - - private interface CF { } - private interface CG { } - private class CH implements CF, CG { } - private interface CI extends CF { } - private interface CJ extends CG { } - private interface CK extends CI, CJ { } - - private void supertypeParameterTransfer() { - Object o; - o = (CE) (CD) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail14.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail14.java deleted file mode 100644 index ea653d8d077..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail14.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail14.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA { } - private interface DB extends DA { } - private interface DC extends DA { } - - private void disjointness() { - Object o; - - // Classes - o = (DA) (DA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail15.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail15.java deleted file mode 100644 index fd2e22a0fba..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail15.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail15.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA { } - private interface DB extends DA { } - private interface DC extends DA { } - - private void disjointness() { - Object o; - - o = (DA) (DA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail16.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail16.java deleted file mode 100644 index 48ffe37d937..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail16.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail16.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA { } - private interface DB extends DA { } - private interface DC extends DA { } - - private void disjointness() { - Object o; - - o = (DA) (DA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail17.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail17.java deleted file mode 100644 index 74e7c8eb937..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail17.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail17.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA { } - private interface DB extends DA { } - private interface DC extends DA { } - - private void disjointness() { - Object o; - - o = (DA) (DA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail18.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail18.java deleted file mode 100644 index dbdcb361088..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail18.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail18.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA { } - private interface DB extends DA { } - private interface DC extends DA { } - - private void disjointness() { - Object o; - - o = (DA) (DA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail19.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail19.java deleted file mode 100644 index 5dc399b3bc0..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail19.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail19.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA { } - private interface DB extends DA { } - private interface DC extends DA { } - - private void disjointness() { - Object o; - - o = (DA) (DA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail2.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail2.java deleted file mode 100644 index 2d84e2272b2..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail2.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail2.java - */ - -import java.util.*; - -class CastTest { - - // --- Directly transferring parameters --- - - private class AA { } - - private class AB extends AA { } - private class AC extends AA> { } - private class AD extends AA> { } - private class AE extends AA> { } - private class AF extends AA { } - private class AG extends AA { } - - private void parameterTransfer() { - Object o; - - o = (AC) (AA>) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail20.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail20.java deleted file mode 100644 index b467d5da22e..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail20.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail20.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA { } - private interface DB extends DA { } - private interface DC extends DA { } - - private void disjointness() { - Object o; - - o = (DA) (DA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail21.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail21.java deleted file mode 100644 index 4a5e0f26e80..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail21.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail20.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA { } - private interface DB extends DA { } - private interface DC extends DA { } - - private void disjointness() { - Object o; - - o = (DC) (DA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail3.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail3.java deleted file mode 100644 index 8453657d2df..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail3.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail3.java - */ - -import java.util.*; - -class CastTest { - - // --- Directly transferring parameters --- - - private class AA { } - - private class AB extends AA { } - private class AC extends AA> { } - private class AD extends AA> { } - private class AE extends AA> { } - private class AF extends AA { } - private class AG extends AA { } - - private void parameterTransfer() { - Object o; - - o = (AC) (AA>) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail4.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail4.java deleted file mode 100644 index cd90003e80e..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail4.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail4.java - */ - -import java.util.*; - -class CastTest { - - // --- Directly transferring parameters --- - - private class AA { } - - private class AB extends AA { } - private class AC extends AA> { } - private class AD extends AA> { } - private class AE extends AA> { } - private class AF extends AA { } - private class AG extends AA { } - - private void parameterTransfer() { - Object o; - - o = (AD) (AA>) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail5.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail5.java deleted file mode 100644 index 06c431f8eaa..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail5.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail5.java - */ - -import java.util.*; - -class CastTest { - - // --- Directly transferring parameters --- - - private class AA { } - - private class AB extends AA { } - private class AC extends AA> { } - private class AD extends AA> { } - private class AE extends AA> { } - private class AF extends AA { } - private class AG extends AA { } - - private void parameterTransfer() { - Object o; - - o = (AE) (AA>) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail6.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail6.java deleted file mode 100644 index cd2bb8a21bf..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail6.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail6.java - */ - -import java.util.*; - -class CastTest { - - // --- Directly transferring parameters --- - - private class AA { } - - private class AB extends AA { } - private class AC extends AA> { } - private class AD extends AA> { } - private class AE extends AA> { } - private class AF extends AA { } - private class AG extends AA { } - - private void parameterTransfer() { - Object o; - - o = (AF) (AA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail7.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail7.java deleted file mode 100644 index aa34163e461..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail7.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail7.java - */ - -import java.util.*; - -class CastTest { - - // --- Directly transferring parameters --- - - private class AA { } - - private class AB extends AA { } - private class AC extends AA> { } - private class AD extends AA> { } - private class AE extends AA> { } - private class AF extends AA { } - private class AG extends AA { } - - private void parameterTransfer() { - Object o; - - o = (AG) (AA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail8.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail8.java deleted file mode 100644 index 6e0cc23952d..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail8.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail8.java - */ - -import java.util.*; - -class CastTest { - - // --- Inconsistent matches --- - - private class BA { } - private class BB { } - - private class BC extends BA { } - private class BD extends BB { } - - private void inconsistentMatches() { - Object o; - - o = (BC) (BA) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastFail9.java b/langtools/test/tools/javac/generics/wildcards/neg/CastFail9.java deleted file mode 100644 index df90e3af3dc..00000000000 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail9.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 - * @bug 4916607 - * @summary Test casts (legal, warning, and errors) - * @author gafter - * - * @compile/fail CastFail9.java - */ - -import java.util.*; - -class CastTest { - - // --- Inconsistent matches --- - - private class BA { } - private class BB { } - - private class BC extends BA { } - private class BD extends BB { } - - private void inconsistentMatches() { - Object o; - - o = (BD) (BB) null; // <> - } - -} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn14.java b/langtools/test/tools/javac/generics/wildcards/neg/CastTest.java similarity index 76% rename from langtools/test/tools/javac/generics/wildcards/neg/CastWarn14.java rename to langtools/test/tools/javac/generics/wildcards/neg/CastTest.java index 09b45651628..7653d6b2ad1 100644 --- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn14.java +++ b/langtools/test/tools/javac/generics/wildcards/neg/CastTest.java @@ -24,10 +24,10 @@ /* * @test * @bug 4916607 - * @summary Test casts (legal, warning, and errors) + * @summary Test casts (legal) * @author gafter * - * @compile/fail -Werror -Xlint:unchecked CastWarn14.java + * @compile CastTest.java */ import java.util.*; @@ -49,24 +49,13 @@ class CastTest { Object o; o = (AB) (AA) null; // <> - o = (AB) (AA) null; // <> o = (AC) (AA>) null; // <> - o = (AC) (AA>) null; // <> - o = (AC) (AA>) null; // <> - o = (AD) (AA>) null; // <> - o = (AD) (AA>) null; // <> o = (AD) (AA>) null; // <> o = (AD) (AA>) null; // <> - o = (AE) (AA>) null; // <> - o = (AE) (AA>) null; // <> - o = (AF) (AA) null; // <> - o = (AF) (AA) null; // <> - o = (AG) (AA) null; // <> - o = (AG) (AA) null; // <> } // --- Inconsistent matches --- @@ -81,10 +70,7 @@ class CastTest { Object o; o = (BC) (BA) null; // <> - o = (BC) (BA) null; // <> o = (BD) (BB) null; // <> - o = (BD) (BB) null; // <> - o = (BD) (BB) null; // <> } private void whyMustEverythingBeSo_______Complicated() { @@ -113,10 +99,7 @@ class CastTest { private void supertypeParameterTransfer() { Object o; - CD cd = (CE) null; // <> - CE ce = (CD) null; // <> o = (CE) (CD) null; // <> - o = (CE) (CD) null; // <> // 4916622: unnecessary warning with cast // o = (CH) (CK) null; // <> <> @@ -132,39 +115,24 @@ class CastTest { Object o; // Classes - o = (DA) (DA) null; // <> o = (DA) (DA) null; // <> - o = (DA) (DA) null; // <> o = (DA) (DA) null; // <> - o = (DA) (DA) null; // <> o = (DA) (DA) null; // <> - - o = (DA) (DA) null; // <> - - o = (DA) (DA) null; // <> o = (DA) (DA) null; // <> - o = (DA) (DA) null; // <> - o = (DA) (DA) null; // <> // Typevars o = (DA) (DA) null; // <> - o = (DA) (DA) null; // <> - - o = (DA) (DA) null; // <> // Raw (asymmetrical!) o = (DA) (DB) null; // <> o = (DA) (DB) null; // <> o = (DA) (DB) null; // <> - o = (DB) (DA) null; // <> o = (DB) (DA) null; // <> o = (DB) (DA) null; // <> - o = (DC) (DA) null; // <> - o = (DC) (DA) null; // <> } } diff --git a/langtools/test/tools/javac/generics/wildcards/neg/ParamCast.java b/langtools/test/tools/javac/generics/wildcards/neg/ParamCast.java index a42b1f385b8..36e6dd9781d 100644 --- a/langtools/test/tools/javac/generics/wildcards/neg/ParamCast.java +++ b/langtools/test/tools/javac/generics/wildcards/neg/ParamCast.java @@ -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 4916567 - * @summary Description + * @summary integrate improved wildcard substitution from CPH * @author gafter * - * @compile/fail ParamCast.java + * @compile/fail/ref=ParamCast.out -XDrawDiagnostics ParamCast.java */ class A {} diff --git a/langtools/test/tools/javac/generics/wildcards/neg/ParamCast.out b/langtools/test/tools/javac/generics/wildcards/neg/ParamCast.out new file mode 100644 index 00000000000..77500d2161f --- /dev/null +++ b/langtools/test/tools/javac/generics/wildcards/neg/ParamCast.out @@ -0,0 +1,2 @@ +ParamCast.java:15:36: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: A, B) +1 error diff --git a/langtools/test/tools/javac/generics/wildcards/neg/Readonly.java b/langtools/test/tools/javac/generics/wildcards/neg/Readonly.java index 3093854b09a..bd8d9a460ea 100644 --- a/langtools/test/tools/javac/generics/wildcards/neg/Readonly.java +++ b/langtools/test/tools/javac/generics/wildcards/neg/Readonly.java @@ -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 4916607 4931647 * @summary an extends-bound (covariant) wildcard is like readonly * @author gafter * - * @compile/fail Readonly.java + * @compile/fail/ref=Readonly.out -XDrawDiagnostics Readonly.java */ class Err { diff --git a/langtools/test/tools/javac/generics/wildcards/neg/Readonly.out b/langtools/test/tools/javac/generics/wildcards/neg/Readonly.out new file mode 100644 index 00000000000..8d3230407dd --- /dev/null +++ b/langtools/test/tools/javac/generics/wildcards/neg/Readonly.out @@ -0,0 +1,2 @@ +Readonly.java:15:10: compiler.err.cant.apply.symbol: kindname.method, put, Err, Err, kindname.class, Err, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: Err, Err)) +1 error diff --git a/langtools/test/tools/javac/generics/wildcards/neg/Unbounded.java b/langtools/test/tools/javac/generics/wildcards/neg/Unbounded.java index e0247ff0a06..a7f1b5c3886 100644 --- a/langtools/test/tools/javac/generics/wildcards/neg/Unbounded.java +++ b/langtools/test/tools/javac/generics/wildcards/neg/Unbounded.java @@ -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 4916607 * @summary an unbounded (bivariant) wildcard doesn't allow reading * @author gafter * - * @compile/fail Unbounded.java + * @compile/fail/ref=Unbounded.out -XDrawDiagnostics Unbounded.java */ import java.util.Stack; diff --git a/langtools/test/tools/javac/generics/wildcards/neg/Unbounded.out b/langtools/test/tools/javac/generics/wildcards/neg/Unbounded.out new file mode 100644 index 00000000000..850fa15c145 --- /dev/null +++ b/langtools/test/tools/javac/generics/wildcards/neg/Unbounded.out @@ -0,0 +1,2 @@ +Unbounded.java:14:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.type.captureof: 1, ?, java.lang.String) +1 error