8075165: Group 14c: golden files for tests in tools/javac/generics/wildcards dir
Reviewed-by: jjg, vromero
This commit is contained in:
parent
395f1173a9
commit
8f711841fa
@ -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
|
||||
@ -24,15 +24,15 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4916607
|
||||
* @summary Test casts (legal, warning, and errors)
|
||||
* @summary Test casts (warning)
|
||||
* @author gafter
|
||||
*
|
||||
* @compile/fail -Werror -Xlint:unchecked CastWarn2.java
|
||||
* @compile/ref=CastWarn.out -XDrawDiagnostics -Xlint:unchecked CastWarn.java
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
class CastTest {
|
||||
class CastWarn {
|
||||
|
||||
// --- Disjoint ---
|
||||
|
||||
@ -43,7 +43,24 @@ class CastTest {
|
||||
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>>
|
||||
}
|
||||
}
|
@ -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
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
@ -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 @@ class CastTest {
|
||||
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>>
|
||||
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
@ -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>>
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user