View Javadoc
1   package com.puppycrawl.tools.checkstyle.grammars.java8;
2   
3   import java.lang.annotation.ElementType;
4   import java.lang.annotation.Target;
5   import java.util.Arrays;
6   import java.util.List;
7   import java.util.function.Function;
8   import java.util.function.Supplier;
9   
10  
11  public class InputMethodReferences7 {
12      interface LambdaInt {
13          <S, T> void m(S p1, T p2);
14      }
15  
16      interface MyFunctionalInterface {
17          void invokeMethodReference();
18      }
19  
20      static class LambdaImpl implements LambdaInt {
21          <S, T> LambdaImpl(S p1, T p2) {
22          }
23  
24          public <S, T> void m(S p1, T p2) {
25          }
26      }
27  
28      public void m() {
29      }
30  
31      public void main(String[] args) {
32          MyFunctionalInterface fi = new InputMethodReferences7()::<Integer, String, Long> m;
33          LambdaInt li = LambdaImpl::<@TA Object, @TB Object> new;
34          Supplier s = Bar::<String> m;
35          li = li::<@TA Object, @TB Object> m;
36          s = Bar::<List<String>> m;
37          s = Bar::<List<List<?>>> m;
38      }
39  }
40  
41  class Bar<T> {
42      static Object m() {
43          return null;
44      }
45  }
46  
47  @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER })
48  @interface TA {
49  }
50  
51  @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER })
52  @interface TB {
53  }