file_name stringlengths 6 86 | file_path stringlengths 45 249 | content stringlengths 47 6.26M | file_size int64 47 6.26M | language stringclasses 1 value | extension stringclasses 1 value | repo_name stringclasses 767 values | repo_stars int64 8 14.4k | repo_forks int64 0 1.17k | repo_open_issues int64 0 788 | repo_created_at stringclasses 767 values | repo_pushed_at stringclasses 767 values |
|---|---|---|---|---|---|---|---|---|---|---|---|
Capture.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/Capture.java | /*
* 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 4916634
* @summary Wildcard capture
* @author gafter
*
* @compile/fail Capture.java
*/
class X<T> {}
class Capture {
void f(X<X<? extends Number>> x) {
f4(x);
}
<T> void f4(X<X<T>> x) {}
}
| 1,290 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail4.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail4.java | /*
* 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<T> { }
private class AB<T> extends AA<T> { }
private class AC<T> extends AA<Vector<T>> { }
private class AD<T> extends AA<Vector<? extends T>> { }
private class AE<T> extends AA<Vector<? super T>> { }
private class AF<T> extends AA<T[]> { }
private class AG<T> extends AA<String> { }
private void parameterTransfer() {
Object o;
o = (AD<String>) (AA<Vector<? extends Number>>) null; // <<fail 4>>
}
}
| 1,753 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn2.java | /*
* 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>>
}
}
| 1,629 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail6.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail6.java | /*
* 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<T> { }
private class AB<T> extends AA<T> { }
private class AC<T> extends AA<Vector<T>> { }
private class AD<T> extends AA<Vector<? extends T>> { }
private class AE<T> extends AA<Vector<? super T>> { }
private class AF<T> extends AA<T[]> { }
private class AG<T> extends AA<String> { }
private void parameterTransfer() {
Object o;
o = (AF<String>) (AA<Number[]>) null; // <<fail 6>>
}
}
| 1,737 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn10.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn10.java | /*
* 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,599 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn14.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn14.java | /*
* 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 CastWarn14.java
*/
import java.util.*;
class CastTest {
// --- Directly transferring parameters ---
private class AA<T> { }
private class AB<T> extends AA<T> { }
private class AC<T> extends AA<Vector<T>> { }
private class AD<T> extends AA<Vector<? extends T>> { }
private class AE<T> extends AA<Vector<? super T>> { }
private class AF<T> extends AA<T[]> { }
private class AG<T> extends AA<String> { }
private void parameterTransfer() {
Object o;
o = (AB<String>) (AA<String>) null; // <<pass>>
o = (AB<String>) (AA<Number>) null; // <<fail 1>>
o = (AC<String>) (AA<Vector<String>>) null; // <<pass>>
o = (AC<String>) (AA<Vector<Number>>) null; // <<fail 2>>
o = (AC<String>) (AA<Stack<String>>) null; // <<fail 3>>
o = (AD<Number>) (AA<Vector<? extends Number>>) null; // <<pass>>
o = (AD<String>) (AA<Vector<? extends Number>>) null; // <<fail 4>>
o = (AD<?>) (AA<Vector<? extends Object>>) null; // <<pass>>
o = (AD<Object>) (AA<Vector<?>>) null; // <<pass>>
o = (AE<String>) (AA<Vector<? super String>>) null; // <<pass>>
o = (AE<Number>) (AA<Vector<? super String>>) null; // <<fail 5>>
o = (AF<String>) (AA<String[]>) null; // <<pass>>
o = (AF<String>) (AA<Number[]>) null; // <<fail 6>>
o = (AG<?>) (AA<String>) null; // <<pass>>
o = (AG<?>) (AA<Number>) null; // <<fail 7>>
}
// --- Inconsistent matches ---
private class BA<T> { }
private class BB<T, S> { }
private class BC<T> extends BA<Integer> { }
private class BD<T> extends BB<T, T> { }
private void inconsistentMatches() {
Object o;
o = (BC<?>) (BA<Integer>) null; // <<pass>>
o = (BC<?>) (BA<String>) null; // <<fail 8>>
o = (BD<String>) (BB<String, String>) null; // <<pass>>
o = (BD<String>) (BB<String, Number>) null; // <<fail 9>>
o = (BD<String>) (BB<Number, String>) null; // <<fail 10>>
}
private void whyMustEverythingBeSo_______Complicated() {
// This has to work...
BD<Number> bd = new BD<Number>();
BB<? extends Number, ? super Integer> bb = bd;
// 4916620: wildcards: legal cast is rejected
// bd = (BD<Number>) bb; // <<warn>> <<todo: cast-infer>>
}
// --- Transferring parameters via supertypes ---
private interface CA<T> { }
private interface CB<T> extends CA<T> { }
private interface CC<T> extends CA<T> { }
private class CD<T> implements CB<T> { }
private interface CE<T> extends CC<T> { }
private interface CF<S> { }
private interface CG<T> { }
private class CH<S, T> implements CF<S>, CG<T> { }
private interface CI<S> extends CF<S> { }
private interface CJ<T> extends CG<T> { }
private interface CK<S, T> extends CI<S>, CJ<T> { }
private void supertypeParameterTransfer() {
Object o;
CD<?> cd = (CE<?>) null; // <<fail 11>>
CE<?> ce = (CD<?>) null; // <<fail 12>>
o = (CE<String>) (CD<String>) null; // <<pass>>
o = (CE<Number>) (CD<String>) null; // <<fail 13>>
// 4916622: unnecessary warning with cast
// o = (CH<String, Integer>) (CK<String, Integer>) null; // <<pass>> <<todo: cast-infer>>
}
// --- 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<Number>) (DA<Integer>) null; // <<fail 14>>
o = (DA<? extends Number>) (DA<Integer>) null; // <<pass>>
o = (DA<? extends Integer>) (DA<Number>) null; // <<fail 15>>
o = (DA<? super Integer>) (DA<Number>) null; // <<pass>>
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>>
}
}
| 6,979 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail12.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail12.java | /*
* 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<T> { }
private interface CB<T> extends CA<T> { }
private interface CC<T> extends CA<T> { }
private class CD<T> implements CB<T> { }
private interface CE<T> extends CC<T> { }
private interface CF<S> { }
private interface CG<T> { }
private class CH<S, T> implements CF<S>, CG<T> { }
private interface CI<S> extends CF<S> { }
private interface CJ<T> extends CG<T> { }
private interface CK<S, T> extends CI<S>, CJ<T> { }
private void supertypeParameterTransfer() {
Object o;
CE<?> ce = (CD<?>) null; // <<fail 12>>
}
}
| 1,894 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn6.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn6.java | /*
* 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,612 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn8.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn8.java | /*
* 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,614 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail3.java | /*
* 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<T> { }
private class AB<T> extends AA<T> { }
private class AC<T> extends AA<Vector<T>> { }
private class AD<T> extends AA<Vector<? extends T>> { }
private class AE<T> extends AA<Vector<? super T>> { }
private class AF<T> extends AA<T[]> { }
private class AG<T> extends AA<String> { }
private void parameterTransfer() {
Object o;
o = (AC<String>) (AA<Stack<String>>) null; // <<fail 3>>
}
}
| 1,742 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail19.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail19.java | /*
* 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<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 String>) (DA<I>) null; // <<fail 19>>
}
}
| 1,589 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail10.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail10.java | /*
* 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<T> { }
private class BB<T, S> { }
private class BC<T> extends BA<Integer> { }
private class BD<T> extends BB<T, T> { }
private void inconsistentMatches() {
Object o;
o = (BD<String>) (BB<Number, String>) null; // <<fail 10>>
}
}
| 1,558 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail18.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail18.java | /*
* 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<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 Number>) (DA<? extends Integer>) null; // <<fail 18>>
}
}
| 1,603 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail5.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail5.java | /*
* 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<T> { }
private class AB<T> extends AA<T> { }
private class AC<T> extends AA<Vector<T>> { }
private class AD<T> extends AA<Vector<? extends T>> { }
private class AE<T> extends AA<Vector<? super T>> { }
private class AF<T> extends AA<T[]> { }
private class AG<T> extends AA<String> { }
private void parameterTransfer() {
Object o;
o = (AE<Number>) (AA<Vector<? super String>>) null; // <<fail 5>>
}
}
| 1,751 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail1.java | /*
* 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<T> { }
private class AB<T> extends AA<T> { }
private class AC<T> extends AA<Vector<T>> { }
private class AD<T> extends AA<Vector<? extends T>> { }
private class AE<T> extends AA<Vector<? super T>> { }
private class AF<T> extends AA<T[]> { }
private class AG<T> extends AA<String> { }
private void parameterTransfer() {
Object o;
o = (AB<String>) (AA<Number>) null; // <<fail 1>>
}
}
| 1,735 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AmbiguousCast.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/AmbiguousCast.java | /*
* 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 4897892
* @summary cast to parameterized type is accepted although it should be rejected
* @author gafter
*
* @compile/fail -Werror -Xlint:unchecked AmbiguousCast.java
*/
class Test {
private static class GenericWrapper<Elem> {
private Elem theObject;
public GenericWrapper(Elem arg) {
theObject = arg;
}
public <T extends Elem> GenericWrapper (GenericWrapper<T> other) {
this.theObject = other.theObject;
}
public String toString() {
return theObject.toString();
}
}
private static GenericWrapper<String> method (Object wrappedString) {
return (GenericWrapper<String>) wrappedString;
}
public static void main(String[] args) {
System.out.println(method(new GenericWrapper<String>("abc")));
System.out.println(method(new GenericWrapper<Exception>(new Exception())));
}
}
| 1,992 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail21.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail21.java | /*
* 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<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 = (DC<?>) (DA<? super String>) null; // <<fail 21>>
}
}
| 1,587 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn12.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn12.java | /*
* 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,611 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Readonly.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/Readonly.java | /*
* 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 4931647
* @summary an extends-bound (covariant) wildcard is like readonly
* @author gafter
*
* @compile/fail Readonly.java
*/
class Err<T> {
Err<T> get() { return null; }
void put(Err<T> t) {}
static void f(Err<? extends String> e) {
e.put(e.get());
}
}
| 1,366 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail13.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail13.java | /*
* 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<T> { }
private interface CB<T> extends CA<T> { }
private interface CC<T> extends CA<T> { }
private class CD<T> implements CB<T> { }
private interface CE<T> extends CC<T> { }
private interface CF<S> { }
private interface CG<T> { }
private class CH<S, T> implements CF<S>, CG<T> { }
private interface CI<S> extends CF<S> { }
private interface CJ<T> extends CG<T> { }
private interface CK<S, T> extends CI<S>, CJ<T> { }
private void supertypeParameterTransfer() {
Object o;
o = (CE<Number>) (CD<String>) null; // <<fail 13>>
}
}
| 1,905 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn11.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn11.java | /*
* 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,601 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail16.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail16.java | /*
* 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<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 Number>) (DA<Integer>) null; // <<fail 16>>
}
}
| 1,593 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn9.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn9.java | /*
* 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>>
}
}
| 1,597 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail20.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail20.java | /*
* 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<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<S>) (DA<R>) null; // <<fail 20>>
}
}
| 1,574 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail11.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail11.java | /*
* 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<T> { }
private interface CB<T> extends CA<T> { }
private interface CC<T> extends CA<T> { }
private class CD<T> implements CB<T> { }
private interface CE<T> extends CC<T> { }
private interface CF<S> { }
private interface CG<T> { }
private class CH<S, T> implements CF<S>, CG<T> { }
private interface CI<S> extends CF<S> { }
private interface CJ<T> extends CG<T> { }
private interface CK<S, T> extends CI<S>, CJ<T> { }
private void supertypeParameterTransfer() {
Object o;
CD<?> cd = (CE<?>) null; // <<fail 11>>
}
}
| 1,894 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6330931.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/6330931/T6330931.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6330931
* @summary Super wildcard has incorrect upper bound
* @author Peter von der Ah\u00e9
* @compile T6330931.java
*/
import java.util.List;
class Foo {}
class Bar extends Foo {}
interface FooList<T extends Foo> extends List<T> {}
class Test {
<T extends FooList<? super Bar>> void m(T t) {
Foo f = t.get(0);
}
}
| 1,422 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7034495.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/7034495/T7034495.java | /*
* Copyright (c) 2008, 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 7034495
* @summary Javac asserts on usage of wildcards in bounds
* @compile/fail/ref=T7034495.out -XDrawDiagnostics T7034495.java
*/
class T7034495 {
interface A<T> {
T foo();
}
interface B<T> {
T foo();
}
interface C<T extends A<?> & B<?>> { }
}
| 1,366 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
List.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/odersky/List.java | /*
* Copyright (c) 2002, 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.
*/
class List<A> {
/** The first element of the list, supposed to be immutable.
*/
public A head;
/** The remainder of the list except for its first element, supposed
* to be immutable.
*/
public List<A> tail;
/** Construct a list given its head and tail.
*/
public List(A head, List<A> tail) {
this.tail = tail;
this.head = head;
}
/** Construct an empty list.
*/
public List() {
this(null, null);
}
/** Construct a list consisting of given element.
*/
public static <A> List<A> make(A x1) {
return new List<A>(x1, new List<A>());
}
/** Construct a list consisting of given elements.
*/
public static <A> List<A> make(A x1, A x2) {
return new List<A>(x1, new List<A>(x2, new List<A>()));
}
/** Construct a list consisting of given elements.
*/
public static <A> List<A> make(A x1, A x2, A x3) {
return new List<A>(x1, new List<A>(x2, new List<A>(x3, new List<A>())));
}
/** Construct a list consisting all elements of given array.
*/
public static <A> List<A> make(A[] vec) {
List<A> xs = new List<A>();
for (int i = vec.length - 1; i >= 0; i--)
xs = new List<A>(vec[i], xs);
return xs;
}
/** Construct a list consisting of a given number of identical elements.
* @param len The number of elements in the list.
* @param init The value of each element.
*/
public static <A> List<A> make(int len, A init) {
List<A> l = new List<A>();
for (int i = 0; i < len; i++) l = new List<A>(init, l);
return l;
}
/** Does list have no elements?
*/
public boolean isEmpty() {
return tail == null;
}
/** Does list have elements?
*/
public boolean nonEmpty() {
return tail != null;
}
/** Return the number of elements in this list.
*/
public int length() {
List<A> l = this;
int len = 0;
while (l.tail != null) {
l = l.tail;
len++;
}
return len;
}
/** Prepend given element to front of list, forming and returning
* a new list.
*/
public List<A> prepend(A x) {
return new List<A>(x, this);
}
/** Prepend given list of elements to front of list, forming and returning
* a new list.
*/
public List<A> prependList(List<A> xs) {
if (this.isEmpty()) return xs;
else if (xs.isEmpty()) return this;
else return this.prependList(xs.tail).prepend(xs.head);
}
/** Reverse list, forming and returning a new list.
*/
public List<A> reverse() {
List<A> rev = new List<A>();
for (List<A> l = this; l.nonEmpty(); l = l.tail)
rev = new List<A>(l.head, rev);
return rev;
}
/** Append given element at length, forming and returning
* a new list.
*/
public List<A> append(A x) {
return make(x).prependList(this);
}
/** Append given list at length, forming and returning
* a new list.
*/
public List<A> appendList(List<A> x) {
return x.prependList(this);
}
/** Copy successive elements of this list into given vector until
* list is exhausted or end of vector is reached.
*/
public A[] toArray(A[] vec) {
int i = 0;
List<A> l = this;
while (l.nonEmpty() && i < vec.length) {
vec[i] = l.head;
l = l.tail;
i++;
}
return vec;
}
/** Form a string listing all elements with given separator character.
*/
public String toString(String sep) {
if (isEmpty()) {
return "";
} else {
StringBuffer buf = new StringBuffer();
buf.append(((Object)head).toString());
for (List<A> l = tail; l.nonEmpty(); l = l.tail) {
buf.append(sep);
buf.append(((Object)l.head).toString());
}
return buf.toString();
}
}
/** Form a string listing all elements with comma as the separator character.
*/
public String toString() {
return toString(",");
}
/** Compute a hash code, overrides Object
*/
public int hashCode() {
List<A> l = this;
int h = 0;
while (l.tail != null) {
h = h * 41 + (head != null ? head.hashCode() : 0);
l = l.tail;
}
return h;
}
/** Is this list the same as other list?
*/
public boolean equals(Object other) {
return other instanceof List && equals(this, (List)other);
}
/** Are the two lists the same?
*/
public static boolean equals(List xs, List ys) {
while (xs.tail != null && ys.tail != null) {
if (xs.head == null) {
if (ys.head != null) return false;
} else {
if (!xs.head.equals(ys.head)) return false;
}
xs = xs.tail;
ys = ys.tail;
}
return xs.tail == null && ys.tail == null;
}
/** Does the list contain the specified element?
*/
public boolean contains(A x) {
List<A> l = this;
while (l.tail != null) {
if (x == null) {
if (l.head == null) return true;
} else {
if (x.equals(l.head)) return true;
}
l = l.tail;
}
return false;
}
}
| 6,617 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BadTest.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/odersky/BadTest.java | /*
* Copyright (c) 2002, 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
* @summary Negative regression test from odersky
* @author odersky
*
* @compile/fail BadTest.java
*/
class BadTest {
static class Main {
static <B> List<B> nil() { return new List<B>(); }
static <A> List<A> cons(A x, List<A> xs) { return xs.prepend(x); }
static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); }
static <A> A id(A x) { return x; }
public static void main(String[] args) {
List<Cell<String>> as = nil().prepend(makeCell(null));
List<Cell<String>> bs = cons(makeCell(null), nil());
List<String> xs = id(nil());
List<String> ys = cons("abc", id(nil()));
List<String> zs = id(nil()).prepend("abc");
List<Cell<String>> us = id(nil()).prepend(makeCell(null));
List<Cell<String>> vs = cons(makeCell(null), id(nil()));
System.out.println(nil() instanceof List<String>);
nil();
}
}
}
| 2,041 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Test4.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/odersky/Test4.java | /*
* Copyright (c) 2002, 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
* @summary Positive regression test from odersky
* @author odersky
*
* @compile Test4.java
*/
class Test4 {
interface I {}
interface J {}
static class C implements I, J {}
static class D implements I, J {}
interface Ord {}
static C c = new C();
static D d = new D();
static <B> List<B> nil() { return new List<B>(); }
static <A, B extends A> A f(A x, B y) { return x; }
static <A, B extends A> B g(List<A> x, List<B> y) { return y.head; }
static <A> List<A> cons(A x, List<A> xs) { return xs.prepend(x); }
static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); }
static <A> A id(A x) { return x; }
static Integer i = new Integer(1);
static Number n = i;
public static void main(String[] args) {
Number x = f(n, i);
String xy = g(cons("abc", Test4.<String>nil()), Test4.<String>nil());
System.out.println(g(cons("abc", nil()), nil()));
}
}
| 2,026 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BadTest3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/odersky/BadTest3.java | /*
* Copyright (c) 2002, 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
* @summary Negative regression test from odersky
* @author odersky
*
* @compile/fail BadTest3.java
*/
class BadTest3 {
interface I {}
interface J {}
static class C implements I, J {}
static class D implements I, J {}
interface Ord {}
static class Main {
static C c = new C();
static D d = new D();
static <B extends Ord> List<B> nil() { return new List<B>(); }
static <B extends I & J> B f(B x) { return x; }
static <A> List<A> cons(A x, List<A> xs) { return xs.prepend(x); }
static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); }
static <A> A id(A x) { return x; }
public static void main(String[] args) {
List<String> xs = nil();
f(null);
f(nil());
I i = f(null);
J j = f(nil());
}
}
}
| 1,940 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Cell.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/odersky/Cell.java | /*
* Copyright (c) 2002, 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.
*/
class Cell<A> {
A elem;
Cell(A elem) {
this.elem = elem;
}
}
| 1,133 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BadTest4.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/odersky/BadTest4.java | /*
* Copyright (c) 2002, 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
* @summary Negative regression test from odersky
* @author odersky
*
* @compile/fail BadTest4.java
*/
class BadTest4 {
interface I {}
interface J {}
static class C implements I, J {}
static class D implements I, J {}
interface Ord {}
static class Main {
static C c = new C();
static D d = new D();
static <B> List<B> nil() { return new List<B>(); }
static <A, B extends A> A f(A x, B y) { return x; }
static <A, B extends A> B g(List<A> x, List<B> y) { return y.head; }
static <A> List<A> cons(A x, List<A> xs) { return xs.prepend(x); }
static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); }
static <A> A id(A x) { return x; }
static Integer i = new Integer(1);
static Number n = i;
public static void main(String[] args) {
Number x = f(n, i);
x = f(i, n);
f(cons("abc", nil()), nil());
f(nil(), cons("abc", nil()));
}
}
}
| 2,088 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Test3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/odersky/Test3.java | /*
* Copyright (c) 2002, 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
* @summary Positive regression test from odersky
* @author odersky
*
* @compile Test3.java
*/
class Test3 {
interface I {}
interface J {}
static class C implements I, J {}
static class D implements I, J {}
interface Ord {}
static C c = new C();
static D d = new D();
static <B extends Ord> List<B> nil() { return new List<B>(); }
static <B extends I & J> B f(B x) { return x; }
static <A> List<A> cons(A x, List<A> xs) { return xs.prepend(x); }
static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); }
static <A> A id(A x) { return x; }
public static void main(String[] args) {
I i = f(c);
J j = f(d);
f(c);
f(d);
}
}
| 1,794 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Test.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/odersky/Test.java | /*
* Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4736963
* @summary Positive regression test from odersky
* @author odersky
*
* @compile Test.java
*/
class Test {
static <B> List<B> nil() { return new List<B>(); }
static <A> List<A> cons(A x, List<A> xs) { return xs.prepend(x); }
static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); }
static <A> A id(A x) { return x; }
public static void main(String[] args) {
List<String> xs = nil();
List<String> ys = cons("abc", Test.<String>nil());
List<String> zs = Test.<String>nil().prepend("abc");
System.out.println(nil());
System.out.println(nil().length());
System.out.println(cons("abc", nil()));
System.out.println(nil().prepend("abc"));
System.out.println(nil().prepend(makeCell(null)));
System.out.println(cons(makeCell(null), nil()));
System.out.println(id(nil()));
System.out.println(id(nil()).length());
System.out.println(cons("abc", id(nil())));
System.out.println(id(nil()).prepend("abc"));
System.out.println(id(nil()).prepend(makeCell(null)));
System.out.println(cons(makeCell(null), id(nil())));
List<String> a =
args.length == 1 ? Test.<String>nil() : Test.<String>nil();
a = (List<String>) Test.<String>nil();
}
}
| 2,396 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BadTest2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/odersky/BadTest2.java | /*
* Copyright (c) 2002, 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
* @summary Regression test from odersky
* @author odersky
*
* @compile BadTest2.java
*/
// this used to be a negative regression test, but when we
// added variance it started passing, undoubtedly due to
// bug fixes. The code looks OK.
class BadTest2 {
interface I {}
interface J {}
static class C implements I, J {}
static class D implements I, J {}
static class Main {
static C c = new C();
static D d = new D();
static <A> boolean equals(A x, A y) { return x.equals(y); }
public static void main(String[] args) {
equals(c, d); // infer A=I&J
}
}
}
| 1,721 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Test2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/odersky/Test2.java | /*
* Copyright (c) 2002, 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
* @summary Positive regression test from odersky
* @author odersky
*
* @compile Test2.java
*/
class Test2 {
interface Ord {}
static <B extends Ord> List<B> nil() { return new List<B>(); }
static <A> List<A> cons(A x, List<A> xs) { return xs.prepend(x); }
static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); }
static <A> A id(A x) { return x; }
public static void main(String[] args) {
List<Ord> xs = nil();
List<Ord> zs = nil().prependList(nil());
System.out.println(nil());
System.out.println(nil().length());
List<Ord> a = args.length == 1 ? nil() : nil();
a = (List<Ord>) nil();
}
}
| 1,754 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6835428.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/T6835428.java | /*
* Copyright (c) 2009, 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 6835428
* @author mcimadamore
* @summary regression: return-type inference rejects valid code
* @compile T6835428.java
*/
class T6835428<T> {
interface X<T> {}
<T extends Comparable<? super T>> T6835428<X<T>> m() { return null; }
<T extends Comparable<? super T>> void test() {
T6835428<X<T>> t = m();
}
}
| 1,403 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7015715.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/T7015715.java | /*
* Copyright (c) 2011, 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 7015715
*
* @summary lub gets stuck on type with complex supertype
* @author Neal Gafter
* @compile T7015715.java
*
*/
class T7015715 {
interface I<T> {}
interface A<T> extends I<A<A<T>>>{}
static abstract class X {
abstract <T> T foo(T x, T y);
void bar(A<Integer> x, A<String> y){
foo(x, y);
}
}
}
| 1,430 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6278587Neg.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6278587/T6278587Neg.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6278587
* @summary Inference broken for subtypes of subtypes of F-bounded types
* @author Peter von der Ah\u00e9
* @compile/fail T6278587Neg.java
*/
public abstract class T6278587Neg {
interface A<T extends A<T>> {}
interface B extends A<B> {}
interface C extends B {}
interface D<T> {}
abstract <T extends A<T>, S extends T> D<T> m(S s);
{
C c = null;
m(c);
}
}
| 1,489 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6278587.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6278587/T6278587.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6278587
* @summary Inference broken for subtypes of subtypes of F-bounded types
* @author Peter von der Ah\u00e9
* @compile T6278587.java
*/
public abstract class T6278587 {
interface A<T extends A<T>> {}
interface B extends A<B> {}
interface C extends B {}
interface D<T> {}
abstract <T extends A<T>, S extends T> D<T> m(S s);
{
C c = null;
D<B> d = null;
d = m(c);
d = this.<B,C>m(c);
this.<B,C>m(c);
}
}
| 1,557 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759c.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759c.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759c.java
*/
import java.util.Collection;
import java.util.Collections;
public class T6650759c {
static interface A {}
static interface B<X extends A> {}
static interface C<X extends A, Y extends B<X>> {}
public static <T extends A, U extends B<T>> Collection<C<T,U>> get(U u) {
return null;
}
public <T extends A, U extends B<T>> Collection<C<T,U>> test(U u) {
return Collections.unmodifiableCollection(get(u));
}
}
| 1,642 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759b.java | /*
* Copyright (c) 2009, 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 6650759
* @author mcimadamore
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759b.java
*/
public class T6650759b {
interface A<X extends A<X, Y>, Y extends B<X>> {}
static class B<X extends A<X, ?>> {}
interface C<X extends A<X, Y>, Y extends B<X>> {}
interface D<X extends A<X, Y>, Y extends B<X>> {}
static class E<X extends A<X, Y>, Y extends B<X>, W extends C<X, Y>> implements D<X, Y> {
static <X extends A<X, Y>, Y extends B<X>, W extends C<X, Y>> D<X, Y> of(W w) {
return null;
}
}
<X extends A<X, Y>, Y extends B<X>, W extends C<X, Y>, Z extends D<X, Y>> Z test(W w) {
return (Z) E.of(w);
}
}
| 1,820 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759a.java | /*
* Copyright (c) 2009, 2010, 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 6650759
* @author mcimadamore
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759a.java
*/
class T6650759a {
public static interface Interface<T> { }
public static class IntegerInterface implements Interface<Integer> { }
<I extends Interface<T>, T> T getGenericValue(I test) { return null; }
void testSet(Integer test) { }
void test() {
Integer test = getGenericValue(new IntegerInterface());
testSet(getGenericValue(new IntegerInterface()));
}
}
| 1,640 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759d.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759d.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759d.java
*/
public class T6650759d {
static abstract class A<X> {
static <T> A<T> m(Iterable<? extends T> elements) {
return null;
}
}
static abstract class B {}
static abstract class C<X extends B> {}
<U extends C<V>, V extends B> Iterable<V> get(U u) {
return null;
}
<U extends C<V>, V extends B> void m(U u) {
A<V> a = A.m(get(u));
}
}
| 1,620 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759e.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759e.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759e.java
*/
import java.util.List;
public class T6650759e {
static abstract class A<X extends B> {}
interface B<X extends A> extends D {}
static abstract class C<X extends D> {}
interface D {}
static abstract class E<X extends C<? extends B<?>>> {}
<U extends C<V>, V extends B<W>, W extends A<V>> W m1(E<U> e) {
return m2(e);
}
<U extends C<V>, V extends B<W>, W extends A<V>> W m2(E<U> e) {
return null;
}
}
| 1,668 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759i.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759i.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759i.java
*/
public class T6650759i {
static class A<X extends A, Y extends B> {}
static class B<X extends B> {}
static class C<X extends A<X, Y>, Y extends B<Y>> {}
static <U extends A<U, V>, V extends B<V>> Class<U> m1(U x) {
return null;
}
static <U extends A<U, V>, V extends B<V>> U m2(Class<U> c) {
return null;
}
static <W, U extends A<U, V>, V extends B<V>> W m3(Class<W> c1, C<U, V> c2) {
return null;
}
static <U extends A<U, V>, V extends B<V>> void test(U u, C<U, V> c) {
m2(m1(u));
U res = m3(m1(u), c);
}
}
| 1,808 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759j.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759j.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759j.java
*/
public class T6650759j {
static abstract class A<X extends A<X>> {}
static abstract class B<X extends B<X, Y>, Y> extends A<X> {}
static abstract class C<X extends C<X, Y>, Y> extends B<X, Y> {}
interface D {}
static class E extends C<E, D> {}
static abstract class F<X extends F<X, Y>, Y extends A<Y>> extends A<X> {}
static class G extends F<G, E> {}
static <X extends F<X, Y>, Y extends A<Y>> X m(Iterable<X> it) {
return null;
}
static G test(Iterable<G> c) {
return m(c);
}
}
| 1,760 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759f.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759f.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759f.java
*/
import java.util.Collections;
public class T6650759f {
interface A<X extends A> {}
static abstract class B<X extends B> implements A<X> {}
static abstract class C<X extends D> extends B<X> {}
static class D extends C<D> {}
<X extends B, Y extends B<X>> Iterable<X> m(Y node) {
return null;
}
public void test(D d) {
Iterable<D> ops = (true) ? Collections.singletonList(d) : m(d);
}
}
| 1,649 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759h.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759h.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759h.java
*/
class T6650759h<X, Y> {
<A> Object m(A a, T6650759h<?, ? super A> t) {
return null;
}
void test(T6650759h<?, Void> t) {
m(null, t);
}
}
| 1,379 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759m.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759m.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile/fail/ref=T6650759m.out T6650759m.java -XDrawDiagnostics
*/
import java.util.*;
class T6650759m {
<Z> List<? super Z> m(List<? extends List<? super Z>> ls) {
return ls.get(0);
}
void test() {
ArrayList<ArrayList<Integer>> lli = new ArrayList<ArrayList<Integer>>();
ArrayList<Integer> li = new ArrayList<Integer>();
li.add(2);
lli.add(li);
List<? super String> ls = m(lli); //here
ls.add("crash");
Integer i = li.get(1);
}
}
| 1,697 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759l.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759l.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759l.java
*/
public class T6650759l {
public static interface A<X> {}
public static class B implements A<Integer> {}
public static <X extends A<Y>, Y> Y m1(X x) {
return null;
}
public static void m2(Integer i) {}
public static void test(B b) {
m2(m1(b));
}
}
| 1,506 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759k.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759k.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759k.java
*/
public class T6650759k {
static class A<X extends A> {}
static class B<X extends B, Y extends A> {}
<U extends A<U>, V extends B<V, U>> Object m(Class<V> c) {
return null;
}
<U extends A<U>, V extends B<V, U>> void test(Class<V> c) {
m(c);
}
}
| 1,498 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6650759g.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6650759/T6650759g.java | /*
* Copyright (c) 2009, 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 6650759
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
* @compile T6650759g.java
*/
public class T6650759g {
static abstract class A<X extends A<X>> {}
static abstract class B<X extends A<X>> {}
interface C<X, Y> {}
static abstract class D<X extends A<X>, Y extends B<X>> implements C<X, Y> {}
static class E extends A<E> {}
static class F extends B<E> {}
static void test(Iterable<E> data) {
m3(m2(data, m1(F.class)));
}
static <X extends A<X>, Y extends B<X>> D<X, Y> m1(Class<Y> c) {
return null;
}
static <U, V> Iterable<V> m2(Iterable<U> x1, C<? super U, ? extends V> x2) {
return null;
}
static void m3(Iterable<F> data) {
}
}
| 1,849 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
NewTest.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6365166/NewTest.java | /*
* Copyright (c) 2005, 2007, 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 6365166
* @summary javac (generic) unable to resolve methods
* @compile NewTest.java
*/
import java.util.*;
public class NewTest<A,B> {
private List<A> toAdd;
public NewTest(List<A> toAdd) {
this.toAdd = toAdd;
}
private List<A> getRelated(B b) {
//some application logic
//for demo
return toAdd;
}
@SuppressWarnings("unchecked")
public <L extends List<? super A>,LF extends Factory<L>> L addOrCreate4(B b,L l,LF lf) {
if (l == null) {
l = lf.create();
}
((List<? super A>)l).addAll(getRelated(b)); //to get round the compiler bug
return l;
}
public static class ListFactory<T> implements Factory<List<T>>{
public List<T> create() {
return new ArrayList<T>();
}
}
public static interface Factory<T> {
public T create();
}
public static void main(String ... args) {
ListFactory<Number> lf = new ListFactory<Number>();
List<Long> longs = new ArrayList<Long>();
longs.add(new Long(1));
NewTest<Long,Number> test = new NewTest<Long,Number>(longs);
List<Number> ret4 = null;
ret4 = test.addOrCreate4(1, ret4,lf);
}
}
| 2,325 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4942040.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/4942040/T4942040.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4942040
* @summary improper handling of lub type for arrays, classes
* @compile T4942040.java
*/
public class T4942040 {
static <T> T f(T a, T b) {
return a;
}
static Cloneable main(Cloneable a, float[] b) {
return f(a, b);
}
}
| 1,346 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7086586.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/7086586/T7086586.java | /**
* @test /nodynamiccopyright/
* @bug 7086586
* @summary Inference producing null type argument
* @compile/fail/ref=T7086586.out -XDrawDiagnostics T7086586.java
*/
import java.util.List;
class T7086586 {
<T> List<T> m(List<? super T> dummy) { return null; }
void test(List<?> l) {
String s = m(l).get(0);
Number n = m(l).get(0);
Exception e = m(l).get(0);
m(l).nonExistentMethod();
}
}
| 440 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4941882.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/4941882/T4941882.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4941882
* @summary incorrect inference for result of lub(int[], float[])
* @compile/fail T4941882.java
*/
public class T4941882 {
static <T> T f(T a, T b) {
return a;
}
static Object[] main(int[] a, float[] b) {
return f(a, b);
}
}
| 1,350 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6569789.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6569789/T6569789.java | /*
* Copyright (c) 2008, 2010, 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 6569789
* @summary Compiler test lang/TYPE/type153/type15304/type15304.html fails since jdk7 b05
* @compile T6569789.java
*/
class C {}
interface I {}
interface I1 {}
interface I2 {}
class CT extends C implements I, I1, I2 {}
public class T6569789 {
public static void m() {
CT ct = new CT();
testMethod(ct);
}
static <W extends C & I & I1 & I2, T extends W> void testMethod(T t) {}
}
| 1,501 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5042462.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5042462/T5042462.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5042462
* @summary Problem with least upper bound (lub) and type variables
* @compile T5042462.java
*/
public class T5042462 {
<T, U extends T, V extends T> T cond1(boolean z, U x1, V x2) {
T t = z? x1: x2;
return z? x1: x2;
}
}
| 1,333 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4972073b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/4972073/T4972073b.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4972073
* @summary same interface allowed twice in compound type
* @compile/fail T4972073b.java
*/
public class T4972073b {
static class D {}
static interface MyInterface<E> {
public String foo();
}
static class MyClass {}
static class B<E extends MyClass & MyInterface<E> & MyInterface<E>> extends D {}
}
| 1,419 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4972073.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/4972073/T4972073.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4972073
* @summary same interface allowed twice in compound type
* @compile/fail T4972073.java
*/
public class T4972073 {
static class D {}
static interface MyInterface<E> {
public String foo();
}
static class MyClass {}
static class Sun1 extends MyClass implements MyInterface<Sun1>, MyInterface<Sun1> {
public String foo() {
return "test";
}
}
static class B<E extends MyClass & MyInterface<E> & MyInterface<E>> extends D {}
public static void main(String[] args) {
B b = new B<Sun1>();
}
}
| 1,660 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4972073a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/4972073/T4972073a.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4972073
* @summary same interface allowed twice in compound type
* @compile/fail T4972073a.java
*/
public class T4972073a {
static class D {}
static interface MyInterface<E> {
public String foo();
}
static class MyClass {}
static class Sun1 extends MyClass implements MyInterface<Sun1>, MyInterface<Sun1> {
public String foo() {
return "test";
}
}
}
| 1,494 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
X.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6302954/X.java | /*
* Copyright (c) 2005, 2007, 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 6302954
* @summary Inference fails for type variable return constraint
* @compile X.java
*/
public class X {
<T extends X> T f1() throws Exception { return null; }
<U extends X> U f2() throws Exception { return f1(); }
}
| 1,316 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6476073.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6302954/T6476073.java | /*
* Copyright (c) 2006, 2009, 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 6476073
* @summary Capture using super wildcard of type variables doesn't work
* @compile T6476073.java
*/
import java.util.Collection;
import java.util.List;
public class T6476073 {
public static <B> void m(List<? super B> list,Collection<? super B> coll) {
m(list,coll);
}
}
| 1,380 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6456971.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6302954/T6456971.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6456971
* @summary Varargs and inference problem
* @author Peter von der Ah\u00e9
* @compile T6456971.java
*/
import java.util.List;
public class T6456971 {
static <T> T[] makeArray(T... args) {
return args;
}
public static <S> void test() {
S[] stringLists = makeArray(null, null);
}
}
| 1,411 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6365166.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6356673/T6365166.java | /*
* Copyright (c) 2008, 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 6365166
* @summary javac (generic) unable to resolve methods
* @author Maurizio Cimadamore
*
* @compile T6365166.java
*/
import java.util.*;
public class T6365166 {
static <A> void add(List<? super A> l, List<A> la) {
l.addAll(la); //doesn't compile - but it should
}
}
| 1,371 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Test.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6356673/Test.java | /*
* Copyright (c) 2005, 2007, 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 6356673
* @summary javac incorrectly generates "reference to <xx> is ambiguous"
* @compile Test.java
*/
import java.util.Collections;
import java.util.List;
public class Test<A,B> {
private List<A> getRelated(B b) {
return Collections.emptyList();
}
public <L extends List<? super A>> L addOrCreate(B b,L l) {
l.addAll(getRelated(b));
return l;
}
}
| 1,480 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6240565.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6240565/T6240565.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6240565
* @summary Unboxing, arrays, and type variables doesn't work
* @compile T6240565.java
* @run main/othervm -Xfuture T6240565
*/
public class T6240565 {
public static <E extends Integer> void doit(E[] a) {
System.out.println(a[0] / 4);
for (int i : a)
System.out.println(i / 4);
for (E e : a) {
E f = e;
System.out.println(e / 4);
}
}
public static void main(String[] args) {
T6240565.doit(new Integer[]{4 , 8 , 12});
}
}
| 1,607 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6611449.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6611449/T6611449.java | /**
* @test /nodynamiccopyright/
* @bug 6611449
* @summary Internal Error thrown during generic method/constructor invocation
* @compile/fail/ref=T6611449.out -XDrawDiagnostics T6611449.java
*/
public class T6611449<S> {
<T extends S> T6611449(T t1) {}
<T extends S> T6611449(T t1, T t2) {}
<T extends S> void m1(T t1) {}
<T extends S> void m2(T t1, T t2) {}
void test() {
new T6611449<S>(1);
new T6611449<S>(1, 1); //internal error: lub is erroneously applied to primitive types
m1(1);
m2(1, 1); //internal error: lub is erroneously applied to primitive types
}
}
| 631 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6995200.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6995200/T6995200.java | /*
* Copyright (c) 2010, 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 6995200
*
* @summary JDK 7 compiler crashes when type-variable is inferred from expected primitive type
* @author mcimadamore
* @compile T6995200.java
*
*/
import java.util.List;
class T6995200 {
static <T> T getValue() {
return null;
}
<X> void test() {
byte v1 = getValue();
short v2 = getValue();
int v3 = getValue();
long v4 = getValue();
float v5 = getValue();
double v6 = getValue();
String v7 = getValue();
String[] v8 = getValue();
List<String> v9 = getValue();
List<String>[] v10 = getValue();
List<? extends String> v11 = getValue();
List<? extends String>[] v12 = getValue();
List<? super String> v13 = getValue();
List<? super String>[] v14 = getValue();
List<?> v15 = getValue();
List<?>[] v16 = getValue();
X v17 = getValue();
X[] v18 = getValue();
List<X> v19 = getValue();
List<X>[] v20 = getValue();
List<? extends X> v21 = getValue();
List<? extends X>[] v22 = getValue();
List<? super X> v23 = getValue();
List<? super X>[] v24 = getValue();
}
}
| 2,262 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4954546.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/4954546/T4954546.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4954546
* @summary unverifiable code for method called from ?: expression with inferred
*/
public class T4954546 {
interface I {
void f();
}
interface J {
void g();
}
static class A implements I, J {
public void f() {}
public void g() {}
}
static class B implements J, I {
public void f() {}
public void g() {}
}
public static void main(String[] args) {
f(true, new A(), new B());
}
static void f(boolean cond, A a, B b) {
(cond?a:b).f();;
(cond?a:b).g();;
}
}
| 1,666 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5049523.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5049523/T5049523.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5049523
* @summary Inference should compute glb of type arguments
* @compile T5049523.java
*/
abstract public class T5049523 {
abstract <T> T choose(boolean b, T t1, T t2);
abstract <T> Class<? extends T> m(Class<T> c);
<T> void test(Class<? extends T> clazz) {
boolean b = clazz.isInterface();
Class<? extends T> c1 = b ? m(clazz) : clazz;
Class<? extends T> c2 = choose(b, m(clazz), clazz);
}
}
| 1,524 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6943278.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6943278/T6943278.java | /**
* @test /nodynamiccopyright/
* @bug 6943278
* @summary spurious error message for inference and type-variable with erroneous bound
* @compile/fail/ref=T6943278.out -XDrawDiagnostics -Xlint:unchecked T6943278.java
*/
class T6943278<X extends Number & NonExistentInterface> {
<X> T6943278<X> m() { return null;}
<X extends Number & NonExistentInterface> T6943278<X> m(X x) { return null;}
T6943278<?> f1 = m();
T6943278<?> f2 = m("");
}
| 460 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7086601b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/7086601/T7086601b.java | /*
* Copyright (c) 2011, 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 7086601
* @summary Error message bug: cause for method mismatch is 'null'
*/
import com.sun.source.util.JavacTask;
import java.net.URI;
import java.util.Arrays;
import java.util.ArrayList;
import javax.tools.Diagnostic;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
public class T7086601b {
static int checkCount = 0;
enum TypeKind {
STRING("String", false),
INTEGER("Integer", false),
NUMBER("Number", false),
SERIALIZABLE("java.io.Serializable", true),
CLONEABLE("Cloneable", true),
X("X", false),
Y("Y", false),
Z("Z", false);
String typeStr;
boolean isInterface;
private TypeKind(String typeStr, boolean isInterface) {
this.typeStr = typeStr;
this.isInterface = isInterface;
}
boolean isSubtypeof(TypeKind other) {
return (this == INTEGER && other == NUMBER ||
this == Z && other == Y ||
this == other);
}
}
enum MethodCallKind {
ARITY_ONE("m(a1);", 1),
ARITY_TWO("m(a1, a2);", 2),
ARITY_THREE("m(a1, a2, a3);", 3);
String invokeString;
int arity;
private MethodCallKind(String invokeString, int arity) {
this.invokeString = invokeString;
this.arity = arity;
}
}
public static void main(String... args) throws Exception {
//create default shared JavaCompiler - reused across multiple compilations
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
for (TypeKind a1 : TypeKind.values()) {
for (TypeKind a2 : TypeKind.values()) {
for (TypeKind a3 : TypeKind.values()) {
for (MethodCallKind mck : MethodCallKind.values()) {
new T7086601b(a1, a2, a3, mck).run(comp, fm);
}
}
}
}
System.out.println("Total check executed: " + checkCount);
}
TypeKind a1;
TypeKind a2;
TypeKind a3;
MethodCallKind mck;
JavaSource source;
DiagnosticChecker diagChecker;
T7086601b(TypeKind a1, TypeKind a2, TypeKind a3, MethodCallKind mck) {
this.a1 = a1;
this.a2 = a2;
this.a3 = a3;
this.mck = mck;
this.source = new JavaSource();
this.diagChecker = new DiagnosticChecker();
}
class JavaSource extends SimpleJavaFileObject {
final String bodyTemplate = "import java.util.List;\n"+
"class Test {\n" +
" <Z> void m(List<? super Z> l1) { }\n" +
" <Z> void m(List<? super Z> l1, List<? super Z> l2) { }\n" +
" <Z> void m(List<? super Z> l1, List<? super Z> l2, List<? super Z> l3) { }\n" +
" <X,Y,Z extends Y> void test(List<#A1> a1, List<#A2> a2, List<#A3> a3) { #MC } }";
String source;
public JavaSource() {
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
source = bodyTemplate.replace("#A1", a1.typeStr)
.replace("#A2", a2.typeStr).replace("#A3", a3.typeStr)
.replace("#MC", mck.invokeString);
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
return source;
}
}
void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
null, null, Arrays.asList(source));
try {
ct.analyze();
} catch (Throwable ex) {
throw new AssertionError("Error thron when compiling the following code:\n" + source.getCharContent(true));
}
check();
}
void check() {
checkCount++;
boolean errorExpected = false;
if (mck.arity > 1) {
TypeKind[] argtypes = { a1, a2, a3 };
ArrayList<TypeKind> classes = new ArrayList<>();
for (int i = 0 ; i < mck.arity ; i ++ ) {
if (!argtypes[i].isInterface) {
classes.add(argtypes[i]);
}
}
boolean glb_exists = true;
for (TypeKind arg_i : classes) {
glb_exists = true;
for (TypeKind arg_j : classes) {
if (!arg_i.isSubtypeof(arg_j)) {
glb_exists = false;
break;
}
}
if (glb_exists) break;
}
errorExpected = !glb_exists;
}
if (errorExpected != diagChecker.errorFound) {
throw new Error("invalid diagnostics for source:\n" +
source.getCharContent(true) +
"\nFound error: " + diagChecker.errorFound +
"\nExpected error: " + errorExpected);
}
}
static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
boolean errorFound;
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
errorFound = true;
}
}
}
}
| 6,674 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7086601a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/7086601/T7086601a.java | /**
* @test /nodynamiccopyright/
* @bug 7086601
* @summary Error message bug: cause for method mismatch is 'null'
* @compile/fail/ref=T7086601a.out -XDrawDiagnostics T7086601a.java
*/
class T7086601 {
static <S> void m1(Iterable<? super S> s1, Iterable<? super S> s2) { }
static void m1(Object o) {}
static <S> void m2(Iterable<? super S> s1, Iterable<? super S> s2, Iterable<? super S> s3) { }
static void m2(Object o) {}
@SafeVarargs
static <S> void m3(Iterable<? super S>... ss) { }
static void m3(Object o) {}
static void test1(Iterable<String> is, Iterable<Integer> ii) {
m1(is, ii);
}
static void test2(Iterable<String> is, Iterable<Integer> ii, Iterable<Double> id) {
m2(is, ii, id);
}
static void test3(Iterable<String> is, Iterable<Integer> ii) {
m3(is, ii);
}
static void test4(Iterable<String> is, Iterable<Integer> ii, Iterable<Double> id) {
m3(is, ii, id);
}
}
| 978 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6273455.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6273455/T6273455.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6273455
* @summary Stack overflow in Types.java:347
* @compile T6273455.java
*/
import java.util.*;
public class T6273455<T extends Comparable<? super T>> {
abstract class Group<E extends Comparable<? super E>>
extends ArrayList<E>
implements Comparable<Group<? extends E>> {}
abstract class Sequence<E extends Comparable<? super E>>
extends TreeSet<E>
implements Comparable<Sequence<? extends E>> {}
public void containsCombination(SortedSet<Group<T>> groups,
SortedSet<Sequence<T>> sequences) {
foo(groups, sequences);
}
<C extends Collection<T>> void foo(SortedSet<? extends C> setToCheck,
SortedSet<? extends C> validSet) {}
}
| 1,858 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5034571.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5034571/T5034571.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5034571
* @summary Wildcard capture must use the bounds of the formal
* @compile T5034571.java
*/
public class T5034571 {
interface I1 {
void i1();
}
class G1<T extends I1> {
T get() { return null; }
}
interface I2 {
void i2();
}
class Main {
void f1(G1<?> g1) {
g1.get().i1();
}
void f2(G1<? extends I2> g1) {
g1.get().i1();
g1.get().i2();
}
}
}
| 1,560 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6468384.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6468384/T6468384.java | /*
* Copyright (c) 2006, 2007, 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 6468384 6278587
* @summary Problem with underconstrained type variables
* @compile T6468384.java
*/
import java.util.*;
public class T6468384 {
public class A {};
public class B extends A {};
public <T, V extends T> Set<T> newSet(V... objects) {
Set<T> set = new LinkedHashSet<T>();
for (T t : objects) {
set.add(t);
}
return set;
}
public static void main(String... args) {
T6468384 g = new T6468384();
// B << V => V :> B
// so B is inferred for V
// Then consider the return type:
// Set<A> >> Set<T> => A = T
// So A is inferred for T
Set<A> set1 = g.newSet(g.new B());
Set<A> set2 = g.<A,B>newSet(g.new B());
}
}
| 1,845 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6359106.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6359106/T6359106.java | /*
* Copyright (c) 2005, 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 6359106
* @summary Valid generics code does not compile
* @author Peter von der Ah\u00e9
* @compile Orig.java T6359106.java
*/
import java.util.Collection;
public class T6359106 {
interface Request<R extends Request<R, V>,V> {}
interface DeltaRequest extends Request<DeltaRequest, T6359106> {}
interface RequestMap<V> {
<R extends Request<R, W>, W extends V> R test (Collection<R> c);
}
public void f () {
RequestMap<Object> m = null;
Collection<DeltaRequest> c = null;
DeltaRequest o = m.<DeltaRequest, T6359106>test(c);
}
}
| 1,669 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Orig.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6359106/Orig.java | /*
* Copyright (c) 2005, 2007, 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.
*/
package tests;
import java.util.Collection;
import java.util.Collections;
class CompileTest2 {
class Request<R extends Request<R, V>,V> {}
class DeltaRequest extends Request<DeltaRequest, double[]> {}
class RequestMap<V> {
public <R extends Request<R, W>, W extends V> R test (Collection<R> c) {
// In my real code I make use of W of course
return null;
}
}
public void f () {
RequestMap<Object> m = new RequestMap<Object> ();
Collection<DeltaRequest> c = Collections.singleton (new DeltaRequest ());
// This line not compile?
DeltaRequest o = m.<DeltaRequest, double[]>test (c);
}
}
| 1,841 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6222762.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6222762/T6222762.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6222762
* @summary Primitive arrays and varargs inference leads to crash in TreeMaker.Type(TreeMaker.java:531)
*/
import java.util.Arrays;
public class T6222762 {
static <T> void varargs(T... args) {
for(T t : args)
System.out.println(Arrays.toString((int[])t));
}
public static void main(String[] args) {
varargs(new int[]{1, 2, 3}, new int[]{4, 5, 6});
}
}
| 1,489 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5081782/Neg.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5081782
* @summary type arguments to non-generic methods
* @author Peter von der Ah\u00e9
* @compile/fail Neg.java
*/
public class Neg {
static void m() {}
public static void main(String... args) {
Neg.<Can,I,write,a,little,story,here>m();
}
}
| 1,346 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Pos.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5081782/Pos.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5081782
* @summary type arguments to non-generic methods
* @author Peter von der Ah\u00e9
* @compile Pos.java
*/
public class Pos {
public static <T> void foo() {
System.out.println("foo");
}
public static void bar() {
System.out.println("foo");
}
public static void main(String[] args) {
Pos.<Object>foo();
Pos.<Object>bar();
}
}
| 1,469 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6315770.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6315770/T6315770.java | /**
* @test /nodynamiccopyright/
* @bug 6315770
* @summary javac inference allows creation of strange types: Integer & Runnable
* @author Maurizio Cimadamore
*
* @compile/fail/ref=T6315770.out T6315770.java -XDrawDiagnostics
*/
class T6315770<V> {
<T extends Integer & Runnable> T6315770<T> m() {
return null;
}
void test() {
T6315770<?> c1 = m();
T6315770<? extends String> c2 = m();
T6315770<? super String> c3 = m();
}
}
| 484 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5044646.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5044646/T5044646.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5044646
* @summary package-private indirect noninherited generic overriders
* @compile p1/A1.java p2/A2.java p1/B.java
* @compile/fail p1/C.java
*/
| 1,228 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
A1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5044646/p1/A1.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p1;
public class A1<T> {
int f(T t) { return 0; }
}
| 1,117 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
C.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5044646/p1/C.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p1;
public class C extends B<String,String> {
// indirect overrider f(String) from A1
}
| 1,153 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
B.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5044646/p1/B.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p1;
public abstract class B<T,U> extends p2.A2<U> {
abstract int f(T t);
}
| 1,140 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
A2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5044646/p2/A2.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p2;
public class A2<T> extends p1.A1<T> {}
| 1,104 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
GenericsAndPackages.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5073060/GenericsAndPackages.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 5073060
* @summary Package private members not found for intersection types
* @author Bruce Eckel
* see http://www.artima.com/forums/flat.jsp?forum=106&thread=136204
* @compile GenericsAndPackages.java
*/
package code;
interface HasColor {
java.awt.Color getColor();
}
class Dimension {
int x, y, z;
}
class ColoredDimension<T extends Dimension & HasColor> {
T item;
ColoredDimension(T item) { this.item = item; }
T getItem() { return item; }
java.awt.Color f() { return item.getColor(); }
int getX() { return item.x; }
}
| 1,642 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5073060/Neg.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5073060
* @summary Package private members not found for intersection types
* @author Peter von der Ah\u00e9
* @compile/fail NegHelper.java Neg.java
*/
public class Neg<T extends test.NegHelper & Cloneable> {
void test(T t) { t.foo(); }
}
| 1,325 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
NegHelper.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5073060/NegHelper.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package test;
public class NegHelper {
void foo() {}
}
| 1,112 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5073060.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5073060/T5073060.java | /*
* Copyright (c) 2006, 2007, 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 5073060
* @summary Package private members not found for intersection types
* @compile T5073060.java
*/
public class T5073060 {
static String foo;
public static void main(String[] args) {
C2 c2 = null;
C3 c3 = null;
m1(c2, c3).c1m1();
m1(c2, c3).i1m1();
m1(c2, c3).i2m1();
}
public static <T> T m1(T t1, T t2) {
return null;
}
class C1 { void c1m1() {} }
interface I1 { void i1m1(); }
interface I2 { void i2m1(); }
class C2 extends C1 implements I1, I2 {
public void i1m1() { }
public void i2m1() { }
}
class C3 extends C1 implements I1, I2 {
public void i1m1() { }
public void i2m1() { }
}
}
| 1,813 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5073060a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5073060/T5073060a.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5073060
* @summary Package private members not found for intersection types
* @author Peter von der Ah\u00e9
*/
public class T5073060a {
static class C1 {
void c1m1() {
System.out.println("FISK");
}
}
static interface I {}
static class C2 extends C1 implements I {}
static class C3 extends C1 implements I {}
public <T> T m1(T t1, T t2) { return t1; }
public <T extends C1 & I> void test(C2 c2, C3 c3, T t) {
m1(c2, c3).c1m1(); // error
t.c1m1(); // error
(t != null ? c2 : c3).c1m1(); // error
}
public static void main(String... args) {
T5073060a t = new T5073060a();
t.test(new C2(), new C3(), new C2());
}
}
| 1,806 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5080917.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5080917/T5080917.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5080917
* @summary lub computes strange compound types
* @author Steve Sides
* @compile T5080917.java
*/
public class T5080917 {
static interface I { }
static class X { }
static class A extends X implements I { }
static class B extends X implements I { }
void test(A a, B b) {
X x = (a.hashCode() == b.hashCode()) ? a : b;
}
}
| 1,447 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6215213.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6215213/T6215213.java | /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6215213
* @summary Compiler JDK1.5 crashes with uses of generics
* @author Peter von der Ah\u00e9
* @compile T6215213.java
*/
public class T6215213 {
static class Box<T> {}
static class Box1<T extends T6215213> {}
static class Pair<T, S> {}
static class Pair1<T extends T6215213, S> {}
static class Triple<T, S, U> {}
static class Triple1<T extends T6215213, S, U extends T6215213> {}
static class Quad<T, S, U, V> {}
static class Quad1<T extends T6215213, S, U extends T6215213, V> {}
<T> Box<T> testBox(T t) { return null; }
<T extends T6215213> Box1<T> testBox1(T t) { return null; }
<T> Pair<T, T> testPair(T t) { return null; }
<T extends T6215213> Pair1<T, T> testPair1(T t) { return null; }
<T> Triple<T, T, T> testTriple(T t) { return null; }
<T extends T6215213> Triple1<T, T, T> testTriple1(T t) { return null; }
<T> Quad<T, T, T, T> testQuad(T t) { return null; }
<T extends T6215213> Quad1<T, T, T, T> testQuad1(T t) { return null; }
void testAll() {
Box<?> box = testBox(null);
Box1<?> box1 = testBox1(null);
Pair<?, ?> pair = testPair(null);
Pair1<?, ?> pair1 = testPair1(null);
Triple<?, ?, ?> triple = testTriple(null);
Triple1<?, ?, ?> triple1 = testTriple1(null);
Quad<?, ?, ?, ?> quad = testQuad(null);
Quad1<?, ?, ?, ?> quad1 = testQuad1(null);
}
}
| 2,495 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6838943.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6838943/T6838943.java | /**
* @test /nodynamiccopyright/
* @bug 6838943
* @summary inference: javac is not handling type-variable substitution properly
* @compile/fail/ref=T6838943.out -XDrawDiagnostics T6838943.java
*/
class T6838943 {
static class A<X> {}
static class B {}
static class C<X> {
<Z> void m(X x, Z z) {
C<A<Z>> c = new C<A<Z>>();
c.m(new A<B>(), new B()); //should fail
}
}
}
| 429 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6369605a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6369605/T6369605a.java | /*
* Copyright (c) 2010, 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 6369605
* @summary Unconstrained type variables fails to include bounds
* @author mcimadamore
* @compile T6369605a.java
*/
import java.util.List;
class T6369605a {
static <T extends List<T>> T m1() {
return null;
}
static <T extends List<U>, U extends List<T>> T m2() {
return null;
}
static <T extends List<U>, U extends List<V>, V extends List<T>> T m3() {
return null;
}
List<?> l1 = m1();
List<?> l2 = m2();
List<?> l3 = m3();
}
| 1,575 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6369605b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6369605/T6369605b.java | /*
* Copyright (c) 2010, 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 6369605
* @summary Unconstrained type variables fails to include bounds
* @author mcimadamore
* @compile T6369605b.java
*/
import java.util.List;
class T6369605b {
static <T extends List<X>, X> List<T> m1() {
return null;
}
static <T extends List<U>, U extends List<X>, X> List<T> m2() {
return null;
}
static <T extends List<U>, U extends List<V>, V extends List<X>, X> List<T> m3() {
return null;
}
List<?> l1 = m1();
List<?> l2 = m2();
List<?> l3 = m3();
}
| 1,601 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.