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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
T4711694.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/T4711694.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 4711694
* @summary generics: missing bridge method for inherited implementation
* @author gafter
*
* @compile T4711694.java
* @run main T4711694
*/
public class T4711694 {
interface A<T> {
void f(T u);
}
static class B {
public void f(Integer i) {}
}
static abstract class C<T> extends B implements A<T> {
public void g(T t) {
f(t);
}
}
static class D extends C<Integer> {
public static void main(String[] args) {
new D().g(new Integer(3));
}
}
public static void main(String[] args) {
D.main(args);
}
}
| 1,708 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
NameOrder.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/NameOrder.java | /*
* Copyright (c) 2003, 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 4851006
* @summary generics: type inference failure due to a bug in ClassSymbol.isLess
* @author gafter
*
* @compile NameOrder.java
*/
package NameOrder;
interface a {}
interface b {}
interface c {}
class AB implements a, b {}
class CA implements c, a {}
// this is how to trigger a symptom:
abstract class X {
<T> T f(T t1, T t2) { return null; }
void g() {
a x = f( new AB(), new CA() );
}
}
| 1,501 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
GenericAnonCtor.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/GenericAnonCtor.java | /*
* Copyright (c) 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 4985520
* @summary javac crash on parameterized anonymous constructor invocation
* @author gafter
*
* @compile GenericAnonCtor.java
* @run main GenericAnonCtor
*/
class A<T1> {
T1 obj1;
Object obj2;
<T2> A(T1 t1, T2 t2) {
obj1 = t1;
obj2 = t2;
}
public String toString() {
return (obj1 + " " + obj2).intern();
}
}
public class GenericAnonCtor {
public static void main(String[] args) {
A<Integer> a = new <String>A<Integer>(new Integer(11), "foo") {};
if (a.toString() != "11 foo") throw new Error();
}
}
| 1,658 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
UncheckedConstructor.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/UncheckedConstructor.java | /*
* Copyright (c) 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 4951260
* @summary compiler disallows raw call to generic constructor
* @author gafter
*
* @compile -Werror UncheckedConstructor.java
* @compile/fail -Werror -Xlint:unchecked UncheckedConstructor.java
*/
import java.util.*;
class G3 {
G3(Enumeration<Object> e) { }
static void g() {
new G3(new Enumeration() {
public boolean hasMoreElements() { return false; }
public Object nextElement() { return null; }
});
}
}
| 1,585 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Varargs.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/Varargs.java | /*
* Copyright (c) 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 4920438
* @summary varargs doesn't work for generic methods
* @author gafter
*
* @compile Varargs.java
*/
package varargs.versus.generics;
// bug: varargs does not work for generic methods
class T {
<T> void f(T t, Object... args) {}
void g(Object x, Object y, Object z) {
f(x, y, z);
}
}
| 1,389 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4739399.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/T4739399.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 4739399
* @summary generics: crash after error regarding bounds on type variable
* @author gafter
*
* @compile/fail T4739399.java
*/
class T4739399 {
class Crash1 {}
interface C1GenericInterface {}
interface C1B1<X> {}
class Crash1Test<X> {
public <M extends C1GenericInterface,N extends M & C1B1<X>> void meth( ) {}
}
}
| 1,431 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
InheritanceConflict.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/InheritanceConflict.java | /*
* Copyright (c) 2004, 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 4984158
* @summary two inherited methods with same signature
* @author gafter, Maurizio Cimadamore
*
* @compile/fail InheritanceConflict.java
*/
package inheritance.conflict;
class A<T> {
void f(String s) {}
}
class B<T> extends A<T> {
void f(T t) {}
}
class C extends B<String> {
}
| 1,379 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
ExtendedRaw4.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/ExtendedRaw4.java | /*
* Copyright (c) 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 5030027
* @summary REGRESSION: compatibility problem inheriting raw type
* @author gafter
*
* @compile ExtendedRaw4.java
*/
class ExtendedRaw4 extends java.util.TreeSet {}
| 1,251 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
WrongNew.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/WrongNew.java | /*
* Copyright (c) 2001, 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 4487977
* @summary generics: javac generares "new" of wrong class
* @author gafter
*
* @compile WrongNew.java
* @run main WrongNew
*/
class WrongNewList<T> {}
class WrongNewArrayList<T> extends WrongNewList<T> {}
public class WrongNew
{
public static void main(String[] ps)
{
WrongNewList<String> list = getList();
}
public static WrongNewList<String> getList()
{
return new WrongNewArrayList();
}
}
| 1,528 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Crash02.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/Crash02.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 4881292
* @summary compiler crash in class writer
* @author gafter
*
* @compile Crash02.java
*/
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
class Bug2<T> implements Iterable<T> {
private List<T> data;
public Bug2() {
data = new ArrayList<T>();
}
public Iterator<T> iterator() {
return data.iterator();
}
}
| 1,449 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
OverrideBridge.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/OverrideBridge.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 6337171 6996415
* @ignore fix has been disabled as a consequence of 6996415
* @summary javac should create bridge methods when type variable bounds restricted
* @run main OverrideBridge
*/
import java.io.*;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;
import javax.tools.ToolProvider;
import com.sun.source.util.JavacTask;
import com.sun.tools.classfile.ClassFile;
import com.sun.tools.classfile.ConstantPoolException;
import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
import com.sun.tools.classfile.Method;
public class OverrideBridge {
enum Implementation {
IMPLICIT(""),
EXPLICIT("@Override public abstract X m(X x);");
String impl;
Implementation(String impl) {
this.impl = impl;
}
}
static class JavaSource extends SimpleJavaFileObject {
final static String sourceStub =
"abstract class A<X> {\n" +
" public abstract X m(X x);\n" +
"}\n" +
"interface I<X> {\n" +
"X m(X x);\n" +
"}\n" +
"abstract class B<X extends B<X>> extends A<X> implements I<X> { #B }\n" +
"abstract class C<X extends C<X>> extends B<X> { #C }\n" +
"abstract class D<X extends D<X>> extends C<X> { #D }\n";
String source;
public JavaSource(Implementation implB, Implementation implC, Implementation implD) {
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
source = sourceStub.replace("#B", implB.impl).replace("#C", implC.impl).replace("#D", implD.impl);
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
return source;
}
}
public static void main(String... args) throws Exception {
Map<ClassFile, List<Method>> refMembers =
compile(Implementation.EXPLICIT, Implementation.EXPLICIT, Implementation.EXPLICIT, "ref");
int i = 0;
for (Implementation implB : Implementation.values()) {
for (Implementation implC : Implementation.values()) {
for (Implementation implD : Implementation.values()) {
Map<ClassFile, List<Method>> membersToCheck = compile(implB, implC, implD, "out_" + i++);
check(refMembers, membersToCheck);
}
}
}
}
static String workDir = System.getProperty("user.dir");
static Map<ClassFile, List<Method>> compile(Implementation implB, Implementation implC, Implementation implD, String destPath) throws Exception {
File destDir = new File(workDir, destPath); destDir.mkdir();
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
JavaSource source = new JavaSource(implB, implC, implD);
JavacTask ct = (JavacTask)tool.getTask(null, null, null,
Arrays.asList("-d", destPath), null, Arrays.asList(source));
ct.generate();
Map<ClassFile, List<Method>> members = new HashMap<>();
addMembers(destDir, members);
return members;
}
static void addMembers(File destDir, Map<ClassFile, List<Method>> members) {
String[] names = { "B.class", "C.class", "D.class" };
try {
for (String name : names) {
File f = new File(destDir, name);
ClassFile cf = ClassFile.read(f);
members.put(cf, readMethod(cf, "m"));
}
} catch (Exception e) {
e.printStackTrace();
throw new Error("error reading classes");
}
}
static List<Method> readMethod(ClassFile cf, String name) throws ConstantPoolException {
List<Method> buf = new ArrayList<>();
for (Method m : cf.methods) {
if (m.getName(cf.constant_pool).equals(name)) {
buf.add(m);
}
}
return buf;
}
static void check(Map<ClassFile, List<Method>> refMembers, Map<ClassFile, List<Method>> membersToCheck) throws ConstantPoolException, InvalidDescriptor {
for (Map.Entry<ClassFile, List<Method>> ref : refMembers.entrySet()) {
ClassFile cRef = ref.getKey();
for (Method mRef : ref.getValue()) {
boolean ok = false;
for (Map.Entry<ClassFile, List<Method>> toCheck : membersToCheck.entrySet()) {
ClassFile cToCheck = toCheck.getKey();
for (Method mToCheck : toCheck.getValue()) {
if (cRef.getName().equals(cToCheck.getName()) &&
mRef.descriptor.getReturnType(cRef.constant_pool).equals(
mToCheck.descriptor.getReturnType(cToCheck.constant_pool)) &&
mRef.descriptor.getParameterTypes(cRef.constant_pool).equals(
mToCheck.descriptor.getParameterTypes(cToCheck.constant_pool))) {
ok = true;
}
}
}
if (!ok) {
throw new AssertionError("Matching method descriptor for " + mRef.descriptor.getParameterTypes(cRef.constant_pool) + "not found");
}
}
}
}
}
| 6,689 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4684378.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/T4684378.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 4684378
* @summary generics: verify error in generated bytecode
* @author gafter
*
* @compile T4684378.java
* @run main T4684378
*/
import java.util.Stack;
public class T4684378 {
public static void main(String[] argv) {
Stack<String> bar = new Stack<String>();
String foo;
// Compiles, but causes verify error
foo=(bar.empty()?"":bar.peek()).intern();
// The following two work fine
foo = (bar.empty()?"":bar.peek().intern());
foo = (bar.empty()?"":(String)bar.peek()).intern();
}
}
| 1,630 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4695415.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/T4695415.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 4695415
* @summary generics: bug in type inference when method result used as an argument
* @author gafter
*
* @compile T4695415.java
*/
class X<T extends Number> {
static <T extends Number> X<T> f(X<T> a, X<T> b) {
return f(f(a, b), b);
}
}
| 1,337 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6481655.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/T6481655.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 6481655
* @summary Parser confused by combination of parens and explicit type args
* @author Maurizio Cimadamore
*/
public class T6481655 {
public static <T> T getT(T t) {
return t;
}
public static void main(String... s) {
T6481655.<String>getT("");
(T6481655.<String>getT("")).getClass();
}
}
| 1,416 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Casting5.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/Casting5.java | /*
* Copyright (c) 2004, 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 6559182
* @summary Cast from a raw type with non-generic supertype to a raw type fails unexpectedly
* @author Maurizio Cimadamore
*
* @compile Casting5.java
*/
class Casting5 {
static interface Super<P> {}
static class Y implements Super<Integer>{}
static interface X extends Super<Double>{}
static class S<L> extends Y {}
static interface T<L> extends X {}
public static void main(String... args) {
S s = null; // same if I use S<Byte>
T t = null; // same if I use T<Byte>
t = (T) s;
}
}
| 1,626 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CatchTyparam.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/CatchTyparam.java | /*
* Copyright (c) 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 5057445
* @summary javac allows catching type parameter
* @author gafter
*
* @compile/fail CatchTyparam.java
*/
class J {
<T extends Error, U extends Error> void foo() {
try {
int i = 12;
} catch (T ex) {
} catch (U ex) {
}
}
}
| 1,358 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastCrash.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/CastCrash.java | /*
* Copyright (c) 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 5025346
* @summary Crash on cast
* @author gafter
*
* @compile/fail CastCrash.java
*/
package cast.crash;
import java.util.*;
interface SN extends Set<Number>{}
interface LI extends List<Integer>{}
class CastCrash {
void f(LI l) {
SN sn = (SN) l;
}
}
| 1,349 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BridgeClash.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/BridgeClash.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 4825927
* @summary generics: incorrect erasure clash reported
* @author gafter
*
* @compile BridgeClash.java
*/
interface I<T> {
public int m(T t);
}
interface J<T> {
public int m(T t);
}
class A implements J<String>, I<String>{
public int m(String s){return 4321;}
}
| 1,359 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CyclicInheritance3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/CyclicInheritance3.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 4861743
* @summary generics: incorrect cyclic inheritance error with type parameters
*
* @compile CyclicInheritance3.java
*/
class Cycle {
class A<T> {}
class B extends A<C> {}
class C extends B {}
}
| 1,290 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
PermuteBound.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/PermuteBound.java | /*
* Copyright (c) 2002, 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 4698375
* @summary generics: subtyping problem when type parameters permuted
* @author gafter
*
* @compile PermuteBound.java
*/
package PermuteBound;
class C<X, Y> {}
class D<X, Y> extends C<X, Y>
{
void f(C<X, Y> c)
{
D<X, Y> d = (D<X, Y>) c;// OK because D extends C
}
void g(C<Y, X> c)// parameters X and Y are now permuted
{
D<Y, X> d = (D<Y, X>) c;// should also be OK but is not !?
// ^
// inconvertible types
// found : C<Y,X>
// required : D<Y,X>
}
/*
void gWorkAround(C<Y, X> c)// but generates unchecked warning
{
D<Y, X> d = (D) ((C) c);
}
*/
}
| 1,766 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
RawClient.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/RawClient.java | /*
* Copyright (c) 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 5011073
* @summary javac should implement JLS3 three-pass overload resolution
* @author gafter
*
* @compile RawClient.java
*/
package rawClient;
import java.util.*;
// vendor's library - generified
class Vend {
static void cs(Collection<String> cs) {}
}
// client code - not generified
class Main {
void f(Collection c) {
Vend.cs(Collections.unmodifiableCollection(c));
}
}
| 1,476 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4757416.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/T4757416.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 4756416
* @summary generics: erasure clash not detected
* @author gafter
*
* @compile/fail T4757416.java
*/
class T4756416 {
static class C<A> { A id ( A x) { return x; } }
interface I<A> { A id(A x); }
static class D extends C<String> implements I<Integer> {
public String id(String x) { return x; }
public Integer id(Integer x) { return x; }
}
}
| 1,459 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Covar3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/Covar3.java | /*
* Copyright (c) 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 4907941
* @summary missing ambiguity error
* @author gafter
*
* @compile/fail Covar3.java
*/
package covar3;
interface Test3<T> {
void f( T f);
void f(String f);
}
class T {
void f(Test3<String> x) {
x.f("");
}
}
| 1,322 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
GenLit2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/GenLit2.java | /*
* Copyright (c) 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 4942201
* @summary java allows class literal on generic type parameter array
* @author gafter
*
* @compile/fail GenLit2.java
*/
package genLit2;
class U<T> {
Class t = T[].class;
}
| 1,265 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
TyparamStaticScope.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/TyparamStaticScope.java | /*
* Copyright (c) 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 4994261
* @summary javac mistakenly reports static use error for enclosing type parameter
* @author gafter
*
* @compile TyparamStaticScope.java
*/
package typaram.static_.scope;
import java.util.Set;
class JBug<T> {
abstract class Inner1 implements Set<T> { }
static class Inner2<U> {
class Inner3 { U z; }
abstract class Inner4 implements Set<U> { }
}
}
| 1,465 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
GetClass2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/GetClass2.java | /*
* Copyright (c) 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 4982096 5004321
* @summary the type of x.getClass() is Class<? extends |X|>
* @author seligman
*
* @compile GetClass2.java
* @run main GetClass2
*/
public class GetClass2 {
public static void main(String[] args) {
Class<? extends Class> x = GetClass2.class.getClass();
}
}
| 1,369 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
MultipleInheritance.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/MultipleInheritance.java | /*
* Copyright (c) 2001, 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 4480813
* @summary generics problem with multiple interface extension
* @author gafter
*
* @compile MultipleInheritance.java
*/
package MultipleInheritance;
import java.util.*;
interface XList1 extends List, Collection {}
interface XList2<E> extends List<E>, Collection<E> {}
interface XList3<E> extends List<E>, Collection<E>
{
public <T> T[] toArray(T[] target);
}
| 1,460 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
UncheckedArray.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/UncheckedArray.java | /*
* Copyright (c) 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 4992316
* @summary compiler allows new array of array of type parameter
* @author gafter
*
* @compile/fail UncheckedArray.java
*/
package unchecked.array;
class J<T> {
{
Object o = new T[3][];
}
}
| 1,293 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
ArrayTypearg.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/ArrayTypearg.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 4881205
* @summary generics: array as generic argument type fails
* @author gafter
*
* @compile ArrayTypearg.java
*/
import java.util.List;
import java.util.ArrayList;
class ArrayTypearg {
private void foo() {
List<Object[]> list = new ArrayList<Object[]>();
Object o1 = list.get(0)[0];
}
}
| 1,395 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
TyparamLit.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/TyparamLit.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 4881265
* @summary generics: compiler allows T.class for type variable T
* @author gafter
*
* @compile/fail TyparamLit.java
*/
class TyparamLit<T> {
Class x = T.class;
}
| 1,253 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6391995.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/T6391995.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 6391995
* @summary removal of "rvalue conversion" causes problems
* @author Peter von der Ah\u00e9
* @compile T6391995.java
*/
public class T6391995 {
<E> void iterate(Iterable<E> iterable) {
Iterable<? extends Iterable<? extends Object>> x = null;
iterate(x.iterator().next());
}
}
| 1,388 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6332204.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6332204/T6332204.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 6332204
* @summary com.sun.tools.javac.code.Types.lub() throws NPE
* @author Peter von der Ah\u00e9
* @compile T6332204.java
*/
import java.util.*;
public class T6332204 {
void m(int[][] data, Comparator c) {
Arrays.binarySearch(data, 1, c);
}
}
| 1,351 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6346876.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6332204/T6346876.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 6332204
* @summary com.sun.tools.javac.code.Types.lub() throws NPE
* @compile T6346876.java
*/
public final class T6346876 {
private double[][] _d;
public void foo() {
Object o =_d==null ? new double[0] : _d;
}
}
| 1,322 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6531090b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6531090/T6531090b.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 6531090 6711619
*
* @summary Cannot access methods/fields of a captured type belonging to an intersection type
* @author Maurizio Cimadamore
*
*/
public class T6531090b {
static class A {
public void a1() {}
protected void a2() {}
void a3() {}
public A a1;
protected A a2;
A a3;
}
static class B extends A {
public void b1() {}
protected void b2() {}
void b3() {}
public B b1;
protected B b2;
B b3;
}
static interface I{
void i();
}
static interface I1{
void i1();
}
static class E extends B implements I, I1{
public void i() {}
public void i1() {}
}
static class C<W extends B & I1, T extends W>{
T t;
W w;
C(W w, T t) {
this.w = w;
this.t = t;
}
}
public static void main(String... args) {
C<E,E> c = new C<E,E>(new E(), new E());
testMemberMethods(c);
testMemberFields(c);
}
static void testMemberMethods(C<? extends A, ? extends I> arg) {
arg.t.a1();
arg.t.a2();
arg.t.a3();
arg.t.b1();
arg.t.b2();
arg.t.b3();
arg.t.i1();
arg.w.a1();
arg.w.a2();
arg.w.a3();
arg.w.b1();
arg.w.b2();
arg.w.b3();
arg.w.i1();
}
static void testMemberFields(C<? extends A, ? extends I> arg) {
A ta; B tb;
ta = arg.t.a1;
ta = arg.t.a2;
ta = arg.t.a3;
tb = arg.t.b1;
tb = arg.t.b2;
tb = arg.t.b3;
ta = arg.w.a1;
ta = arg.w.a2;
ta = arg.w.a3;
tb = arg.w.b1;
tb = arg.w.b2;
tb = arg.w.b3;
}
}
| 2,850 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6531090a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6531090/T6531090a.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 6531090
*
* @summary Cannot access methods/fields of a captured type belonging to an intersection type
* @author Maurizio Cimadamore
*
*/
public class T6531090a {
static class E {}
static class F extends E implements I1 {}
static interface I {}
static interface I1 {}
static class G extends F implements I {}
static class C<T extends E & I> {
T field;
}
public static void main(String... args) {
test(new C<G>());
}
static <W extends F> void test(C<? extends W> arg) {
F vf = arg.field;
I vi = arg.field;
I1 vi1 = arg.field;
E ve = arg.field;
W vt = arg.field;
}
}
| 1,750 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6218229.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6218229/T6218229.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 6218229
* @summary NPE in Check.checkCompatibleConcretes
* @compile T6218229.java
*/
public class T6218229 {
static interface Ac<S extends St<S,A>,A extends Ac<S,A>> { };
static interface St<S extends St<S,A>,A extends Ac<S,A>> { };
static abstract class CSS<X, Y> implements St<CSS<X, Y>, CSN<X, Y>> {};
static final class CSN<X, Y> extends CSS<X, Y> implements Ac<CSS<X, Y>, CSN<X, Y>> {};
}
| 1,496 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6910550d.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6910550/T6910550d.java | /*
* @test /nodynamiccopyright/
* @bug 6910550
*
* @summary javac 1.5.0_17 fails with incorrect error message
* @compile/fail/ref=T6910550d.out -XDrawDiagnostics T6910550d.java
*
*/
class T6910550d {
<X> void m(X x) {}
<Y> void m(Y y) {}
{ m(null); }
}
| 274 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6910550b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6910550/T6910550b.java | /*
* @test /nodynamiccopyright/
* @bug 6910550
*
* @summary javac 1.5.0_17 fails with incorrect error message
* @compile/fail/ref=T6910550b.out -XDrawDiagnostics T6910550b.java
*
*/
class T6910550b<X, Y, Z> {
void m(X x) {}
void m(Y y) {}
void m(Z y) {}
{ m(null); }
}
| 294 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6910550e.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6910550/T6910550e.java | /*
* @test /nodynamiccopyright/
* @bug 6910550
*
* @summary javac 1.5.0_17 fails with incorrect error message
* @compile/fail/ref=T6910550e.out -XDrawDiagnostics T6910550e.java
*
*/
class T6910550e {
static class Pair<X,Y> {}
<X> void m(Pair<X,X> x) {}
<X,Y> void m(Pair<X,Y> y) {}
{ m(new Pair<String,String>());
m(new Pair<String,Integer>()); }
}
| 379 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6910550c.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6910550/T6910550c.java | /*
* @test /nodynamiccopyright/
* @bug 6910550
*
* @summary javac 1.5.0_17 fails with incorrect error message
* @compile/fail/ref=T6910550c.out -XDrawDiagnostics T6910550c.java
*
*/
class T6910550c {
void m(Object[] x) {}
void m(Object... x) {}
{ m(); }
{ m(null); }
{ m(null, null); }
{ m(null, null, null); }
}
| 346 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6910550a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6910550/T6910550a.java | /*
* @test /nodynamiccopyright/
* @bug 6910550
*
* @summary javac 1.5.0_17 fails with incorrect error message
* @compile/fail/ref=T6910550a.out -XDrawDiagnostics T6910550a.java
*
*/
import java.util.*;
class T6910550a {
void m(List<String> ls) {}
void m(List<Integer> li) {}
{ m(Arrays.asList(12)); }
}
| 324 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
J.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/parametricException/J.java | /*
* Copyright (c) 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 5038685
* @summary javac appears to omit throws portion of generic signature attribute
* @author gafter
*
* @compile J.java
* @compile K.java
*/
class J<T extends Exception> {
void f() throws T {}
}
| 1,284 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
K.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/parametricException/K.java | /*
* Copyright (c) 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.
*/
class K {
void f(J<NullPointerException> j) {
j.f();
}
}
| 1,125 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
ForwardSeparateBound1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/forwardSeparateBound/ForwardSeparateBound1.java | /*
* Copyright (c) 2001, 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.
*/
/*
* Auxiliary file for 4488671 (ForwardSeparateBound2).
*/
class X<T> {}
class T1<A extends X<B>, B> {}
| 1,161 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
ForwardSeparateBound2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/forwardSeparateBound/ForwardSeparateBound2.java | /*
* Copyright (c) 2001, 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 4488671
* @summary generics: forward referenced bounds vs separate compilation
* @author gafter
*
* @compile ForwardSeparateBound1.java ForwardSeparateBound2.java
* @compile ForwardSeparateBound2.java
*/
class Z {}
class Y extends X<Z> {}
class T2 {
T1<Y, Z> t1;
}
| 1,356 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BoundBug.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/BoundBug.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 4890134
* @summary generics: used of ? get bound error
* @author gafter
*
* @compile BoundBug.java
*/
class BoundBug {
class C {}
class B<T extends C>
{
void foo() {
B<? super T> con = null; //ok
B<? extends T> cov = null; //ok
B<?> biv = null; //fails
B<T> inv = null;
}
}
static
{
B<? super C> con = null; //ok
B<? extends C> cov = null; //ok
B<?> biv = null; //fails
B<C> inv = null;
}
}
| 1,625 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
UnboundArray.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/UnboundArray.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 4881259
* @summary generics: allow arrays of unbounded generic types
* @author gafter
*
* @compile UnboundArray.java
*/
class C<E> {
}
class T {
C<?>[] x = null;
}
| 1,248 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentDifferentTypes3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes3.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
* @summary Test subtyping for wildcards with related type bounds.
*
* @compile/fail AssignmentDifferentTypes3.java
*/
public class AssignmentDifferentTypes3 {
public static void main(String[] args) {
Ref<Der> derexact = null;
Ref<Base> baseexact = null;
Ref<? extends Der> derext = null;
Ref<? extends Base> baseext = null;
Ref<? super Der> dersuper = null;
Ref<? super Base> basesuper = null;
baseexact = derexact; // <<fail>> <Base> = <Der>
}
}
class Ref<T> {}
class Base {}
class Der extends Base {}
| 1,642 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentSameType7.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentSameType7.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
* @summary Test subtyping for wildcards with the same type bound.
*
* @compile/fail AssignmentSameType7.java
*/
public class AssignmentSameType7 {
public static void main(String[] args) {
Ref<B> exact = null;
Ref<? extends B> ebound = null;
Ref<? super B> sbound = null;
Ref<?> unbound = null;
sbound = ebound; // <<fail>> <? super A> = <? extends A>
}
}
class Ref<A> {}
class B {}
| 1,510 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentDifferentTypes7.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes7.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
* @summary Test subtyping for wildcards with related type bounds.
*
* @compile/fail AssignmentDifferentTypes7.java
*/
public class AssignmentDifferentTypes7 {
public static void main(String[] args) {
Ref<Der> derexact = null;
Ref<Base> baseexact = null;
Ref<? extends Der> derext = null;
Ref<? extends Base> baseext = null;
Ref<? super Der> dersuper = null;
Ref<? super Base> basesuper = null;
baseext = dersuper; // <<fail>> <? extends Base> = <? super Der>
}
}
class Ref<T> {}
class Base {}
class Der extends Base {}
| 1,660 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentDifferentTypes8.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes8.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
* @summary Test subtyping for wildcards with related type bounds.
*
* @compile/fail AssignmentDifferentTypes8.java
*/
public class AssignmentDifferentTypes8 {
public static void main(String[] args) {
Ref<Der> derexact = null;
Ref<Base> baseexact = null;
Ref<? extends Der> derext = null;
Ref<? extends Base> baseext = null;
Ref<? super Der> dersuper = null;
Ref<? super Base> basesuper = null;
basesuper = dersuper; // <<fail>> <? super Base> = <? super Der>
}
}
class Ref<T> {}
class Base {}
class Der extends Base {}
| 1,658 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6450290.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/T6450290.java | /*
* Copyright (c) 2004, 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 6450290
* @summary Capture of nested wildcards causes type error
* @author Maurizio Cimadamore
* @compile/fail T6450290.java
*/
public class T6450290 {
static class Box<X extends Box<?,?>, T extends X> {
T value;
Box<X, T> same;
}
static class A extends Box<A,A> {}
static class B extends Box<B,B> {}
public static void main(String[] args) {
Box<?,?> b = new Box<Box<A,A>,Box<A,A>>();
b.value.same = new Box<B,B>(); //javac misses this bad assignment
}
}
| 1,595 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentSameType8.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentSameType8.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
* @summary Test subtyping for wildcards with the same type bound.
*
* @compile/fail AssignmentSameType8.java
*/
public class AssignmentSameType8 {
public static void main(String[] args) {
Ref<B> exact = null;
Ref<? extends B> ebound = null;
Ref<? super B> sbound = null;
Ref<?> unbound = null;
sbound = unbound; // <<fail>> <? super A> = <?>
}
}
class Ref<A> {}
class B {}
| 1,500 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentSameType6.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentSameType6.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
* @summary Test subtyping for wildcards with the same type bound.
*
* @compile/fail AssignmentSameType6.java
*/
public class AssignmentSameType6 {
public static void main(String[] args) {
Ref<B> exact = null;
Ref<? extends B> ebound = null;
Ref<? super B> sbound = null;
Ref<?> unbound = null;
ebound = unbound; // <<fail>> <? extends A> = <?>
}
}
class Ref<A> {}
class B {}
| 1,502 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5097548b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/T5097548b.java | /*
* Copyright (c) 2004, 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 5097548
* @summary Stack overflow in capture conversion
* @author Peter von der Ah\u00e9
* @compile T5097548b.java
*/
interface Edge<N extends Node<? extends Edge<N>>> {
void setEndNode(N n);
}
interface Node<E extends Edge<? extends Node<E>>> {
E getOutEdge();
}
public class T5097548b {
public static void main(String[] args) {
Node<?> node = null;
node.getOutEdge().setEndNode(null);
}
}
| 1,508 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentDifferentTypes6.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes6.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
* @summary Test subtyping for wildcards with related type bounds.
*
* @compile/fail AssignmentDifferentTypes6.java
*/
public class AssignmentDifferentTypes6 {
public static void main(String[] args) {
Ref<Der> derexact = null;
Ref<Base> baseexact = null;
Ref<? extends Der> derext = null;
Ref<? extends Base> baseext = null;
Ref<? super Der> dersuper = null;
Ref<? super Base> basesuper = null;
derext = basesuper; // <<fail>> <? extends Der> = <? super Base>
}
}
class Ref<T> {}
class Base {}
class Der extends Base {}
| 1,660 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentSameType2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentSameType2.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
* @summary Test subtyping for wildcards with the same type bound.
*
* @compile/fail AssignmentSameType2.java
*/
public class AssignmentSameType2 {
public static void main(String[] args) {
Ref<B> exact = null;
Ref<? extends B> ebound = null;
Ref<? super B> sbound = null;
Ref<?> unbound = null;
exact = ebound; // <<fail>> <A> = <? extends A>
}
}
class Ref<A> {}
class B {}
| 1,502 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentSameType4.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentSameType4.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
* @summary Test subtyping for wildcards with the same type bound.
*
* @compile/fail AssignmentSameType4.java
*/
public class AssignmentSameType4 {
public static void main(String[] args) {
Ref<B> exact = null;
Ref<? extends B> ebound = null;
Ref<? super B> sbound = null;
Ref<?> unbound = null;
exact = unbound; // <<fail>> <A> = <?>
}
}
class Ref<A> {}
class B {}
| 1,492 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
ContraArg.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/ContraArg.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 4872698
* @summary generics: incorrect ambiguity error with super-bouded wildcards
* @author gafter
*
* @compile ContraArg.java
*/
class ContraArg {
void f(java.util.List<? super Integer> l) {
l.add(new Integer(3));
}
}
| 1,315 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentDifferentTypes9.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes9.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
* @summary Test subtyping for wildcards with related type bounds.
*
* @compile/fail AssignmentDifferentTypes9.java
*/
public class AssignmentDifferentTypes9 {
public static void main(String[] args) {
Ref<Der> derexact = null;
Ref<Base> baseexact = null;
Ref<? extends Der> derext = null;
Ref<? extends Base> baseext = null;
Ref<? super Der> dersuper = null;
Ref<? super Base> basesuper = null;
basesuper = derexact; // <<fail>> <? super Base> = <Der>
}
}
class Ref<T> {}
class Base {}
class Der extends Base {}
| 1,650 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentDifferentTypes2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes2.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
* @summary Test subtyping for wildcards with related type bounds.
*
* @compile/fail AssignmentDifferentTypes2.java
*/
public class AssignmentDifferentTypes2 {
public static void main(String[] args) {
Ref<Der> derexact = null;
Ref<Base> baseexact = null;
Ref<? extends Der> derext = null;
Ref<? extends Base> baseext = null;
Ref<? super Der> dersuper = null;
Ref<? super Base> basesuper = null;
derexact = baseexact; // <<fail>> <Der> = <Base>
}
}
class Ref<T> {}
class Base {}
class Der extends Base {}
| 1,642 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentDifferentTypes4.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes4.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
* @summary Test subtyping for wildcards with related type bounds.
*
* @compile/fail AssignmentDifferentTypes4.java
*/
public class AssignmentDifferentTypes4 {
public static void main(String[] args) {
Ref<Der> derexact = null;
Ref<Base> baseexact = null;
Ref<? extends Der> derext = null;
Ref<? extends Base> baseext = null;
Ref<? super Der> dersuper = null;
Ref<? super Base> basesuper = null;
derext = baseext; // <<fail>> <? extends Der> = <? extends Base>
}
}
class Ref<T> {}
class Base {}
class Der extends Base {}
| 1,662 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentSameType5.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentSameType5.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
* @summary Test subtyping for wildcards with the same type bound.
*
* @compile/fail AssignmentSameType5.java
*/
public class AssignmentSameType5 {
public static void main(String[] args) {
Ref<B> exact = null;
Ref<? extends B> ebound = null;
Ref<? super B> sbound = null;
Ref<?> unbound = null;
ebound = sbound; // <<fail>> <? extends A> = <? super A>
}
}
class Ref<A> {}
class B {}
| 1,510 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentSameType1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentSameType1.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
* @summary Test subtyping for wildcards with the same type bound.
*
* @compile AssignmentSameType1.java
*/
public class AssignmentSameType1 {
public static void main(String[] args) {
Ref<B> exact = null;
Ref<? extends B> ebound = null;
Ref<? super B> sbound = null;
Ref<?> unbound = null;
; exact = exact; // <<pass>> <A> = <A>
ebound = exact; // <<pass>> <? extends A> = <A>
ebound = ebound; // <<pass>> <? extends A> = <? extends A>
sbound = exact; // <<pass>> <? super A> = <A>
sbound = sbound; // <<pass>> <? super A> = <? super A>
unbound = exact; // <<pass>> <?> = <A>
unbound = ebound; // <<pass>> <?> = <? extends A>
unbound = sbound; // <<pass>> <?> = <? super A>
unbound = unbound; // <<pass>> <?> = <?>
}
}
class Ref<A> {}
class B {}
| 1,994 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentSameType3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentSameType3.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
* @summary Test subtyping for wildcards with the same type bound.
*
* @compile/fail AssignmentSameType3.java
*/
public class AssignmentSameType3 {
public static void main(String[] args) {
Ref<B> exact = null;
Ref<? extends B> ebound = null;
Ref<? super B> sbound = null;
Ref<?> unbound = null;
exact = sbound; // <<fail>> <A> = <? super A>
}
}
class Ref<A> {}
class B {}
| 1,500 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentDifferentTypes5.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes5.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
* @summary Test subtyping for wildcards with related type bounds.
*
* @compile/fail AssignmentDifferentTypes5.java
*/
public class AssignmentDifferentTypes5 {
public static void main(String[] args) {
Ref<Der> derexact = null;
Ref<Base> baseexact = null;
Ref<? extends Der> derext = null;
Ref<? extends Base> baseext = null;
Ref<? super Der> dersuper = null;
Ref<? super Base> basesuper = null;
derext = baseexact; // <<fail>> <? extends Der> = <Base>
}
}
class Ref<T> {}
class Base {}
class Der extends Base {}
| 1,652 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6732484.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/T6732484.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 6732484
* @summary Bound error on wildcard code
* @author Maurizio Cimadamore
* @compile T6732484.java
*/
class T6732484 {
class A<T extends A<T>> {}
class B extends A<B> {}
A<? super B> f;
}
| 1,288 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AssignmentDifferentTypes1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes1.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
* @summary Test subtyping for wildcards with related type bounds.
*
* @compile AssignmentDifferentTypes1.java
*/
public class AssignmentDifferentTypes1 {
public static void main(String[] args) {
Ref<Der> derexact = null;
Ref<Base> baseexact = null;
Ref<? extends Der> derext = null;
Ref<? extends Base> baseext = null;
Ref<? super Der> dersuper = null;
Ref<? super Base> basesuper = null;
baseext = derext; // <<pass>> <? extends Base> = <? extends Der>
baseext = derexact; // <<pass>> <? extends Base> = <Der>
dersuper = basesuper; // <<pass>> <? super Der> = <? super Base>
dersuper = baseexact; // <<pass>> <? super Der> = <Base>
}
}
class Ref<T> {}
class Base {}
class Der extends Base {}
| 1,868 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5097548.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/T5097548.java | /*
* Copyright (c) 2004, 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 5097548
* @summary (crash) Stack overflow in capture conversion
* @author Peter von der Ah\u00e9
* @compile T5097548.java
* @run main T5097548
*/
interface Edge<N extends Node<? extends Edge<? extends N>>> {}
interface Node<E extends Edge<? extends Node<? extends E>>> {}
public class T5097548 {
public static void main(String[] args) {
System.out.println("FISK");
}
}
| 1,471 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6886247_1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/6886247/T6886247_1.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 6886247
* @author Maurizio Cimadamore
* @summary regression: javac crashes with an assertion error in Attr.java
* @compile T6886247_1.java
*/
class Outer<E> {
public void method(Outer<? extends E>.Inner inner) {
E entry = inner.getE();
}
class Inner {
E getE() {return null;}
}
}
| 1,388 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6886247_2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/6886247/T6886247_2.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 6886247
* @author Maurizio Cimadamore
* @summary regression: javac crashes with an assertion error in Attr.java
* @compile/fail/ref=T6886247_2.out -XDrawDiagnostics T6886247_2.java
*/
class Outer<E> {
public void method(Outer<?>.Inner inner) {
E entry = inner.getE();
}
class Inner {
E getE() {return null;}
}
}
| 1,421 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6437894.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/6437894/T6437894.java | /*
* @test /nodynamiccopyright/
* @bug 6437894
* @summary Javac throws a NullPointerException
* @author jan.lahoda@...
* @author Peter von der Ah\u00e9
* @compile A.java B.java
* @clean a.A
* @compile/fail/ref=T6437894.out -XDrawDiagnostics T6437894.java
*/
public class T6437894 {
public static void main(String... args) {
b.B m;
a.A.X x = null;
Long.parseLong(x.toString());
}
}
| 432 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
A.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/6437894/A.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 a;
public class A {
}
| 1,083 | 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/wildcards/6437894/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 b;
public class B {
public a.A a;
}
| 1,101 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastTest.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/pos/CastTest.java | /*
* Copyright (c) 2003, 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 4916607
* @summary Test casts (legal, warning, and errors)
* @author gafter
*
* @compile -Werror CastTest.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 = (AC<String>) (AA<Vector<String>>) null; // <<pass>>
o = (AD<Number>) (AA<Vector<? extends Number>>) null; // <<pass>>
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 = (AF<String>) (AA<String[]>) null; // <<pass>>
o = (AG<?>) (AA<String>) null; // <<pass>>
}
// --- 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 = (BD<String>) (BB<String, String>) null; // <<pass>>
}
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;
o = (CE<String>) (CD<String>) null; // <<pass>>
// 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<? extends Number>) (DA<Integer>) null; // <<pass>>
o = (DA<? super Integer>) (DA<Number>) null; // <<pass>>
o = (DA<?>) (DA<Integer>) null; // <<pass>>
o = (DA<?>) (DA<? extends Integer>) null; // <<pass>>
o = (DA<?>) (DA<? super String>) null; // <<pass>>
o = (DA<?>) (DA<?>) null; // <<pass>>
// Typevars
o = (DA<? extends Number>) (DA<I>) null; // <<pass>>
// Raw (asymmetrical!)
o = (DA) (DB<Number>) null; // <<pass>>
o = (DA<?>) (DB) null; // <<pass>>
o = (DA<? extends Object>) (DB) null; // <<pass>>
o = (DB) (DA<Number>) null; // <<pass>>
o = (DB<?>) (DA) null; // <<pass>>
o = (DB<? extends Object>) (DA) null; // <<pass>>
// reported broken (5034609)
// o = (DC<?>) (DA<?>) null; // <<pass>>
}
}
| 4,866 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
ParamCast.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/pos/ParamCast.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 4916567
* @summary integrate improved wildcard substitution from CPH
* @author gafter
*
* @compile -Werror -Xlint:unchecked ParamCast.java
*/
class A<T> {}
class B<S, T> extends A<T> {}
class Main {
void f(A<String> as) {
Object o = (B<?, String>) as;
}
}
| 1,352 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Capture.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/pos/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 -Werror Capture.java
*/
class X<T> {}
class Capture {
void f(X<? extends Number> x) {
f2(x);
f3(x);
}
<T> void f2(X<T> x) {}
<T extends Number> void f3(X<T> x) {}
}
| 1,344 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
InstanceOf.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/pos/InstanceOf.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 4892571
* @summary generics: type cast with instance of
* @author gafter
*
* @compile -Werror InstanceOf.java
*/
class InstanceOf<T> {
static interface I1<T> {
public T[] toArray();
}
static interface I2<T> extends I1<T> {
public T[] toArray();
}
static interface I3<T> extends I2<T> { }
InstanceOf() {
I1<T> inv = null;
I1<? extends T> cov = null;
I1<? super T> con = null;
boolean b;
b = inv instanceof I3; // <<pass>>
b = cov instanceof I3; // <<pass>>
b = con instanceof I3; // <<pass>>
}
}
| 1,677 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
UncheckedCast1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/pos/UncheckedCast1.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 4875036
* @summary generics: failure of some unchecked casts
* @author gafter
*
* @compile UncheckedCast1.java
*/
class Z {
<U, T extends U> T g(Object o) {
return (T) o; // bug???
}
}
| 1,280 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
RvalConversion.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/pos/RvalConversion.java | /*
* Copyright (c) 2003, 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 4918637 4931781
* @summary rvalue conversion changes "? extends X" to "X".
* @author gafter
*
* @compile RvalConversion.java
*/
import java.util.*;
class T {
void f(Map<?,?> m) {
for ( Map.Entry e : m.entrySet() ) { }
}
}
class Box<T> {
T get() { return null; }
}
class Main {
public static void main(String[] args) {
Box<? extends Integer> bi = null;
int i = bi.get();
}
}
| 1,504 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AmbiguousCast2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/pos/AmbiguousCast2.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 4856982
* @summary generics: unable to cast between two convertible types
* @author gafter
*
* @compile AmbiguousCast2.java
*/
import java.lang.ref.*;
class Test<K, V> extends WeakReference<V> {
static ReferenceQueue<Integer> queue = new ReferenceQueue<Integer>();
public Test(K key, V value, ReferenceQueue<V> queue) {
super(value, queue);
}
public static void main(String[] arg) throws Exception {
Test<String, Integer> fromQueue = (Test<String, Integer>) queue.remove();
}
}
| 1,596 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BoundsCollision.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/pos/BoundsCollision.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 4916665
* @summary when upper bounds and lower bounds collide
* @author gafter
*
* @compile -Werror BoundsCollision.java
*/
class StreinBug {
static class Box<T extends Number> {
void f(Box<T> bt) { }
}
public void g() {
Box<? super Number> b0 = null;
Box<Number> b1 = b0;
b0.f(b1); // <<pass>>
}
}
| 1,429 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6651719a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/6651719/T6651719a.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 6651719
* @summary Compiler crashes possibly during forward reference of TypeParameter
* @compile T6651719a.java
*/
public class T6651719a<T extends S, S> {
T6651719a<? extends T6651719a<?, ?>, ? extends T6651719a<?, ?>> crash = null;
}
| 1,321 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6762569a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/6762569/T6762569a.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 6762569
* @summary Javac crashes with AssertionError in Types.containedBy
* @compile T6762569a.java
*/
import java.util.*;
class T6762569a {
<T> void m(T t, List<? super List<T>> list) {}
void test(List<? super List<?>> list) {
m("", list);
}
}
| 1,346 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6762569b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/6762569/T6762569b.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 6762569
* @summary Javac crashes with AssertionError in Types.containedBy
* @compile/fail T6762569b.java
*/
import java.util.*;
class T6762569b {
<T> void m(T t, List<? super List<T>> list) {}
void test(List<? super List<? extends Number>> list) {
m("", list);
}
}
| 1,366 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6320612.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/6320612/T6320612.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 6320612
* @summary Unwarranted unchecked warning for inner class of "wildcard" type
* @compile -Werror -Xlint:unchecked T6320612.java
*/
public class T6320612<T> {
private T6320612<?>.Inner inner;
public T6320612() {
this.inner = new T6320612().new Inner();
}
private class Inner {}
}
| 1,395 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail2.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 CastFail2.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<Vector<Number>>) null; // <<fail 2>>
}
}
| 1,743 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail9.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail9.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 CastFail9.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<String, Number>) null; // <<fail 9>>
}
}
| 1,556 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail17.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail17.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 CastFail17.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 String>) null; // <<fail 17>>
}
}
| 1,606 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail8.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail8.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 CastFail8.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 = (BC<?>) (BA<String>) null; // <<fail 8>>
}
}
| 1,543 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn4.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn4.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 CastWarn4.java
*/
import java.util.*;
class CastTest {
// --- Disjoint ---
private interface DA<T> { }
private interface DB<T> extends DA<T> { }
private interface DC<T> extends DA<Integer> { }
private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() {
Object o;
o = (DA<? super String>) (DA<? super Number>) null; // <<warn 4>>
}
}
| 1,623 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn5.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn5.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 CastWarn5.java
*/
import java.util.*;
class CastTest {
// --- Disjoint ---
private interface DA<T> { }
private interface DB<T> extends DA<T> { }
private interface DC<T> extends DA<Integer> { }
private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() {
Object o;
o = (DA<? extends Integer>) (DA<N>) null; // <<warn 5>>
}
}
| 1,613 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn3.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 CastWarn3.java
*/
import java.util.*;
class CastTest {
// --- Disjoint ---
private interface DA<T> { }
private interface DB<T> extends DA<T> { }
private interface DC<T> extends DA<Integer> { }
private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() {
Object o;
o = (DA<? super Integer>) (DA<? extends Number>) null; // <<warn 3>>
}
}
| 1,626 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail14.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail14.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 CastFail14.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;
// Classes
o = (DA<Number>) (DA<Integer>) null; // <<fail 14>>
}
}
| 1,604 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
ParamCast.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/ParamCast.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 4916567
* @summary Description
* @author gafter
*
* @compile/fail ParamCast.java
*/
class A<T> {}
class B<S, T> extends A<T> {}
class Main {
void f(A<String> as) {
Object o = (B<?, Integer>) as;
}
}
| 1,295 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Unbounded.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/Unbounded.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 an unbounded (bivariant) wildcard doesn't allow reading
* @author gafter
*
* @compile/fail Unbounded.java
*/
import java.util.Stack;
class Bug {
void f() {
Stack<?> stack = null;
String o = stack.pop();
}
}
| 1,329 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail7.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail7.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 CastFail7.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 = (AG<?>) (AA<Number>) null; // <<fail 7>>
}
}
| 1,730 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastFail15.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastFail15.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 CastFail15.java
*/
import java.util.*;
class CastTest {
// --- Disjoint ---
private interface DA<T> { }
private interface DB<T> extends DA<T> { }
private interface DC<T> extends DA<Integer> { }
private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() {
Object o;
o = (DA<? extends Integer>) (DA<Number>) null; // <<fail 15>>
}
}
| 1,595 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn7.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn7.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 CastWarn7.java
*/
import java.util.*;
class CastTest {
// --- Disjoint ---
private interface DA<T> { }
private interface DB<T> extends DA<T> { }
private interface DC<T> extends DA<Integer> { }
private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() {
Object o;
o = (DA<N>) (DA<? extends Integer>) null; // <<warn 7>>
}
}
| 1,613 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CastWarn13.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/wildcards/neg/CastWarn13.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 CastWarn13.java
*/
import java.util.*;
class CastTest {
// --- Disjoint ---
private interface DA<T> { }
private interface DB<T> extends DA<T> { }
private interface DC<T> extends DA<Integer> { }
private <N extends Number, I extends Integer, R extends Runnable, S extends String> void disjointness() {
Object o;
o = (DB<Number>) (DA) null; // <<warn 13>>
}
}
| 1,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.