testdata for IDEA-60836

This commit is contained in:
anna
2013-10-22 21:23:30 +02:00
parent 8b4c147b6f
commit 448f07e6ac
2 changed files with 30 additions and 0 deletions
@@ -0,0 +1,29 @@
import java.util.*;
public class IdeaGenericsTest {
interface Animal<T extends Animal<T>> {
List<T> getFriends();
}
class Dog implements Animal<Dog> {
public List<Dog> getFriends() {
return null;
}
}
class Cat implements Animal<Cat> {
public List<Cat> getFriends() {
return null;
}
}
void mixAnimals() {
ArrayList<Dog> dogs = null;
ArrayList<Cat> cats = null;
<error descr="Inferred type 'java.util.ArrayList<IdeaGenericsTest.Dog>' for type parameter 'V' is not within its bound; should extend 'java.util.ArrayList<IdeaGenericsTest.Cat>'">makeFriends(cats, dogs)</error>;
}
private<T extends Animal<T>, V extends ArrayList<T>> void makeFriends(ArrayList<T> someAnimals, V otherAnimals) {
someAnimals.add(otherAnimals.get(0));
}
}