summaryrefslogtreecommitdiff
path: root/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Assignability.java
blob: a5dbcd07db183e056b7702e39db3c37a95248066 (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
38
39
40
41
42
class Test {
  {
      Runnable b = Test :: <error descr="Cannot resolve method 'length'">length</error>;
      Comparable<String> c = Test :: length;
      Comparable<Integer> c1 =  Test :: <error descr="Cannot resolve method 'length'">length</error>;
  }

  public static Integer length(String s) {
    return s.length();
  }

  interface Bar {
    Integer _(String s);
  }
}

class Test1 {
    {
        Runnable b = Test1 :: <error descr="Cannot resolve method 'length'">length</error>;
        Comparable<String> c = Test1 :: length;
        Comparable<Integer> c1 =  Test1 :: length;
    }
  
    public static Integer length(String s) {
      return s.length();
    }

    public static Integer length(Integer s) {
      return s;
    }
  
    interface Bar {
      Integer _(String s);
    }
}

class Test2 {

    void foo(Integer i) {}

    <error descr="Incompatible types. Found: '<method reference>', required: 'java.lang.Object'">Object o = Test2::foo;</error>
}