Mercurial > hg > jdk9-shenandoah > langtools
changeset 2925:826c5e3616da
8075164: Group 14b: golden files for tests in tools/javac/generics/wildcards dir
Reviewed-by: jjg, vromero
author | sogoel |
---|---|
date | Fri, 15 May 2015 16:59:34 -0700 |
parents | cf3f2a0aa7ef |
children | b1cc2f7a9c29 |
files | test/tools/javac/generics/wildcards/AssignmentDifferentTypes.java test/tools/javac/generics/wildcards/AssignmentDifferentTypes.out test/tools/javac/generics/wildcards/AssignmentDifferentTypes1.java test/tools/javac/generics/wildcards/AssignmentDifferentTypes2.java test/tools/javac/generics/wildcards/AssignmentDifferentTypes3.java test/tools/javac/generics/wildcards/AssignmentDifferentTypes4.java test/tools/javac/generics/wildcards/AssignmentDifferentTypes5.java test/tools/javac/generics/wildcards/AssignmentDifferentTypes6.java test/tools/javac/generics/wildcards/AssignmentDifferentTypes7.java test/tools/javac/generics/wildcards/AssignmentDifferentTypes8.java test/tools/javac/generics/wildcards/AssignmentDifferentTypes9.java |
diffstat | 11 files changed, 68 insertions(+), 426 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/generics/wildcards/AssignmentDifferentTypes.java Fri May 15 16:59:34 2015 -0700 @@ -0,0 +1,59 @@ +/* + * 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 + * @summary Test subtyping for wildcards with related type bounds. + * + * @compile/fail/ref=AssignmentDifferentTypes.out -XDrawDiagnostics AssignmentDifferentTypes.java + */ + +public class AssignmentDifferentTypes { + + public static void main(String[] args) { + Ref<Der> derexact = null; + Ref<Base> baseexact = null; + Ref<? extends Der> derext = null; + Ref<? extends Base> baseext = null; + Ref<? super Der> dersuper = null; + Ref<? super Base> basesuper = null; + + baseext = derext; // <<pass>> <? extends Base> = <? extends Der> + baseext = derexact; // <<pass>> <? extends Base> = <Der> + dersuper = basesuper; // <<pass>> <? super Der> = <? super Base> + dersuper = baseexact; // <<pass>> <? super Der> = <Base> + + derexact = baseexact; // <<fail>> <Der> = <Base> + baseexact = derexact; // <<fail>> <Base> = <Der> + derext = baseext; // <<fail>> <? extends Der> = <? extends Base> + derext = baseexact; // <<fail>> <? extends Der> = <Base> + derext = basesuper; // <<fail>> <? extends Der> = <? super Base> + baseext = dersuper; // <<fail>> <? extends Base> = <? super Der> + basesuper = dersuper; // <<fail>> <? super Base> = <? super Der> + basesuper = derexact; // <<fail>> <? super Base> = <Der> + } +} + +class Ref<T> {} +class Base {} +class Der extends Base {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/generics/wildcards/AssignmentDifferentTypes.out Fri May 15 16:59:34 2015 -0700 @@ -0,0 +1,9 @@ +AssignmentDifferentTypes.java:46:20: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Ref<Base>, Ref<Der>) +AssignmentDifferentTypes.java:47:21: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Ref<Der>, Ref<Base>) +AssignmentDifferentTypes.java:48:18: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Ref<compiler.misc.type.captureof: 1, ? extends Base>, Ref<? extends Der>) +AssignmentDifferentTypes.java:49:18: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Ref<Base>, Ref<? extends Der>) +AssignmentDifferentTypes.java:50:18: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Ref<compiler.misc.type.captureof: 1, ? super Base>, Ref<? extends Der>) +AssignmentDifferentTypes.java:51:19: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Ref<compiler.misc.type.captureof: 1, ? super Der>, Ref<? extends Base>) +AssignmentDifferentTypes.java:52:21: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Ref<compiler.misc.type.captureof: 1, ? super Der>, Ref<? super Base>) +AssignmentDifferentTypes.java:53:21: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Ref<Der>, Ref<? super Base>) +8 errors
--- a/test/tools/javac/generics/wildcards/AssignmentDifferentTypes1.java Fri May 15 16:53:42 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 - * @summary Test subtyping for wildcards with related type bounds. - * - * @compile AssignmentDifferentTypes1.java - */ - -public class AssignmentDifferentTypes1 { - - public static void main(String[] args) { - Ref<Der> derexact = null; - Ref<Base> baseexact = null; - Ref<? extends Der> derext = null; - Ref<? extends Base> baseext = null; - Ref<? super Der> dersuper = null; - Ref<? super Base> basesuper = null; - - baseext = derext; // <<pass>> <? extends Base> = <? extends Der> - baseext = derexact; // <<pass>> <? extends Base> = <Der> - dersuper = basesuper; // <<pass>> <? super Der> = <? super Base> - dersuper = baseexact; // <<pass>> <? super Der> = <Base> - } -} - -class Ref<T> {} -class Base {} -class Der extends Base {}
--- a/test/tools/javac/generics/wildcards/AssignmentDifferentTypes2.java Fri May 15 16:53:42 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - * @summary Test subtyping for wildcards with related type bounds. - * - * @compile/fail AssignmentDifferentTypes2.java - */ - -public class AssignmentDifferentTypes2 { - - public static void main(String[] args) { - Ref<Der> derexact = null; - Ref<Base> baseexact = null; - Ref<? extends Der> derext = null; - Ref<? extends Base> baseext = null; - Ref<? super Der> dersuper = null; - Ref<? super Base> basesuper = null; - - derexact = baseexact; // <<fail>> <Der> = <Base> - } -} - -class Ref<T> {} -class Base {} -class Der extends Base {}
--- a/test/tools/javac/generics/wildcards/AssignmentDifferentTypes3.java Fri May 15 16:53:42 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - * @summary Test subtyping for wildcards with related type bounds. - * - * @compile/fail AssignmentDifferentTypes3.java - */ - -public class AssignmentDifferentTypes3 { - - public static void main(String[] args) { - Ref<Der> derexact = null; - Ref<Base> baseexact = null; - Ref<? extends Der> derext = null; - Ref<? extends Base> baseext = null; - Ref<? super Der> dersuper = null; - Ref<? super Base> basesuper = null; - - baseexact = derexact; // <<fail>> <Base> = <Der> - } -} - -class Ref<T> {} -class Base {} -class Der extends Base {}
--- a/test/tools/javac/generics/wildcards/AssignmentDifferentTypes4.java Fri May 15 16:53:42 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - * @summary Test subtyping for wildcards with related type bounds. - * - * @compile/fail AssignmentDifferentTypes4.java - */ - -public class AssignmentDifferentTypes4 { - - public static void main(String[] args) { - Ref<Der> derexact = null; - Ref<Base> baseexact = null; - Ref<? extends Der> derext = null; - Ref<? extends Base> baseext = null; - Ref<? super Der> dersuper = null; - Ref<? super Base> basesuper = null; - - derext = baseext; // <<fail>> <? extends Der> = <? extends Base> - } -} - -class Ref<T> {} -class Base {} -class Der extends Base {}
--- a/test/tools/javac/generics/wildcards/AssignmentDifferentTypes5.java Fri May 15 16:53:42 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - * @summary Test subtyping for wildcards with related type bounds. - * - * @compile/fail AssignmentDifferentTypes5.java - */ - -public class AssignmentDifferentTypes5 { - - public static void main(String[] args) { - Ref<Der> derexact = null; - Ref<Base> baseexact = null; - Ref<? extends Der> derext = null; - Ref<? extends Base> baseext = null; - Ref<? super Der> dersuper = null; - Ref<? super Base> basesuper = null; - - derext = baseexact; // <<fail>> <? extends Der> = <Base> - } -} - -class Ref<T> {} -class Base {} -class Der extends Base {}
--- a/test/tools/javac/generics/wildcards/AssignmentDifferentTypes6.java Fri May 15 16:53:42 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - * @summary Test subtyping for wildcards with related type bounds. - * - * @compile/fail AssignmentDifferentTypes6.java - */ - -public class AssignmentDifferentTypes6 { - - public static void main(String[] args) { - Ref<Der> derexact = null; - Ref<Base> baseexact = null; - Ref<? extends Der> derext = null; - Ref<? extends Base> baseext = null; - Ref<? super Der> dersuper = null; - Ref<? super Base> basesuper = null; - - derext = basesuper; // <<fail>> <? extends Der> = <? super Base> - } -} - -class Ref<T> {} -class Base {} -class Der extends Base {}
--- a/test/tools/javac/generics/wildcards/AssignmentDifferentTypes7.java Fri May 15 16:53:42 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - * @summary Test subtyping for wildcards with related type bounds. - * - * @compile/fail AssignmentDifferentTypes7.java - */ - -public class AssignmentDifferentTypes7 { - - public static void main(String[] args) { - Ref<Der> derexact = null; - Ref<Base> baseexact = null; - Ref<? extends Der> derext = null; - Ref<? extends Base> baseext = null; - Ref<? super Der> dersuper = null; - Ref<? super Base> basesuper = null; - - baseext = dersuper; // <<fail>> <? extends Base> = <? super Der> - } -} - -class Ref<T> {} -class Base {} -class Der extends Base {}
--- a/test/tools/javac/generics/wildcards/AssignmentDifferentTypes8.java Fri May 15 16:53:42 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - * @summary Test subtyping for wildcards with related type bounds. - * - * @compile/fail AssignmentDifferentTypes8.java - */ - -public class AssignmentDifferentTypes8 { - - public static void main(String[] args) { - Ref<Der> derexact = null; - Ref<Base> baseexact = null; - Ref<? extends Der> derext = null; - Ref<? extends Base> baseext = null; - Ref<? super Der> dersuper = null; - Ref<? super Base> basesuper = null; - - basesuper = dersuper; // <<fail>> <? super Base> = <? super Der> - } -} - -class Ref<T> {} -class Base {} -class Der extends Base {}
--- a/test/tools/javac/generics/wildcards/AssignmentDifferentTypes9.java Fri May 15 16:53:42 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - * @summary Test subtyping for wildcards with related type bounds. - * - * @compile/fail AssignmentDifferentTypes9.java - */ - -public class AssignmentDifferentTypes9 { - - public static void main(String[] args) { - Ref<Der> derexact = null; - Ref<Base> baseexact = null; - Ref<? extends Der> derext = null; - Ref<? extends Base> baseext = null; - Ref<? super Der> dersuper = null; - Ref<? super Base> basesuper = null; - - basesuper = derexact; // <<fail>> <? super Base> = <Der> - } -} - -class Ref<T> {} -class Base {} -class Der extends Base {}