summaryrefslogtreecommitdiff
path: root/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA64103.java
blob: fd85609ff4cb9558d6dd1a9f5b9076991a8c31dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.util.*;

class Test {

  public static <R, E, RC extends Collection<R>, C extends Collection<E>> RC collectionGenericTest(C collection, Lambda<R, E> lambda) {
    return (RC) new Vector<R>();
  }

  public static <R, E, RC extends List<R>, C extends List<E>> RC listGenericTest(C list, Lambda<R, E> lambda) {
    return (RC) new Vector<R>();
  }

  public static void testGeneric() {
    Collection<String> testCollection = collectionGenericTest(new Vector<Integer>(), new Lambda<String, Integer>() {
      @Override
      public String lambda(Integer l) {
        return null;
      }
    });

    List<String> testList = listGenericTest(new Vector<Integer>(), new Lambda<String, Integer>() {
      @Override
      public String lambda(Integer l) {
        return null;
      }
    });
  }

  private interface Lambda<R, A> {
    public R lambda(A l);
  }

  <error descr="Class 'Vector' must either be declared abstract or implement abstract method 'get(int)' in 'AbstractList'">private static class Vector<A> extends AbstractList<A> implements List<A></error> {
    public Vector() {
    }
  }
}