Skip to content

Commit 7f08fe2

Browse files
Add test
1 parent bf41a7e commit 7f08fe2

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

tests/neg/WrongBounds.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import java.util.*;
2+
3+
class WrongBounds {
4+
class LL<T> extends ArrayList<List<T>> {}
5+
class Wrap<T extends List<List<?>>> extends ArrayList<T> {}
6+
class Wrong<T extends LL<?>> extends Wrap<T> {} // error
7+
}

tests/neg/java-wrong-bounds/D.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class A
2+
3+
class D[T >: A](v: T) {
4+
def getV(): T = v
5+
}

tests/neg/java-wrong-bounds/J.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
public class J extends D<String> { // error
2+
3+
public J() {
4+
super(null);
5+
}
6+
7+
public static D<String> getDS() { // error
8+
return new D<String>("DS");
9+
}
10+
11+
public static final D<String> fieldDS = new D<String>("DS"); // error
12+
13+
public static void useDS(D<String> ds) {} // error
14+
15+
public static <A extends D<String>> void genericDS() {} // error
16+
17+
public static void useOK(D<?> ds) {}
18+
19+
public static D<?> getOK() {return null;}
20+
21+
public static <A extends D<?>> D<?> genericOK(A a) {return a;}
22+
23+
}

0 commit comments

Comments
 (0)