Mercurial > hg > jdk9-shenandoah > langtools
changeset 2926:b1cc2f7a9c29
8075165: Group 14c: golden files for tests in tools/javac/generics/wildcards dir
Reviewed-by: jjg, vromero
author | sogoel |
---|---|
date | Fri, 15 May 2015 17:12:58 -0700 |
parents | 826c5e3616da |
children | 044ab500b496 |
files | test/tools/javac/generics/wildcards/neg/CastWarn.java test/tools/javac/generics/wildcards/neg/CastWarn.out test/tools/javac/generics/wildcards/neg/CastWarn10.java test/tools/javac/generics/wildcards/neg/CastWarn11.java test/tools/javac/generics/wildcards/neg/CastWarn12.java test/tools/javac/generics/wildcards/neg/CastWarn13.java test/tools/javac/generics/wildcards/neg/CastWarn14.java test/tools/javac/generics/wildcards/neg/CastWarn2.java test/tools/javac/generics/wildcards/neg/CastWarn3.java test/tools/javac/generics/wildcards/neg/CastWarn4.java test/tools/javac/generics/wildcards/neg/CastWarn5.java test/tools/javac/generics/wildcards/neg/CastWarn6.java test/tools/javac/generics/wildcards/neg/CastWarn7.java test/tools/javac/generics/wildcards/neg/CastWarn8.java test/tools/javac/generics/wildcards/neg/CastWarn9.java |
diffstat | 15 files changed, 81 insertions(+), 603 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/generics/wildcards/neg/CastWarn.java Fri May 15 17:12:58 2015 -0700 @@ -0,0 +1,66 @@ +/* + * 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 (warning) + * @author gafter + * + * @compile/ref=CastWarn.out -XDrawDiagnostics -Xlint:unchecked CastWarn.java + */ + +import java.util.*; + +class CastWarn { + + // --- Disjoint --- + + private interface DA<T> { } + private interface DB<T> extends DA<T> { } + private interface DC<T> extends DA<Integer> { } + + private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { + Object o; + + // Classes + o = (DA<? extends Runnable>) (DA<? extends Number>) null; // <<warn 2>> + o = (DA<? super Integer>) (DA<? extends Number>) null; // <<warn 3>> + o = (DA<? super String>) (DA<? super Number>) null; // <<warn 4>> + + // Typevars + o = (DA<? extends Integer>) (DA<N>) null; // <<warn 5>> + o = (DA<I>) (DA<? extends Number>) null; // <<warn 6>> + o = (DA<N>) (DA<? extends Integer>) null; // <<warn 7>> + o = (DA<N>) (DA<? extends Runnable>) null; // <<warn 8>> + + o = (DA<N>) (DA<I>) null; // <<warn 9>> + o = (DA<N>) (DA<R>) null; // <<warn 10>> + + // Raw (asymmetrical!) + o = (DA<Number>) (DB) null; // <<warn 11>> + o = (DA<? extends Number>) (DB) null; // <<warn 12>> + o = (DB<Number>) (DA) null; // <<warn 13>> + o = (DB<? extends Number>) (DA) null; // <<warn 14>> + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/generics/wildcards/neg/CastWarn.out Fri May 15 17:12:58 2015 -0700 @@ -0,0 +1,14 @@ +CastWarn.java:47:38: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA<compiler.misc.type.captureof: 1, ? extends java.lang.Number>, CastWarn.DA<? extends java.lang.Runnable> +CastWarn.java:48:35: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA<compiler.misc.type.captureof: 1, ? extends java.lang.Number>, CastWarn.DA<? super java.lang.Integer> +CastWarn.java:49:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA<compiler.misc.type.captureof: 1, ? super java.lang.Number>, CastWarn.DA<? super java.lang.String> +CastWarn.java:52:37: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA<N>, CastWarn.DA<? extends java.lang.Integer> +CastWarn.java:53:21: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA<compiler.misc.type.captureof: 1, ? extends java.lang.Number>, CastWarn.DA<I> +CastWarn.java:54:21: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA<compiler.misc.type.captureof: 1, ? extends java.lang.Integer>, CastWarn.DA<N> +CastWarn.java:55:21: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA<compiler.misc.type.captureof: 1, ? extends java.lang.Runnable>, CastWarn.DA<N> +CastWarn.java:57:21: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA<I>, CastWarn.DA<N> +CastWarn.java:58:21: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA<R>, CastWarn.DA<N> +CastWarn.java:61:26: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DB, CastWarn.DA<java.lang.Number> +CastWarn.java:62:36: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DB, CastWarn.DA<? extends java.lang.Number> +CastWarn.java:63:26: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA, CastWarn.DB<java.lang.Number> +CastWarn.java:64:36: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), CastWarn.DA, CastWarn.DB<? extends java.lang.Number> +13 warnings
--- a/test/tools/javac/generics/wildcards/neg/CastWarn10.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn10.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<N>) (DA<R>) null; // <<warn 10>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn11.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn11.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<Number>) (DB) null; // <<warn 11>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn12.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn12.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<? extends Number>) (DB) null; // <<warn 12>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn13.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn13.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DB<Number>) (DA) null; // <<warn 13>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn14.java Fri May 15 16:59:34 2015 -0700 +++ b/test/tools/javac/generics/wildcards/neg/CastWarn14.java Fri May 15 17:12:58 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -139,43 +139,29 @@ o = (DA<? super Number>) (DA<Integer>) null; // <<fail 16>> o = (DA<?>) (DA<Integer>) null; // <<pass>> - o = (DA<? extends Runnable>) (DA<? extends Number>) null; // <<warn 2>> o = (DA<? extends Runnable>) (DA<? extends String>) null; // <<fail 17>> - o = (DA<? super Integer>) (DA<? extends Number>) null; // <<warn 3>> o = (DA<? super Number>) (DA<? extends Integer>) null; // <<fail 18>> o = (DA<?>) (DA<? extends Integer>) null; // <<pass>> - o = (DA<? super String>) (DA<? super Number>) null; // <<warn 4>> o = (DA<?>) (DA<? super String>) null; // <<pass>> o = (DA<?>) (DA<?>) null; // <<pass>> // Typevars o = (DA<? extends Number>) (DA<I>) null; // <<pass>> - o = (DA<? extends Integer>) (DA<N>) null; // <<warn 5>> o = (DA<? extends String>) (DA<I>) null; // <<fail 19>> - o = (DA<I>) (DA<? extends Number>) null; // <<warn 6>> - o = (DA<N>) (DA<? extends Integer>) null; // <<warn 7>> - o = (DA<N>) (DA<? extends Runnable>) null; // <<warn 8>> - - o = (DA<N>) (DA<I>) null; // <<warn 9>> - o = (DA<N>) (DA<R>) null; // <<warn 10>> o = (DA<S>) (DA<R>) null; // <<fail 20>> // Raw (asymmetrical!) o = (DA) (DB<Number>) null; // <<pass>> - o = (DA<Number>) (DB) null; // <<warn 11>> o = (DA<?>) (DB) null; // <<pass>> o = (DA<? extends Object>) (DB) null; // <<pass>> - o = (DA<? extends Number>) (DB) null; // <<warn 12>> o = (DB) (DA<Number>) null; // <<pass>> - o = (DB<Number>) (DA) null; // <<warn 13>> o = (DB<?>) (DA) null; // <<pass>> o = (DB<? extends Object>) (DA) null; // <<pass>> - o = (DB<? extends Number>) (DA) null; // <<warn 14>> o = (DC<?>) (DA<?>) null; // <<pass>> o = (DC<?>) (DA<? super String>) null; // <<fail 21>>
--- a/test/tools/javac/generics/wildcards/neg/CastWarn2.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn2.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<? extends Runnable>) (DA<? extends Number>) null; // <<warn 2>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn3.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn3.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<? super Integer>) (DA<? extends Number>) null; // <<warn 3>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn4.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn4.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<? super String>) (DA<? super Number>) null; // <<warn 4>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn5.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn5.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<? extends Integer>) (DA<N>) null; // <<warn 5>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn6.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn6.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<I>) (DA<? extends Number>) null; // <<warn 6>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn7.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn7.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<N>) (DA<? extends Integer>) null; // <<warn 7>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn8.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn8.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<N>) (DA<? extends Runnable>) null; // <<warn 8>> - } - -}
--- a/test/tools/javac/generics/wildcards/neg/CastWarn9.java Fri May 15 16:59:34 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -Werror -Xlint:unchecked CastWarn9.java - */ - -import java.util.*; - -class CastTest { - - // --- Disjoint --- - - private interface DA<T> { } - private interface DB<T> extends DA<T> { } - private interface DC<T> extends DA<Integer> { } - - private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() { - Object o; - - o = (DA<N>) (DA<I>) null; // <<warn 9>> - } - -}