mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
method refs: ambiguity (IDEA-113078)
This commit is contained in:
@@ -693,7 +693,6 @@ public class LambdaUtil {
|
||||
}
|
||||
|
||||
private static int isMoreSpecific(PsiType returnType, PsiType returnType1, PsiType lambdaType) {
|
||||
if (returnType == PsiType.VOID || returnType1 == PsiType.VOID) return 0;
|
||||
TypeKind typeKind = TypeKind.PRIMITIVE;
|
||||
if (lambdaType instanceof PsiLambdaExpressionType) {
|
||||
typeKind = areLambdaReturnExpressionsPrimitive((PsiLambdaExpressionType)lambdaType);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
class App {
|
||||
|
||||
public static void main(String[] args) {
|
||||
test(App::getLength);
|
||||
}
|
||||
|
||||
private static Integer getLength(String word) {
|
||||
return word.length();
|
||||
}
|
||||
|
||||
|
||||
private static void <warning descr="Private method 'test(App.Consumer<java.lang.String>)' is never used">test</warning>(Consumer<String> consumer) {
|
||||
consumer.accept("Hello World");
|
||||
}
|
||||
|
||||
private static void test(Function<String, Integer> function) {
|
||||
Integer result = function.apply("Hello World");
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
interface Function<T, R> {
|
||||
R apply(T t);
|
||||
}
|
||||
|
||||
interface Consumer<T> {
|
||||
void accept(T t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testMethodRefAcceptance() { doTest(); }
|
||||
public void testVarargsMethodRef() { doTest(); }
|
||||
public void testExprReceiver() { doTest(); }
|
||||
public void testVoidReturnTypeAmbiguity() { doTest(true); }
|
||||
|
||||
public void testTypeParameterWithExtendsList() throws Exception {
|
||||
doTest();
|
||||
|
||||
Reference in New Issue
Block a user