mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java completion: don't insert method type arguments if they weren't inferred (IDEA-198368)
This commit is contained in:
@@ -457,7 +457,8 @@ public class JavaMethodCallElement extends LookupItem<PsiMethod> implements Type
|
||||
|
||||
List<PsiType> substituted = ContainerUtil.map(parameters, parameter -> {
|
||||
PsiType type = substitutor.substitute(parameter);
|
||||
return type instanceof PsiWildcardType ? ((PsiWildcardType)type).getExtendsBound() : type;
|
||||
if (type instanceof PsiWildcardType) type = ((PsiWildcardType)type).getExtendsBound();
|
||||
return PsiUtil.resolveClassInClassTypeOnly(type) == parameter ? null : type;
|
||||
});
|
||||
if (ContainerUtil.exists(substituted, t -> t == null || t instanceof PsiCapturedWildcardType)) return null;
|
||||
if (substituted.equals(ContainerUtil.map(parameters, TypeConversionUtil::typeParameterErasure))) return null;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import java.util.Comparator;
|
||||
|
||||
class T {
|
||||
|
||||
{
|
||||
new TreeSet<>(Ordering.na<caret>)
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Ordering<T> implements Comparator<T> {
|
||||
static <C extends Comparable> Ordering<C> natural() {
|
||||
}
|
||||
}
|
||||
|
||||
class TreeSet<E> {
|
||||
TreeSet(Comparator<? super E> c) {
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import java.util.Comparator;
|
||||
|
||||
class T {
|
||||
|
||||
{
|
||||
new TreeSet<>(Ordering.natural()<caret>)
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Ordering<T> implements Comparator<T> {
|
||||
static <C extends Comparable> Ordering<C> natural() {
|
||||
}
|
||||
}
|
||||
|
||||
class TreeSet<E> {
|
||||
TreeSet(Comparator<? super E> c) {
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.java.codeInsight.completion
|
||||
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import groovy.transform.CompileStatic
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
@CompileStatic
|
||||
class Normal7CompletionTest extends NormalCompletionTestCase {
|
||||
final LightProjectDescriptor projectDescriptor = JAVA_1_7
|
||||
|
||||
void testGenericInsideDiamond() { doTest() }
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user