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