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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
T6718364.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6718364/T6718364.java | /**
* @test /nodynamiccopyright/
* @bug 6718364
* @summary inference fails when a generic method is invoked with raw arguments
* @compile/ref=T6718364.out -XDrawDiagnostics -Xlint:unchecked T6718364.java
*/
class T6718364 {
class X<T> {}
public <T> void m(X<T> x, T t) {}
public void test() {
m(new X<X<Integer>>(), new X());
}
}
| 361 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6638712b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6638712/T6638712b.java | /*
* @test /nodynamiccopyright/
* @bug 6638712
* @author mcimadamore
* @summary Inference with wildcard types causes selection of inapplicable method
* @compile/fail/ref=T6638712b.out -XDrawDiagnostics T6638712b.java
*/
class T6638712b<X> {
<I extends T6638712b<T>, T> T m(I test) { return null; }
void test(T6638712b<Integer> x) {
String i = m(x);
}
}
| 387 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6638712d.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6638712/T6638712d.java | /*
* @test /nodynamiccopyright/
* @bug 6638712 6730468
* @author mcimadamore
* @summary Inference with wildcard types causes selection of inapplicable method
* @compile/fail/ref=T6638712d.out -XDrawDiagnostics T6638712d.java
*/
import java.util.*;
public class T6638712d {
<U> U m(U u, List<List<U>> list) { return null; }
void test(List<List<String>> lls) {
m(1, lls);
}
}
| 409 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6638712c.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6638712/T6638712c.java | /*
* @test /nodynamiccopyright/
* @bug 6638712 6707034
* @author mcimadamore
* @summary Inference with wildcard types causes selection of inapplicable method
* @compile/fail/ref=T6638712c.out -XDrawDiagnostics T6638712c.java
*/
import java.util.*;
class T6638712c {
<T> T sort(T[] a, Comparator<? super T> c) { return null; }
void test(Enum[] e, Comparator<Enum<?>> comp) {
sort(e, comp);
}
}
| 428 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6638712a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6638712/T6638712a.java | /*
* @test /nodynamiccopyright/
* @bug 6638712
* @author mcimadamore
* @summary Inference with wildcard types causes selection of inapplicable method
* @compile/fail/ref=T6638712a.out -XDrawDiagnostics T6638712a.java
*/
import java.util.*;
class T6638712a {
<T> Comparator<T> compound(Iterable<? extends Comparator<? super T>> it) { return null; }
public void test(List<Comparator<?>> x) {
Comparator<String> c3 = compound(x);
}
}
| 466 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6638712e.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6638712/T6638712e.java | /*
* @test /nodynamiccopyright/
* @bug 6638712 6795689
* @author mcimadamore
* @summary Inference with wildcard types causes selection of inapplicable method
* @compile/fail/ref=T6638712e.out -XDrawDiagnostics T6638712e.java
*/
class T6638712e {
static class Foo<A, B> {
<X> Foo<X, B> m(Foo<? super X, ? extends A> foo) { return null;}
}
static class Test {
Foo<Object, String> test(Foo<Boolean, String> foo1, Foo<Boolean, Boolean> foo2) {
return foo1.m(foo2);
}
}
}
| 534 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5070671.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5070671/T5070671.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 5070671
* @summary Arrays.binarySearch can't infer int[]
* @compile T5070671.java
*/
import java.util.*;
public class T5070671 {
void foo1() {
Comparator<int[]> c = new Comparator<int[]>() {
public int compare(int[] c1, int[] c2) { return 0; }
};
int[][] arr = { { 1 } };
int[] elem = arr[0];
Arrays.sort(arr, c);
Arrays.binarySearch(arr, elem, c);
Arrays.<int[]>binarySearch(arr, elem, c);
}
void foo2() {
Comparator<Integer[]> c = new Comparator<Integer[]>() {
public int compare(Integer[] c1, Integer[] c2) { return 0; }
};
Integer[][] arr = { { 1 } };
Integer[] elem = arr[0];
Arrays.sort(arr, c);
Arrays.binarySearch(arr, elem, c);
}
}
| 1,872 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6938454a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6938454/T6938454a.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 6938454
*
* @summary Unable to determine generic type in program that compiles under Java 6
* @author mcimadamore
* @compile T6938454a.java
*
*/
class T6938454a {
static abstract class A { }
static class B extends A { }
B getB(B b) {
return makeA(b);
}
<X extends A, Y extends X> Y makeA(X x) {
return (Y)new B();
}
}
| 1,441 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6938454b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/6938454/T6938454b.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.
*/
import java.util.List;
/*
* @test
* @bug 6938454
*
* @summary Unable to determine generic type in program that compiles under Java 6
* @author mcimadamore
* @compile T6938454b.java
*
*/
class T6938454b {
static interface A {}
static interface B extends A {}
static class C implements B {}
<T, R extends T, S extends R> List<R> m(List<T> l, S s) {
return null;
}
List<B> test(List<A> la) {
return m(la, new C());
}
}
| 1,525 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5003431.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5003431/T5003431.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 5003431
* @summary java.lang.Object cannot be dereferenced
* @compile T5003431.java
*/
public class T5003431 {
static class SomeType<T> { T t = null; }
static <T> T nil() { return (new SomeType<T>()).t; }
public static void test() {
nil().getClass();
}
}
| 1,367 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6299211.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5021635/T6299211.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 6299211
* @summary method type variable: inference broken for null
* @compile T6299211.java
*/
public class T6299211 {
void m() {
java.util.Collections.max(null);
}
}
| 1,269 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5021635.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/inference/5021635/T5021635.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 5021635
* @summary Incorrect default inferred type parameter when type params interdependent
* @compile T5021635.java
*/
public class T5021635 {
static class M<T> {}
static <T extends M<U>, U> void f1() {
}
void g() {
f1();
}
}
| 1,336 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6951833.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/T6951833.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 6951833
*
* @summary latest diamond implementation generates spurious raw type warnings
* @author mcimadamore
* @compile -Xlint:rawtypes -Werror T6951833.java
*
*/
class T6951833<X> {
T6951833<String> bug = new T6951833<>();
}
| 1,310 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6939780.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/T6939780.java | /*
* @test /nodynamiccopyright/
* @bug 6939780 7020044
*
* @summary add a warning to detect diamond sites
* @author mcimadamore
* @compile/ref=T6939780.out T6939780.java -XDrawDiagnostics -XDfindDiamond
*
*/
class T6939780 {
void test() {
class Foo<X extends Number> {
Foo() {}
Foo(X x) {}
}
Foo<Number> f1 = new Foo<Number>(1);
Foo<?> f2 = new Foo<Number>();
Foo<?> f3 = new Foo<Integer>();
Foo<Number> f4 = new Foo<Number>(1) {};
Foo<?> f5 = new Foo<Number>() {};
Foo<?> f6 = new Foo<Integer>() {};
}
}
| 612 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DiamondAndInnerClassTest.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/7046778/DiamondAndInnerClassTest.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7046778
* @summary Project Coin: problem with diamond and member inner classes
*/
import com.sun.source.util.JavacTask;
import java.net.URI;
import java.util.Arrays;
import javax.tools.Diagnostic;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
public class DiamondAndInnerClassTest {
static int checkCount = 0;
enum TypeArgumentKind {
NONE(""),
STRING("<String>"),
INTEGER("<Integer>"),
DIAMOND("<>");
String typeargStr;
private TypeArgumentKind(String typeargStr) {
this.typeargStr = typeargStr;
}
boolean compatible(TypeArgumentKind that) {
switch (this) {
case NONE: return true;
case STRING: return that != INTEGER;
case INTEGER: return that != STRING;
default: throw new AssertionError("Unexpected decl kind: " + this);
}
}
boolean compatible(ArgumentKind that) {
switch (this) {
case NONE: return true;
case STRING: return that == ArgumentKind.STRING;
case INTEGER: return that == ArgumentKind.INTEGER;
default: throw new AssertionError("Unexpected decl kind: " + this);
}
}
}
enum ArgumentKind {
OBJECT("(Object)null"),
STRING("(String)null"),
INTEGER("(Integer)null");
String argStr;
private ArgumentKind(String argStr) {
this.argStr = argStr;
}
}
enum TypeQualifierArity {
ONE(1, "A1#TA1"),
TWO(2, "A1#TA1.A2#TA2"),
THREE(3, "A1#TA1.A2#TA2.A3#TA3");
int n;
String qualifierStr;
private TypeQualifierArity(int n, String qualifierStr) {
this.n = n;
this.qualifierStr = qualifierStr;
}
String getType(TypeArgumentKind... typeArgumentKinds) {
String res = qualifierStr;
for (int i = 1 ; i <= typeArgumentKinds.length ; i++) {
res = res.replace("#TA" + i, typeArgumentKinds[i-1].typeargStr);
}
return res;
}
boolean matches(InnerClassDeclArity innerClassDeclArity) {
return n ==innerClassDeclArity.n;
}
}
enum InnerClassDeclArity {
ONE(1, "class A1<X> { A1(X x1) { } #B }"),
TWO(2, "class A1<X1> { class A2<X2> { A2(X1 x1, X2 x2) { } #B } }"),
THREE(3, "class A1<X1> { class A2<X2> { class A3<X3> { A3(X1 x1, X2 x2, X3 x3) { } #B } } }");
int n;
String classDeclStr;
private InnerClassDeclArity(int n, String classDeclStr) {
this.n = n;
this.classDeclStr = classDeclStr;
}
}
enum ArgumentListArity {
ONE(1, "(#A1)"),
TWO(2, "(#A1,#A2)"),
THREE(3, "(#A1,#A2,#A3)");
int n;
String argListStr;
private ArgumentListArity(int n, String argListStr) {
this.n = n;
this.argListStr = argListStr;
}
String getArgs(ArgumentKind... argumentKinds) {
String res = argListStr;
for (int i = 1 ; i <= argumentKinds.length ; i++) {
res = res.replace("#A" + i, argumentKinds[i-1].argStr);
}
return res;
}
boolean matches(InnerClassDeclArity innerClassDeclArity) {
return n ==innerClassDeclArity.n;
}
}
public static void main(String... args) throws Exception {
//create default shared JavaCompiler - reused across multiple compilations
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
for (InnerClassDeclArity innerClassDeclArity : InnerClassDeclArity.values()) {
for (TypeQualifierArity declType : TypeQualifierArity.values()) {
if (!declType.matches(innerClassDeclArity)) continue;
for (TypeQualifierArity newClassType : TypeQualifierArity.values()) {
if (!newClassType.matches(innerClassDeclArity)) continue;
for (ArgumentListArity argList : ArgumentListArity.values()) {
if (!argList.matches(innerClassDeclArity)) continue;
for (TypeArgumentKind taDecl1 : TypeArgumentKind.values()) {
boolean isDeclRaw = taDecl1 == TypeArgumentKind.NONE;
//no diamond on decl site
if (taDecl1 == TypeArgumentKind.DIAMOND) continue;
for (TypeArgumentKind taSite1 : TypeArgumentKind.values()) {
boolean isSiteRaw = taSite1 == TypeArgumentKind.NONE;
//diamond only allowed on the last type qualifier
if (taSite1 == TypeArgumentKind.DIAMOND &&
innerClassDeclArity != InnerClassDeclArity.ONE) continue;
for (ArgumentKind arg1 : ArgumentKind.values()) {
if (innerClassDeclArity == innerClassDeclArity.ONE) {
new DiamondAndInnerClassTest(innerClassDeclArity, declType, newClassType,
argList, new TypeArgumentKind[] {taDecl1},
new TypeArgumentKind[] {taSite1}, new ArgumentKind[] {arg1}).run(comp, fm);
continue;
}
for (TypeArgumentKind taDecl2 : TypeArgumentKind.values()) {
//no rare types
if (isDeclRaw != (taDecl2 == TypeArgumentKind.NONE)) continue;
//no diamond on decl site
if (taDecl2 == TypeArgumentKind.DIAMOND) continue;
for (TypeArgumentKind taSite2 : TypeArgumentKind.values()) {
//no rare types
if (isSiteRaw != (taSite2 == TypeArgumentKind.NONE)) continue;
//diamond only allowed on the last type qualifier
if (taSite2 == TypeArgumentKind.DIAMOND &&
innerClassDeclArity != InnerClassDeclArity.TWO) continue;
for (ArgumentKind arg2 : ArgumentKind.values()) {
if (innerClassDeclArity == innerClassDeclArity.TWO) {
new DiamondAndInnerClassTest(innerClassDeclArity, declType, newClassType,
argList, new TypeArgumentKind[] {taDecl1, taDecl2},
new TypeArgumentKind[] {taSite1, taSite2},
new ArgumentKind[] {arg1, arg2}).run(comp, fm);
continue;
}
for (TypeArgumentKind taDecl3 : TypeArgumentKind.values()) {
//no rare types
if (isDeclRaw != (taDecl3 == TypeArgumentKind.NONE)) continue;
//no diamond on decl site
if (taDecl3 == TypeArgumentKind.DIAMOND) continue;
for (TypeArgumentKind taSite3 : TypeArgumentKind.values()) {
//no rare types
if (isSiteRaw != (taSite3 == TypeArgumentKind.NONE)) continue;
//diamond only allowed on the last type qualifier
if (taSite3 == TypeArgumentKind.DIAMOND &&
innerClassDeclArity != InnerClassDeclArity.THREE) continue;
for (ArgumentKind arg3 : ArgumentKind.values()) {
if (innerClassDeclArity == innerClassDeclArity.THREE) {
new DiamondAndInnerClassTest(innerClassDeclArity, declType, newClassType,
argList, new TypeArgumentKind[] {taDecl1, taDecl2, taDecl3},
new TypeArgumentKind[] {taSite1, taSite2, taSite3},
new ArgumentKind[] {arg1, arg2, arg3}).run(comp, fm);
continue;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
System.out.println("Total check executed: " + checkCount);
}
InnerClassDeclArity innerClassDeclArity;
TypeQualifierArity declType;
TypeQualifierArity siteType;
ArgumentListArity argList;
TypeArgumentKind[] declTypeArgumentKinds;
TypeArgumentKind[] siteTypeArgumentKinds;
ArgumentKind[] argumentKinds;
JavaSource source;
DiagnosticChecker diagChecker;
DiamondAndInnerClassTest(InnerClassDeclArity innerClassDeclArity,
TypeQualifierArity declType, TypeQualifierArity siteType, ArgumentListArity argList,
TypeArgumentKind[] declTypeArgumentKinds, TypeArgumentKind[] siteTypeArgumentKinds,
ArgumentKind[] argumentKinds) {
this.innerClassDeclArity = innerClassDeclArity;
this.declType = declType;
this.siteType = siteType;
this.argList = argList;
this.declTypeArgumentKinds = declTypeArgumentKinds;
this.siteTypeArgumentKinds = siteTypeArgumentKinds;
this.argumentKinds = argumentKinds;
this.source = new JavaSource();
this.diagChecker = new DiagnosticChecker();
}
class JavaSource extends SimpleJavaFileObject {
String bodyTemplate = "#D res = new #S#AL;";
String source;
public JavaSource() {
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
source = innerClassDeclArity.classDeclStr.replace("#B", bodyTemplate)
.replace("#D", declType.getType(declTypeArgumentKinds))
.replace("#S", siteType.getType(siteTypeArgumentKinds))
.replace("#AL", argList.getArgs(argumentKinds));
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
return source;
}
}
void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
null, null, Arrays.asList(source));
try {
ct.analyze();
} catch (Throwable ex) {
throw new AssertionError("Error thron when compiling the following code:\n" + source.getCharContent(true));
}
check();
}
void check() {
checkCount++;
boolean errorExpected = false;
TypeArgumentKind[] expectedArgKinds = new TypeArgumentKind[innerClassDeclArity.n];
for (int i = 0 ; i < innerClassDeclArity.n ; i++) {
if (!declTypeArgumentKinds[i].compatible(siteTypeArgumentKinds[i])) {
errorExpected = true;
break;
}
expectedArgKinds[i] = siteTypeArgumentKinds[i] == TypeArgumentKind.DIAMOND ?
declTypeArgumentKinds[i] : siteTypeArgumentKinds[i];
}
if (!errorExpected) {
for (int i = 0 ; i < innerClassDeclArity.n ; i++) {
//System.out.println("check " + expectedArgKinds[i] + " against " + argumentKinds[i]);
if (!expectedArgKinds[i].compatible(argumentKinds[i])) {
errorExpected = true;
break;
}
}
}
if (errorExpected != diagChecker.errorFound) {
throw new Error("invalid diagnostics for source:\n" +
source.getCharContent(true) +
"\nFound error: " + diagChecker.errorFound +
"\nExpected error: " + errorExpected);
}
}
static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
boolean errorFound;
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
errorFound = true;
}
}
}
}
| 14,843 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Pos04.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/pos/Pos04.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6939620 7020044
*
* @summary basic test for diamond (simple/qualified type-expressions, local class)
* @author mcimadamore
* @compile Pos04.java
* @run main Pos04
*
*/
public class Pos04<U> {
void test() {
class Foo<V> {
Foo(V x) {}
<Z> Foo(V x, Z z) {}
}
Foo<Integer> p1 = new Foo<>(1);
Foo<? extends Integer> p2 = new Foo<>(1);
Foo<?> p3 = new Foo<>(1);
Foo<? super Integer> p4 = new Foo<>(1);
Foo<Integer> p5 = new Foo<>(1, "");
Foo<? extends Integer> p6 = new Foo<>(1, "");
Foo<?> p7 = new Foo<>(1, "");
Foo<? super Integer> p8 = new Foo<>(1, "");
}
public static void main(String[] args) {
Pos04<String> p4 = new Pos04<>();
p4.test();
}
}
| 1,870 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Pos03.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/pos/Pos03.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6939620 7020044
*
* @summary basic test for diamond (simple/qualified type-expressions, member inner)
* @author mcimadamore
* @compile Pos03.java
* @run main Pos03
*
*/
public class Pos03<U> {
class Foo<V> {
Foo(V x) {}
<Z> Foo(V x, Z z) {}
}
void testSimple() {
Foo<Integer> f1 = new Foo<>(1);
Foo<? extends Integer> f2 = new Foo<>(1);
Foo<?> f3 = new Foo<>(1);
Foo<? super Integer> f4 = new Foo<>(1);
Foo<Integer> f5 = new Foo<>(1, "");
Foo<? extends Integer> f6 = new Foo<>(1, "");
Foo<?> f7 = new Foo<>(1, "");
Foo<? super Integer> f8 = new Foo<>(1, "");
}
void testQualified_1() {
Foo<Integer> f1 = new Pos03<U>.Foo<>(1);
Foo<? extends Integer> f2 = new Pos03<U>.Foo<>(1);
Foo<?> f3 = new Pos03<U>.Foo<>(1);
Foo<? super Integer> f4 = new Pos03<U>.Foo<>(1);
Foo<Integer> f5 = new Pos03<U>.Foo<>(1, "");
Foo<? extends Integer> f6 = new Pos03<U>.Foo<>(1, "");
Foo<?> f7 = new Pos03<U>.Foo<>(1, "");
Foo<? super Integer> f8 = new Pos03<U>.Foo<>(1, "");
}
void testQualified_2(Pos03<U> p) {
Foo<Integer> f1 = p.new Foo<>(1);
Foo<? extends Integer> f2 = p.new Foo<>(1);
Foo<?> f3 = p.new Foo<>(1);
Foo<? super Integer> f4 = p.new Foo<>(1);
Foo<Integer> f5 = p.new Foo<>(1, "");
Foo<? extends Integer> f6 = p.new Foo<>(1, "");
Foo<?> f7 = p.new Foo<>(1, "");
Foo<? super Integer> f8 = p.new Foo<>(1, "");
}
public static void main(String[] args) {
Pos03<String> p3 = new Pos03<>();
p3.testSimple();
p3.testQualified_1();
p3.testQualified_2(p3);
}
}
| 2,822 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Pos07.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/pos/Pos07.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6939620 6894753 7020044
*
* @summary Diamond and intersection types
* @author mcimadamore
* @compile Pos07.java
*
*/
class Pos07 {
static class Foo<X extends Number & Comparable<Number>> {}
static class DoubleFoo<X extends Number & Comparable<Number>,
Y extends Number & Comparable<Number>> {}
static class TripleFoo<X extends Number & Comparable<Number>,
Y extends Number & Comparable<Number>,
Z> {}
Foo<?> fw = new Foo<>();
DoubleFoo<?,?> dw = new DoubleFoo<>();
TripleFoo<?,?,?> tw = new TripleFoo<>();
}
| 1,694 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Pos05.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/pos/Pos05.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6939620 7020044
*
* @summary Check that 'complex' inference sometimes works in method context
* @author mcimadamore
* @compile Pos05.java
*
*/
public class Pos05 {
static class Foo<X> {
Foo(X x) {}
}
void m(Foo<Integer> fi) {}
void test() {
m(new Foo<>(1));
}
}
| 1,387 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Pos06.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/pos/Pos06.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6939620 6894753 7020044
*
* @summary Diamond and subtyping
* @author mcimadamore
* @compile Pos06.java
*
*/
class Pos06 {
static class Foo<X> {
Foo(X x) { }
}
static class DoubleFoo<X,Y> {
DoubleFoo(X x,Y y) { }
}
static class TripleFoo<X,Y,Z> {
TripleFoo(X x,Y y,Z z) { }
}
Foo<? extends Integer> fi = new Foo<>(1);
Foo<?> fw = new Foo<>(fi);
Foo<? extends Double> fd = new Foo<>(3.0);
DoubleFoo<?,?> dw = new DoubleFoo<>(fi,fd);
Foo<String> fs = new Foo<>("one");
TripleFoo<?,?,?> tw = new TripleFoo<>(fi,fd,fs);
}
| 1,675 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Pos02.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/pos/Pos02.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6939620 7020044
*
* @summary basic test for diamond (simple/qualified type-expressions)
* @author mcimadamore
* @compile Pos02.java
* @run main Pos02
*/
public class Pos02 {
static class Foo<X> {
Foo(X x) {}
<Z> Foo(X x, Z z) {}
}
void testSimple() {
Foo<Integer> f1 = new Foo<>(1);
Foo<? extends Integer> f2 = new Foo<>(1);
Foo<?> f3 = new Foo<>(1);
Foo<? super Integer> f4 = new Foo<>(1);
Foo<Integer> f5 = new Foo<>(1, "");
Foo<? extends Integer> f6 = new Foo<>(1, "");
Foo<?> f7 = new Foo<>(1, "");
Foo<? super Integer> f8 = new Foo<>(1, "");
}
void testQualified() {
Foo<Integer> f1 = new Pos02.Foo<>(1);
Foo<? extends Integer> f2 = new Pos02.Foo<>(1);
Foo<?> f3 = new Pos02.Foo<>(1);
Foo<? super Integer> f4 = new Pos02.Foo<>(1);
Foo<Integer> f5 = new Pos02.Foo<>(1, "");
Foo<? extends Integer> f6 = new Pos02.Foo<>(1, "");
Foo<?> f7 = new Pos02.Foo<>(1, "");
Foo<? super Integer> f8 = new Pos02.Foo<>(1, "");
}
public static void main(String[] args) {
Pos02 p2 = new Pos02();
p2.testSimple();
p2.testQualified();
}
}
| 2,316 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Pos01.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/pos/Pos01.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6939620 7020044
*
* @summary basic test for diamond (generic/non-generic constructors)
* @author mcimadamore
* @compile Pos01.java
* @run main Pos01
*
*/
public class Pos01<X> {
Pos01(X x) {}
<Z> Pos01(X x, Z z) {}
void test() {
Pos01<Integer> p1 = new Pos01<>(1);
Pos01<? extends Integer> p2 = new Pos01<>(1);
Pos01<?> p3 = new Pos01<>(1);
Pos01<? super Integer> p4 = new Pos01<>(1);
Pos01<Integer> p5 = new Pos01<>(1, "");
Pos01<? extends Integer> p6 = new Pos01<>(1, "");
Pos01<?> p7 = new Pos01<>(1, "");
Pos01<? super Integer> p8 = new Pos01<>(1, "");
}
public static void main(String[] args) {
Pos01<String> p1 = new Pos01<>("");
p1.test();
}
}
| 1,847 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
GenericConstructorAndDiamondTest.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/7030150/GenericConstructorAndDiamondTest.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7030150 7039931
* @summary Type inference for generic instance creation failed for formal type parameter
*/
import com.sun.source.util.JavacTask;
import java.net.URI;
import java.util.Arrays;
import javax.tools.Diagnostic;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
public class GenericConstructorAndDiamondTest {
enum BoundKind {
NO_BOUND(""),
STRING_BOUND("extends String"),
INTEGER_BOUND("extends Integer");
String boundStr;
private BoundKind(String boundStr) {
this.boundStr = boundStr;
}
boolean matches(TypeArgumentKind tak) {
switch (tak) {
case NONE: return true;
case STRING: return this != INTEGER_BOUND;
case INTEGER: return this != STRING_BOUND;
default: return false;
}
}
}
enum ConstructorKind {
NON_GENERIC("Foo(Object o) {}"),
GENERIC_NO_BOUND("<T> Foo(T t) {}"),
GENERIC_STRING_BOUND("<T extends String> Foo(T t) {}"),
GENERIC_INTEGER_BOUND("<T extends Integer> Foo(T t) {}");
String constrStr;
private ConstructorKind(String constrStr) {
this.constrStr = constrStr;
}
boolean matches(ArgumentKind ak) {
switch (ak) {
case STRING: return this != GENERIC_INTEGER_BOUND;
case INTEGER: return this != GENERIC_STRING_BOUND;
default: return false;
}
}
}
enum TypeArgArity {
ONE(1),
TWO(2),
THREE(3);
int n;
private TypeArgArity(int n) {
this.n = n;
}
}
enum TypeArgumentKind {
NONE(""),
STRING("String"),
INTEGER("Integer");
String typeargStr;
private TypeArgumentKind(String typeargStr) {
this.typeargStr = typeargStr;
}
String getArgs(TypeArgArity arity) {
if (this == NONE) return "";
else {
StringBuilder buf = new StringBuilder();
String sep = "";
for (int i = 0 ; i < arity.n ; i++) {
buf.append(sep);
buf.append(typeargStr);
sep = ",";
}
return "<" + buf.toString() + ">";
}
}
boolean matches(ArgumentKind ak) {
switch (ak) {
case STRING: return this != INTEGER;
case INTEGER: return this != STRING;
default: return false;
}
}
boolean matches(TypeArgumentKind other) {
switch (other) {
case STRING: return this != INTEGER;
case INTEGER: return this != STRING;
default: return true;
}
}
}
enum ArgumentKind {
STRING("\"\""),
INTEGER("1");
String argStr;
private ArgumentKind(String argStr) {
this.argStr = argStr;
}
}
public static void main(String... args) throws Exception {
//create default shared JavaCompiler - reused across multiple compilations
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
for (BoundKind boundKind : BoundKind.values()) {
for (ConstructorKind constructorKind : ConstructorKind.values()) {
for (TypeArgumentKind declArgKind : TypeArgumentKind.values()) {
for (TypeArgArity arity : TypeArgArity.values()) {
for (TypeArgumentKind useArgKind : TypeArgumentKind.values()) {
for (TypeArgumentKind diamondArgKind : TypeArgumentKind.values()) {
for (ArgumentKind argKind : ArgumentKind.values()) {
new GenericConstructorAndDiamondTest(boundKind, constructorKind,
declArgKind, arity, useArgKind, diamondArgKind, argKind).run(comp, fm);
}
}
}
}
}
}
}
}
BoundKind boundKind;
ConstructorKind constructorKind;
TypeArgumentKind declTypeArgumentKind;
TypeArgArity useTypeArgArity;
TypeArgumentKind useTypeArgumentKind;
TypeArgumentKind diamondTypeArgumentKind;
ArgumentKind argumentKind;
JavaSource source;
DiagnosticChecker diagChecker;
GenericConstructorAndDiamondTest(BoundKind boundKind, ConstructorKind constructorKind,
TypeArgumentKind declTypeArgumentKind, TypeArgArity useTypeArgArity,
TypeArgumentKind useTypeArgumentKind, TypeArgumentKind diamondTypeArgumentKind,
ArgumentKind argumentKind) {
this.boundKind = boundKind;
this.constructorKind = constructorKind;
this.declTypeArgumentKind = declTypeArgumentKind;
this.useTypeArgArity = useTypeArgArity;
this.useTypeArgumentKind = useTypeArgumentKind;
this.diamondTypeArgumentKind = diamondTypeArgumentKind;
this.argumentKind = argumentKind;
this.source = new JavaSource();
this.diagChecker = new DiagnosticChecker();
}
class JavaSource extends SimpleJavaFileObject {
String template = "class Foo<X #BK> {\n" +
"#CK\n" +
"}\n" +
"class Test {\n" +
"void test() {\n" +
"Foo#TA1 f = new #TA2 Foo<#TA3>(#A);\n" +
"}\n" +
"}\n";
String source;
public JavaSource() {
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
source = template.replace("#BK", boundKind.boundStr).
replace("#CK", constructorKind.constrStr)
.replace("#TA1", declTypeArgumentKind.getArgs(TypeArgArity.ONE))
.replace("#TA2", useTypeArgumentKind.getArgs(useTypeArgArity))
.replace("#TA3", diamondTypeArgumentKind.typeargStr)
.replace("#A", argumentKind.argStr);
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
return source;
}
}
void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
null, null, Arrays.asList(source));
ct.analyze();
check();
}
void check() {
boolean badActual = !constructorKind.matches(argumentKind);
boolean badArity = constructorKind != ConstructorKind.NON_GENERIC &&
useTypeArgumentKind != TypeArgumentKind.NONE &&
useTypeArgArity != TypeArgArity.ONE;
boolean badMethodTypeArg = constructorKind != ConstructorKind.NON_GENERIC &&
!useTypeArgumentKind.matches(argumentKind);
boolean badExplicitParams = (useTypeArgumentKind != TypeArgumentKind.NONE &&
diamondTypeArgumentKind == TypeArgumentKind.NONE) ||
!boundKind.matches(diamondTypeArgumentKind);
boolean badGenericType = !boundKind.matches(declTypeArgumentKind) ||
!diamondTypeArgumentKind.matches(declTypeArgumentKind);
boolean shouldFail = badActual || badArity ||
badMethodTypeArg || badExplicitParams || badGenericType;
if (shouldFail != diagChecker.errorFound) {
throw new Error("invalid diagnostics for source:\n" +
source.getCharContent(true) +
"\nFound error: " + diagChecker.errorFound +
"\nExpected error: " + shouldFail);
}
}
static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
boolean errorFound;
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
errorFound = true;
}
}
}
}
| 9,507 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6996914b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/6996914/T6996914b.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6996914 7020044
* @summary Diamond inference: problem when accessing protected constructor
* @compile T6996914b.java
*/
class Super<X,Y> {
private Super(Integer i, Y y, X x) {}
public Super(Number n, X x, Y y) {}
}
class Test {
Super<String,Integer> ssi1 = new Super<>(1, "", 2);
}
| 1,378 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6996914a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/6996914/T6996914a.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6996914 7020044
* @summary Diamond inference: problem when accessing protected constructor
* @run main T6996914a
*/
import com.sun.source.util.JavacTask;
import java.net.URI;
import java.util.Arrays;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticListener;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;
import javax.tools.ToolProvider;
public class T6996914a {
enum PackageKind {
DEFAULT("", ""),
A("package a;", "import a.*;");
String pkgDecl;
String importDecl;
PackageKind(String pkgDecl, String importDecl) {
this.pkgDecl = pkgDecl;
this.importDecl = importDecl;
}
}
enum ConstructorKind {
PACKAGE(""),
PROTECTED("protected"),
PRIVATE("private"),
PUBLIC("public");
String mod;
ConstructorKind(String mod) {
this.mod = mod;
}
}
static class FooClass extends SimpleJavaFileObject {
final static String sourceStub =
"#P\n" +
"public class Foo<X> {\n" +
" #M Foo() {}\n" +
"}\n";
String source;
public FooClass(PackageKind pk, ConstructorKind ck) {
super(URI.create("myfo:/" + (pk != PackageKind.DEFAULT ? "a/Foo.java" : "Foo.java")),
JavaFileObject.Kind.SOURCE);
source = sourceStub.replace("#P", pk.pkgDecl).replace("#M", ck.mod);
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
return source;
}
}
static class ClientClass extends SimpleJavaFileObject {
final static String sourceStub =
"#I\n" +
"class Test {\n" +
" Foo<String> fs = new Foo<>();\n" +
"}\n";
String source;
public ClientClass(PackageKind pk) {
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
source = sourceStub.replace("#I", pk.importDecl);
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
return source;
}
}
public static void main(String... args) throws Exception {
for (PackageKind pk : PackageKind.values()) {
for (ConstructorKind ck : ConstructorKind.values()) {
compileAndCheck(pk, ck);
}
}
}
static void compileAndCheck(PackageKind pk, ConstructorKind ck) throws Exception {
FooClass foo = new FooClass(pk, ck);
ClientClass client = new ClientClass(pk);
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
ErrorListener el = new ErrorListener();
JavacTask ct = (JavacTask)tool.getTask(null, null, el,
null, null, Arrays.asList(foo, client));
ct.analyze();
if (el.errors > 0 == check(pk, ck)) {
String msg = el.errors > 0 ?
"Error compiling files" :
"No error when compiling files";
throw new AssertionError(msg + ": \n" + foo.source + "\n" + client.source);
}
}
static boolean check(PackageKind pk, ConstructorKind ck) {
switch (pk) {
case A: return ck == ConstructorKind.PUBLIC;
case DEFAULT: return ck != ConstructorKind.PRIVATE;
default: throw new AssertionError("Unknown package kind");
}
}
/**
* DiagnosticListener to count any errors that occur
*/
private static class ErrorListener implements DiagnosticListener<JavaFileObject> {
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
switch (diagnostic.getKind()) {
case ERROR:
errors++;
}
}
int errors;
}
}
| 5,078 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7057297.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/7057297/T7057297.java | /*
* @test /nodynamiccopyright/
* @bug 7057297
*
* @summary Project Coin: diamond erroneously accepts in array initializer expressions
* @compile/fail/ref=T7057297.out T7057297.java -XDrawDiagnostics
*
*/
class T7205797<X> {
class Inner<Y> {}
T7205797<String>[] o1 = new T7205797<>[1]; //error
T7205797<String>[] o2 = new T7205797<>[1][1]; //error
T7205797<String>[] o3 = new T7205797<>[1][1][1]; //error
T7205797<String>[] o4 = new T7205797<>[] { }; //error
T7205797<String>[] o5 = new T7205797<>[][] { }; //error
T7205797<String>[] o6 = new T7205797<>[][][] { }; //error
T7205797<String>.Inner<String>[] o1 = new T7205797<String>.Inner<>[1]; //error
T7205797<String>.Inner<String>[] o2 = new T7205797<String>.Inner<>[1][1]; //error
T7205797<String>.Inner<String>[] o3 = new T7205797<String>.Inner<>[1][1][1]; //error
T7205797<String>.Inner<String>[] o4 = new T7205797<String>.Inner<>[] { }; //error
T7205797<String>.Inner<String>[] o5 = new T7205797<String>.Inner<>[][] { }; //error
T7205797<String>.Inner<String>[] o6 = new T7205797<String>.Inner<>[][][] { }; //error
}
| 1,138 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg01.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg01.java | /*
* @test /nodynamiccopyright/
* @bug 6939620 7020044
*
* @summary Check that diamond fails when inference violates declared bounds
* (basic test with nested class, generic/non-generic constructors)
* @author mcimadamore
* @compile/fail/ref=Neg01.out Neg01.java -XDrawDiagnostics
*
*/
class Neg01<X extends Number> {
Neg01(X x) {}
<Z> Neg01(X x, Z z) {}
void test() {
Neg01<String> n1 = new Neg01<>("");
Neg01<? extends String> n2 = new Neg01<>("");
Neg01<?> n3 = new Neg01<>("");
Neg01<? super String> n4 = new Neg01<>("");
Neg01<String> n5 = new Neg01<>("", "");
Neg01<? extends String> n6 = new Neg01<>("", "");
Neg01<?> n7 = new Neg01<>("", "");
Foo<? super String> n8 = new Neg01<>("", "");
}
}
| 806 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg11.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg11.java | /*
* @test /nodynamiccopyright/
* @bug 6939620 7020044
*
* @summary Check that unresolved symbols doesn't cause spurious diamond diagnostics
* @author mcimadamore
* @compile/fail/ref=Neg11.out Neg11.java -XDrawDiagnostics
*
*/
class Neg11 {
void test() {
class Foo<X extends Number> { }
Foo<?> f1 = new UndeclaredName<>(); //this is deliberate: aim is to test erroneous path
Foo<?> f2 = new UndeclaredName<>() {}; //this is deliberate: aim is to test erroneous path
}
}
| 513 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg03.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg03.java | /*
* @test /nodynamiccopyright/
* @bug 6939620 7020044
*
* @summary Check that diamond fails when inference violates declared bounds
* (test with inner class, qualified/simple type expressions)
* @author mcimadamore
* @compile/fail/ref=Neg03.out Neg03.java -XDrawDiagnostics
*
*/
class Neg03<U> {
class Foo<V extends Number> {
Foo(V x) {}
<Z> Foo(V x, Z z) {}
}
void testSimple() {
Foo<String> f1 = new Foo<>("");
Foo<? extends String> f2 = new Foo<>("");
Foo<?> f3 = new Foo<>("");
Foo<? super String> f4 = new Foo<>("");
Foo<String> f5 = new Foo<>("", "");
Foo<? extends String> f6 = new Foo<>("", "");
Foo<?> f7 = new Foo<>("", "");
Foo<? super String> f8 = new Foo<>("", "");
}
void testQualified_1() {
Foo<String> f1 = new Neg03<U>.Foo<>("");
Foo<? extends String> f2 = new Neg03<U>.Foo<>("");
Foo<?> f3 = new Neg03<U>.Foo<>("");
Foo<? super String> f4 = new Neg03<U>.Foo<>("");
Foo<String> f5 = new Neg03<U>.Foo<>("", "");
Foo<? extends String> f6 = new Neg03<U>.Foo<>("", "");
Foo<?> f7 = new Neg03<U>.Foo<>("", "");
Foo<? super String> f8 = new Neg03<U>.Foo<>("", "");
}
void testQualified_2(Neg03<U> n) {
Foo<String> f1 = n.new Foo<>("");
Foo<? extends String> f2 = n.new Foo<>("");
Foo<?> f3 = n.new Foo<>("");
Foo<? super String> f4 = n.new Foo<>("");
Foo<String> f5 = n.new Foo<>("", "");
Foo<? extends String> f6 = n.new Foo<>("", "");
Foo<?> f7 = n.new Foo<>("", "");
Foo<? super String> f8 = n.new Foo<>("", "");
}
}
| 1,700 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg02.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg02.java | /*
* @test /nodynamiccopyright/
* @bug 6939620 7020044
*
* @summary Check that diamond fails when inference violates declared bounds
* (test with nested class, qualified/simple type expressions)
* @author mcimadamore
* @compile/fail/ref=Neg02.out Neg02.java -XDrawDiagnostics
*
*/
class Neg02 {
static class Foo<X extends Number> {
Foo(X x) {}
<Z> Foo(X x, Z z) {}
}
void testSimple() {
Foo<String> f1 = new Foo<>("");
Foo<? extends String> f2 = new Foo<>("");
Foo<?> f3 = new Foo<>("");
Foo<? super String> f4 = new Foo<>("");
Foo<String> f5 = new Foo<>("", "");
Foo<? extends String> f6 = new Foo<>("", "");
Foo<?> f7 = new Foo<>("", "");
Foo<? super String> f8 = new Foo<>("", "");
}
void testQualified() {
Foo<String> f1 = new Neg02.Foo<>("");
Foo<? extends String> f2 = new Neg02.Foo<>("");
Foo<?> f3 = new Neg02.Foo<>("");
Foo<? super String> f4 = new Neg02.Foo<>("");
Foo<String> f5 = new Neg02.Foo<>("", "");
Foo<? extends String> f6 = new Neg02.Foo<>("", "");
Foo<?> f7 = new Neg02.Foo<>("", "");
Foo<? super String> f8 = new Neg02.Foo<>("", "");
}
}
| 1,254 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg04.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg04.java | /*
* @test /nodynamiccopyright/
* @bug 6939620 7020044
*
* @summary Check that diamond fails when inference violates declared bounds
* (test with local class, qualified/simple type expressions)
* @author mcimadamore
* @compile/fail/ref=Neg04.out Neg04.java -XDrawDiagnostics
*
*/
class Neg04 {
void test() {
class Foo<V extends Number> {
Foo(V x) {}
<Z> Foo(V x, Z z) {}
}
Foo<String> n1 = new Foo<>("");
Foo<? extends String> n2 = new Foo<>("");
Foo<?> n3 = new Foo<>("");
Foo<? super String> n4 = new Foo<>("");
Foo<String> n5 = new Foo<>("", "");
Foo<? extends String> n6 = new Foo<>("", "");
Foo<?> n7 = new Foo<>("", "");
Foo<? super String> n8 = new Foo<>("", "");
}
}
| 810 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg05.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg05.java | /*
* @test /nodynamiccopyright/
* @bug 6939620 7020044
*
* @summary Check that usage of rare types doesn't cause spurious diamond diagnostics
* @author mcimadamore
* @compile/fail/ref=Neg05.out Neg05.java -XDrawDiagnostics
*
*/
class Neg05<U> {
class Foo<V> {
Foo(V x) {}
<Z> Foo(V x, Z z) {}
}
void testRare_1() {
Neg05<?>.Foo<String> f1 = new Neg05.Foo<>("");
Neg05<?>.Foo<? extends String> f2 = new Neg05.Foo<>("");
Neg05<?>.Foo<?> f3 = new Neg05.Foo<>("");
Neg05<?>.Foo<? super String> f4 = new Neg05.Foo<>("");
Neg05<?>.Foo<String> f5 = new Neg05.Foo<>("", "");
Neg05<?>.Foo<? extends String> f6 = new Neg05.Foo<>("", "");
Neg05<?>.Foo<?> f7 = new Neg05.Foo<>("", "");
Neg05<?>.Foo<? super String> f8 = new Neg05.Foo<>("", "");
}
void testRare_2(Neg05 n) {
Neg05<?>.Foo<String> f1 = n.new Foo<>("");
Neg05<?>.Foo<? extends String> f2 = n.new Foo<>("");
Neg05<?>.Foo<?> f3 = n.new Foo<>("");
Neg05<?>.Foo<? super String> f4 = n.new Foo<>("");
Neg05<?>.Foo<String> f5 = n.new Foo<>("", "");
Neg05<?>.Foo<? extends String> f6 = n.new Foo<>("", "");
Neg05<?>.Foo<?> f7 = n.new Foo<>("", "");
Neg05<?>.Foo<? super String> f8 = n.new Foo<>("", "");
}
}
| 1,335 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg09.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg09.java | /*
* @test /nodynamiccopyright/
* @bug 7020044
*
* @summary Check that diamond is not allowed with anonymous inner class expressions
* @author Maurizio Cimadamore
* @compile/fail/ref=Neg09.out Neg09.java -XDrawDiagnostics
*
*/
class Neg09 {
class Member<X> {}
static class Nested<X> {}
void testSimple() {
Member<?> m1 = new Member<>() {};
Nested<?> m2 = new Nested<>() {};
}
void testQualified() {
Member<?> m1 = this.new Member<>() {};
Nested<?> m2 = new Neg09.Nested<>() {};
}
}
| 551 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg06.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg06.java | /*
* @test /nodynamiccopyright/
* @bug 6939620 7020044
*
* @summary Check that diamond works where LHS is supertype of RHS (nilary constructor)
* @author mcimadamore
* @compile/fail/ref=Neg06.out Neg06.java -XDrawDiagnostics
*
*/
class Neg06 {
static class CSuperFoo<X> {}
static class CFoo<X extends Number> extends CSuperFoo<X> {}
CSuperFoo<String> csf1 = new CFoo<>();
}
| 395 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg07.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg07.java | /*
* @test /nodynamiccopyright/
* @bug 6939620 7020044
*
* @summary Check that diamond works where LHS is supertype of RHS (1-ary constructor)
* @author mcimadamore
* @compile/fail/ref=Neg07.out Neg07.java -XDrawDiagnostics
*
*/
class Neg07 {
static class SuperFoo<X> {}
static class Foo<X extends Number> extends SuperFoo<X> {
Foo(X x) {}
}
SuperFoo<String> sf1 = new Foo<>("");
}
| 412 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg10.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg10.java | /*
* @test /nodynamiccopyright/
* @bug 6939620 7020044
*
* @summary Check that 'complex' diamond can infer type that is too specific
* @author mcimadamore
* @compile/fail/ref=Neg10.out Neg10.java -XDrawDiagnostics
*
*/
class Neg10 {
static class Foo<X> {
Foo(X x) {}
}
Foo<Number> fw = new Foo<>(1);
}
| 333 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg08.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/neg/Neg08.java | /*
* @test /nodynamiccopyright/
* @bug 7020043 7020044
*
* @summary Check that diamond is not allowed with non-generic class types
* @author Rémi Forax
* @compile/fail/ref=Neg08.out Neg08.java -XDrawDiagnostics
*
*/
class Neg08 {
public static void main(String[] args) {
String s = new String<>("foo");
}
}
| 335 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7030687.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/7030687/T7030687.java | /*
* @test /nodynamiccopyright/
* @bug 7030687
* @summary Diamond: compiler accepts erroneous code where diamond is used with non-generic inner class
* @compile/fail/ref=T7030687.out -XDrawDiagnostics T7030687.java
*/
class T7030687<X> {
class Member { }
static class Nested {}
void test() {
class Local {}
Member m = new Member<>();
Nested n = new Nested<>();
Local l = new Local<>();
}
}
| 446 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
ParserTest.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/7030687/ParserTest.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7030687
* @summary Diamond: compiler accepts erroneous code where diamond is used with non-generic inner class
*/
import com.sun.source.util.JavacTask;
import java.net.URI;
import java.util.Arrays;
import javax.tools.Diagnostic;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
public class ParserTest {
enum TypeArgumentKind {
NONE(""),
EXPLICIT("<String>"),
DIAMOND("<>");
String typeargStr;
private TypeArgumentKind(String typeargStr) {
this.typeargStr = typeargStr;
}
}
enum TypeQualifierArity {
ONE(1, "A1#TA1"),
TWO(2, "A1#TA1.A2#TA2"),
THREE(3, "A1#TA1.A2#TA2.A3#TA3"),
FOUR(4, "A1#TA1.A2#TA2.A3#TA3.A4#TA4");
int n;
String qualifierStr;
private TypeQualifierArity(int n, String qualifierStr) {
this.n = n;
this.qualifierStr = qualifierStr;
}
String getType(TypeArgumentKind... typeArgumentKinds) {
String res = qualifierStr;
for (int i = 1 ; i <= typeArgumentKinds.length ; i++) {
res = res.replace("#TA" + i, typeArgumentKinds[i-1].typeargStr);
}
return res;
}
}
public static void main(String... args) throws Exception {
//create default shared JavaCompiler - reused across multiple compilations
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
for (TypeQualifierArity arity : TypeQualifierArity.values()) {
for (TypeArgumentKind tak1 : TypeArgumentKind.values()) {
if (arity == TypeQualifierArity.ONE) {
new ParserTest(arity, tak1).run(comp, fm);
continue;
}
for (TypeArgumentKind tak2 : TypeArgumentKind.values()) {
if (arity == TypeQualifierArity.TWO) {
new ParserTest(arity, tak1, tak2).run(comp, fm);
continue;
}
for (TypeArgumentKind tak3 : TypeArgumentKind.values()) {
if (arity == TypeQualifierArity.THREE) {
new ParserTest(arity, tak1, tak2, tak3).run(comp, fm);
continue;
}
for (TypeArgumentKind tak4 : TypeArgumentKind.values()) {
new ParserTest(arity, tak1, tak2, tak3, tak4).run(comp, fm);
}
}
}
}
}
}
TypeQualifierArity qualifierArity;
TypeArgumentKind[] typeArgumentKinds;
JavaSource source;
DiagnosticChecker diagChecker;
ParserTest(TypeQualifierArity qualifierArity, TypeArgumentKind... typeArgumentKinds) {
this.qualifierArity = qualifierArity;
this.typeArgumentKinds = typeArgumentKinds;
this.source = new JavaSource();
this.diagChecker = new DiagnosticChecker();
}
class JavaSource extends SimpleJavaFileObject {
String template = "class Test {\n" +
"R res = new #T();\n" +
"}\n";
String source;
public JavaSource() {
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
source = template.replace("#T", qualifierArity.getType(typeArgumentKinds));
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
return source;
}
}
void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
null, null, Arrays.asList(source));
ct.parse();
check();
}
void check() {
boolean errorExpected = false;
for (int i = 0 ; i < qualifierArity.n - 1 ; i++) {
if (typeArgumentKinds[i] == TypeArgumentKind.DIAMOND) {
errorExpected = true;
break;
}
}
if (errorExpected != diagChecker.errorFound) {
throw new Error("invalid diagnostics for source:\n" +
source.getCharContent(true) +
"\nFound error: " + diagChecker.errorFound +
"\nExpected error: " + errorExpected);
}
}
static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
boolean errorFound;
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
errorFound = true;
}
}
}
}
| 5,997 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7002837.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/diamond/7002837/T7002837.java | /*
* @test /nodynamiccopyright/
* @bug 7002837
*
* @summary Diamond: javac generates diamond inference errors when in 'finder' mode
* @author mcimadamore
* @compile -Werror -XDfindDiamond T7002837.java
*
*/
class T7002837<X extends java.io.Serializable & Comparable<?>> {
T7002837() {}
{ new T7002837<Integer>(); }
}
| 335 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6192945/Neg.java | /*
* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class Neg<A extends B, B extends A> {
}
| 1,105 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6192945.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6192945/T6192945.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 6192945
* @summary Declaration order of interdependent generic types should not matter
* @compile T6192945.java
*/
public class T6192945<E extends D, D> {}
| 1,236 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6192945/Neg2.java | /*
* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class Neg2<A extends D, D extends E, E extends B, B extends C, C extends C1, C1 extends B> {
}
| 1,160 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Neg3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6192945/Neg3.java | /*
* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class Neg3<A extends B & C, B extends A, C extends A> {
}
| 1,123 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
MethodNeg.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6192945/MethodNeg.java | /*
* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class MethodNeg {
<A extends D, D extends E, E extends B, B extends C, C extends C1, C1 extends B> void m(E e, D d) {
m(e, d);
m(null, null);
}
}
| 1,235 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Method.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6192945/Method.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 6192945
* @summary Declaration order of interdependent generic types should not matter
* @author Peter von der Ah\u00e9
* @compile Method.java
*/
public class Method {
<E extends D, D> void m(E e, D d) {
m(e, d);
m(null, null);
}
}
| 1,338 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7007615.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/7007615/T7007615.java | /*
* @test /nodynamiccopyright/
* @bug 7007615
* @summary java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
* @author mcimadamore
* @compile/fail/ref=T7007615.out -XDrawDiagnostics T7007615.java
*/
class T6985719a {
class AX<T extends Number> {
void foo(T t) { }
}
class BX<S extends Integer> extends AX<S> {
@Override
void foo(S t) { }
void bar(BX bx){}
}
class DX extends BX<Integer> {
void foo(Number t) { }
void bar(BX<?> bx) { }
@Override
void foo(Integer t) { }
}
}
| 594 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AccessibilityCheck02.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/7007615/acc2/AccessibilityCheck02.java | /*
* @test /nodynamiccopyright/
* @bug 7007615
* @summary java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
* @author dlsmith
* @compile/fail/ref=AccessibilityCheck02.out -XDrawDiagnostics AccessibilityCheck02.java
*/
public class AccessibilityCheck02 extends p2.E {
String m(Object o) { return "hi"; } // this is okay
public int m(String s) { return 3; } // this overrides m(String) illegally
}
| 432 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
C.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/7007615/acc2/p1/C.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p1;
public class C<T> { void m(T arg) { } /* implicit: m(Object) */ }
| 1,130 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
D.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/7007615/acc2/p1/D.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p1;
public class D extends C<String> { public void m(String arg) {} /* implicit bridge: m(Object) */ }
| 1,163 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
E.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/7007615/acc2/p2/E.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p2;
public class E extends p1.D { /* inherits m(String) but not m(Object) */ }
| 1,139 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AccessibilityCheck01.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/7007615/acc1/AccessibilityCheck01.java | /*
* @test /nodynamiccopyright/
* @bug 7007615
* @summary java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
* @author dlsmith
* @compile AccessibilityCheck01.java
*/
public class AccessibilityCheck01 extends p2.E {
String m(Object o) { return "hi"; } // this is okay
int m(String s) { return 3; } // this overrides m(String) illegally
}
| 372 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
C.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/7007615/acc1/p1/C.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p1;
public class C<T> { void m(T arg) { } /* implicit: m(Object) */ }
| 1,130 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
D.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/7007615/acc1/p1/D.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p1;
public class D<T> extends C<T> { /* inherits m(T), implicit m(Object) */ }
| 1,139 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
E.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/7007615/acc1/p2/E.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p2;
public class E<T> extends p1.D<T> { /* inherits nothing */ }
| 1,125 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6356636.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6356636/T6356636.java | /*
* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6356636
* @summary Compiler fails to read signatures of inner classes with non-generic outer instance leading to crash
* @compile a/AbstractFoo.java a/Bar.java
* @compile T6356636.java
*/
import a.*;
public final class T6356636 extends AbstractFoo implements Bar {
public InnerFoo<String> getInnerFoo() {
return null;
}
}
| 1,426 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AbstractFoo.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6356636/a/AbstractFoo.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 AbstractFoo {
public class InnerFoo<T> {}
}
| 1,125 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Bar.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6356636/a/Bar.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;
import a.AbstractFoo.InnerFoo;
public interface Bar {
InnerFoo<String> getInnerFoo();
}
| 1,157 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6182950c.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6182950/T6182950c.java | /*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6182950
* @summary methods clash algorithm should not depend on return type
* @author mcimadamore
* @compile T6182950c.java
*/
class T6182950c {
static abstract class A<X> {
abstract Object m(X x);
}
static abstract class B<X> extends A<X> {
Number m(X x) {return 0;}
}
final static class C<X> extends B<X> {
Integer m(X x) {return 0;}
}
}
| 1,472 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6182950a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6182950/T6182950a.java | /*
* @test /nodynamiccopyright/
* @bug 6182950
* @summary methods clash algorithm should not depend on return type
* @author mcimadamore
* @compile/fail/ref=T6182950a.out -XDrawDiagnostics T6182950a.java
*/
import java.util.List;
class T6182950a {
int m(List<String> l) {return 0;}
double m(List<Integer> l) {return 0;}
}
| 342 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6182950b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6182950/T6182950b.java | /*
* @test /nodynamiccopyright/
* @bug 6182950
* @summary methods clash algorithm should not depend on return type
* @author mcimadamore
* @compile/fail/ref=T6182950b.out -XDrawDiagnostics T6182950b.java
*/
import java.util.List;
class T6182950b {
static class A {
int m(List<String> l) {return 0;}
}
static class B extends A {
double m(List<Integer> l) {return 0;}
}
}
| 414 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare10.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare10.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile Rare10.java
*/
package rare10;
class A {
class B {
Object t;
}
static class C {
{
B b = null;
b.t = "foo";
}
}
}
| 1,320 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare6.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare6.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile/fail Rare6.java
*/
package rare6;
class A<T> {
class B<U> {
T t;
}
static class C {
{
B b = null; // static error
// b.t = "foo";
}
}
}
| 1,343 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare8.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare8.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile Rare8.java
*/
package rare8;
class A<T> {
class B {}
}
class C extends A {
static class D {
{
B b;
}
}
}
| 1,288 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare2.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile/fail Rare2.java
*/
package rare2;
class A<T> {
class B<U> {
}
static class C<V> {
}
}
class Main {
A<String>.B ab1;
}
| 1,281 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare1.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile Rare1.java
*/
package rare1;
class A<T> {
class B<U> {
}
static class C<V> {
}
}
class Main {
A<String>.B<Integer> ab1;
A.B ab2;
A.C<String> ac1;
A.C ac2;
}
| 1,332 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare5.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare5.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile/fail Rare5.java
*/
package rare5;
class A<T> {
class B<U> {
}
static class C<V> {
}
}
class Main {
A<String>.C ac2;
}
| 1,281 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare3.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile/fail Rare3.java
*/
package rare3;
class A<T> {
class B<U> {
}
static class C<V> {
}
}
class Main {
A.B<String> ab2;
}
| 1,281 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare9.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare9.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile Rare9.java
*/
package rare9;
class A<T> {
class B {
public T rett() { return null; }
}
}
class C extends A<String> {
static class D {
{
B b = null;
String s = b.rett();
}
}
}
| 1,382 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare11.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare11.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile Rare11.java
*/
package rare11;
class A {
class B {
}
}
class C<T> extends A {
static class D {
B b;
}
}
| 1,271 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare7.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare7.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile/fail Rare7.java
*/
package rare7;
class A<T> {
class B<U> {
T t;
}
static class C {
{
B<String> b = null;
}
}
}
| 1,307 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Rare4.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/Rare4.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 5024308
* @summary "rare" types
* @author gafter
*
* @compile/fail Rare4.java
*/
package rare4;
class A<T> {
class B<U> {
}
static class C<V> {
}
}
class Main {
A<String>.C<String> ac1;
}
| 1,289 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6665356.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/rare/6665356/T6665356.java | /*
* @test /nodynamiccopyright/
* @author Maurizio Cimadamore
* @bug 6665356
* @summary Cast not allowed when both qualifying type and inner class are parameterized
* @compile/fail/ref=T6665356.out -XDrawDiagnostics T6665356.java
*/
class T6665356 {
class Outer<S> {
class Inner<T> {}
}
void test1() {
boolean b;
b = null instanceof Outer.Inner;
b = null instanceof Outer<?>.Inner;
b = null instanceof Outer.Inner<?>;
b = null instanceof Outer<?>.Inner<?>;
}
void test2() {
boolean b;
Object o;
o = (Outer.Inner)null;
o = (Outer<?>.Inner)null;
o = (Outer.Inner<?>)null;
o = (Outer<?>.Inner<?>)null;
}
}
| 736 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6711619b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6711619/T6711619b.java | /*
* @test /nodynamiccopyright/
* @bug 6711619
*
* @summary javac doesn't allow access to protected members in intersection types
* @author Maurizio Cimadamore
*
* @compile/fail/ref=T6711619b.out -XDrawDiagnostics T6711619b.java
*/
class T6711619b {
static class X1<E extends X1<E>> {
private int i;
E e;
int f() {
return e.i;
}
}
static class X2<E extends X2<E>> {
static private int i;
int f() {
return E.i;
}
}
static class X3<E extends X3<E> & java.io.Serializable> {
private int i;
E e;
int f() {
return e.i;
}
}
static class X4<E extends X4<E> & java.io.Serializable> {
static private int i;
int f() {
return E.i;
}
}
}
| 848 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6711619a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6711619/T6711619a.java | /*
* @test /nodynamiccopyright/
* @bug 6711619
*
* @summary javac doesn't allow access to protected members in intersection types
* @author Maurizio Cimadamore
*
* @compile/fail/ref=T6711619a.out -XDrawDiagnostics T6711619a.java
*/
class T6711619a {
static class A {
private void a() {}
private A a;
}
static class B extends A {
private B b() {}
private B b;
}
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;
}
}
static void testMemberMethods(C<? extends A, ? extends I> arg) {
arg.t.a();
arg.t.b();
}
static void testMemberFields(C<? extends A, ? extends I> arg) {
A ta; B tb;
ta = arg.t.a;
tb = arg.t.b;
ta = arg.w.a;
tb = arg.w.b;
}
}
| 1,086 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6292765.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/6292765/T6292765.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 6292765
* @summary NPE at Check.checkCompatibleConcretes
* @author Peter von der Ah\u00e9
* @compile T6292765.java
*/
public class T6292765 {
static class A<T> {}
static class B<S> extends A< C<Object> > {}
static class C<S> extends B<S> {}
}
| 1,339 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7040883.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/T7040883.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7040883 7034511
* @summary Compilation error: "length in Array is defined in an inaccessible class or interface"
* @compile T7040883.java
*/
public class T7040883 {
<Z> Z[] getListeners(Class<Z> z) { return null; }
void test(String s) {
int i = getListeners(s.getClass()).length;
}
}
| 1,386 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6880344.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/T6880344.java | /*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6880344
* @summary Recursive type parameters do not compile
* @author mcimadamore
* @compile T6880344.java
*/
class T6880344 {
static class A<X1 extends G<X1>> {
public A<N<X1>> xyz;
}
static class N<X2 extends G<X2>> implements G<N<X2>> { }
interface G<X3 extends G<X3>> { }
}
| 1,392 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4856983a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/4856983/T4856983a.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 4856983
* @summary (crash) mutually f-bounded type vars with multiple bounds may crash javac
* @author Peter von der Ah\u00e9
* @compile/fail T4856983a.java
*/
interface I1 { Number m(); }
interface I2 { String m(); }
public class T4856983a {
<T extends I1 & I2> T f() { return null; }
}
| 1,377 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4856983.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/4856983/T4856983.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 4856983
* @summary (crash) mutually f-bounded type vars with multiple bounds may crash javac
* @author Peter von der Ah\u00e9
*
* @compile T4856983.java
*/
import java.lang.Comparable;
class A<X extends Number & Comparable<Y>, Y> {
A<Integer,Integer> a;
B<Y,X> b;
}
class B<Y, X extends Number & Comparable<Y>> {
A<X,Y> a;
B<Short,Short> b;
}
| 1,439 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4856983b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/4856983/T4856983b.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 4856983
* @summary (crash) mutually f-bounded type vars with multiple bounds may crash javac
* @author Peter von der Ah\u00e9
* @compile/fail T4856983b.java
*/
interface I1 { Number m(); }
interface I2 { String m(); }
public class T4856983b<T extends I1 & I2> {}
| 1,348 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6680106.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6680106/T6680106.java | /*
* @test /nodynamiccopyright/
* @bug 6680106
* @summary StackOverFlowError for Cyclic inheritance in TypeParameters with ArrayType Bounds
* @author Maurizio Cimadamore
* @compile/fail/ref=T6680106.out -XDrawDiagnostics T6680106.java
*/
class T6680106 {
class A0 {}
class A1<T extends T[]> {}
class A2<T extends S[], S extends T[]> {}
class A3<T extends S[], S extends U[], U extends T[]> {}
class A5<T extends A0 & T[]> {}
class A6<T extends A0 & S[], S extends A0 & T[]> {}
class A7<T extends A0 & S[], S extends A0 & U[], U extends A0 & T[]> {}
}
| 591 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6968793.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6968793/T6968793.java | /*
* @test /nodynamiccopyright/
* @bug 6968793
* @summary javac generates spourious diagnostics for ill-formed type-variable bounds
* @author mcimadamore
* @compile/fail/ref=T6968793.out -XDrawDiagnostics T6968793.java
*/
class T6968793<X extends Number, Y extends X, Z extends Object & Comparable<Y>> {
T6968793<Object, Object, Object> o;
}
| 358 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6569404b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6569404/T6569404b.java | /*
* @test /nodynamiccopyright/
* @bug 6569404
* @summary Regression: Cannot instantiate an inner class of a type variable
* @author mcimadamore
* @compile/fail/ref=T6569404b.out T6569404b.java -XDrawDiagnostics
*/
class T6569404b {
static class A<X> {}
static class B<T extends Outer> extends A<T.Inner> {}
static class Outer {
public class Inner {}
}
}
| 394 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6569404a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6569404/T6569404a.java | /*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6569404
* @summary Regression: Cannot instantiate an inner class of a type variable
* @author mcimadamore
*/
public class T6569404a {
static class Outer {
public class Inner {}
}
static class Test<T extends Outer> {
public Test(T t) {
Outer.Inner inner = t.new Inner();
}
}
public static void main(String[] args) {
new Test<Outer>(new Outer());
}
}
| 1,494 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6569404c.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6569404/T6569404c.java | /*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6569404
* @summary Regression: Cannot instantiate an inner class of a type variable
* @author mcimadamore
*/
public class T6569404c {
static class Outer {
class Inner {}
}
static class Test<X extends Outer> {
class InnerTest extends X.Inner { InnerTest(Outer o) {o.super();} }
}
public static void main(String[] args) {
new Test<Outer>().new InnerTest(new Outer());
}
}
| 1,498 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6804733.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6804733/T6804733.java | /*
* @test /nodynamiccopyright/
* @bug 6804733
* @summary javac generates spourious diagnostics for ill-formed type-variable bounds
* @author mcimadamore
* @compile/fail/ref=T6804733.out -XDrawDiagnostics T6804733.java
*/
import java.util.ArrayList;
class T6804733<S> extends ArrayList<S> {
<T extends S & S> void m() {}
}
| 339 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6182630e.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6182630/T6182630e.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.
*/
public class T6182630e {
static class Foo<X> {
public X x;
public void m(X x) { }
}
interface Bar {}
<T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
s.m("BAD");
}
}
| 1,273 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6182630f.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6182630/T6182630f.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.
*/
public class T6182630f {
static class Foo<X> {
public X x;
public void m(X x) { }
}
interface Bar {}
<T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
s.m(s.x);
}
}
| 1,271 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6182630.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6182630/T6182630.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 6182630
* @summary Method with parameter bound to raw type avoids unchecked warning
* @author Peter von der Ah\u00e9
* @compile -Xlint:unchecked T6182630.java
* @compile/fail -Werror -Xlint:unchecked T6182630.java
* @compile/fail -Werror -Xlint:unchecked T6182630a.java
* @compile/fail -Werror -Xlint:unchecked T6182630b.java
* @compile/fail -Werror -Xlint:unchecked T6182630c.java
* @compile/fail -Werror -Xlint:unchecked T6182630d.java
* @compile/fail -Werror -Xlint:unchecked T6182630e.java
* @compile/fail -Werror -Xlint:unchecked T6182630f.java
*/
public class T6182630 {
static class Foo<X> {
public X x;
public void m(X x) { }
}
interface Bar {}
<T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
t.x = "BAD";
t.m("BAD");
t.m(t.x);
s.x = "BAD";
s.m("BAD");
s.m(s.x);
}
}
| 1,961 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6182630b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6182630/T6182630b.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.
*/
public class T6182630b {
static class Foo<X> {
public X x;
public void m(X x) { }
}
interface Bar {}
<T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
t.m("BAD");
}
}
| 1,273 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6182630a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6182630/T6182630a.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.
*/
public class T6182630a {
static class Foo<X> {
public X x;
public void m(X x) { }
}
interface Bar {}
<T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
t.x = "BAD";
}
}
| 1,274 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6182630d.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6182630/T6182630d.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.
*/
public class T6182630d {
static class Foo<X> {
public X x;
public void m(X x) { }
}
interface Bar {}
<T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
s.x = "BAD";
}
}
| 1,274 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6182630c.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/6182630/T6182630c.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.
*/
public class T6182630c {
static class Foo<X> {
public X x;
public void m(X x) { }
}
interface Bar {}
<T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
t.m(t.x);
}
}
| 1,271 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Base.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/5061359/Base.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.
*/
class Base {
static class Inner {}
int _field;
public int m1(){ return 0;}
}
| 1,141 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Intf.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/5061359/Intf.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.
*/
interface Intf {
static final String C1 = "BLAH";
static class Inner{}
void m1();
}
| 1,148 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5061359a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/5061359/T5061359a.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 5061359
* @summary No error for ambiguous member of intersection
* @clean Base Intf
* @compile/fail T5061359a.java
* @clean Base Intf T5061359a
* @compile/fail Base.java Intf.java T5061359a.java
* @clean Base Intf T5061359a
* @compile/fail T5061359a.java Base.java Intf.java
*/
import java.util.*;
public class T5061359a {
public static class Test<T extends Base & Intf> {}
}
| 1,472 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5061359.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/5061359/T5061359.java | /*
* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5061359
* @summary No error for ambiguous member of intersection
* @compile/fail T5061359.java
*/
class Test<T extends Base & Intf> {
public void foo() {
T t = null;
T.Inner inner = null; // This should be an ambiguous error
}
}
class Base {
static class Inner {}
}
interface Intf {
class Inner {}
}
| 1,421 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T5061359b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/5061359/T5061359b.java | /*
* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5061359
* @summary No error for ambiguous member of intersection
* @compile T5061359b.java
*/
class Test<T extends Base & Intf> {
public void foo() {
T t = null;
t._field = 3; // This should not be an accessibility error
}
}
class Base {
int _field;
}
interface Intf {}
| 1,395 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Compatibility.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/generics/typevars/5060485/Compatibility.java | /*
* Copyright (c) 2006, 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 5060485
* @summary The scope of a class type parameter is too wide
* @author Peter von der Ah\u00e9
* @compile/fail/ref=Compatibility.out -XDrawDiagnostics Compatibility.java
*/
class NumberList<T extends Number> {}
class Test<Y extends Number> {
static class Y {}
class Y1<S extends NumberList<Y>> {}
}
| 1,401 | 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.