mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diamonds: forbid diamonds completion with anonymous rollover (IDEA-72527)
This commit is contained in:
@@ -137,7 +137,7 @@ public class JavaInheritorsGetter extends CompletionProvider<CompletionParameter
|
||||
final PsiVariable declaredVar = (PsiVariable)((PsiDeclarationStatement)statement).getDeclaredElements()[0];
|
||||
final PsiNewExpression initializer = (PsiNewExpression)declaredVar.getInitializer();
|
||||
final boolean hasDefaultConstructorOrNoGenericsOne = PsiDiamondType.hasDefaultConstructor(psiClass) || !PsiDiamondType.haveConstructorsGenericsParameters(psiClass);
|
||||
if (hasDefaultConstructorOrNoGenericsOne && PsiDiamondType.resolveInferredTypes(initializer).getErrorMessage() == null) {
|
||||
if (hasDefaultConstructorOrNoGenericsOne && PsiDiamondType.resolveInferredTypes(initializer).getErrorMessage() == null && !psiClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
psiType = initializer.getType();
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class MyClass {
|
||||
public void foo() {
|
||||
MyDD<String> d = new MyDD<String>() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MyDD<T> {
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class MyClass {
|
||||
public void foo() {
|
||||
MyDD<String> d = new MyD<caret>
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MyDD<T> {
|
||||
}
|
||||
+4
@@ -41,6 +41,10 @@ public class SmartType17CompletionTest extends LightFixtureCompletionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDiamondNotCollapsedInCaseOfAnonymousClasses() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDiamondPresentation() {
|
||||
configureByFile("/" + getTestName(false) + ".java");
|
||||
LookupElementPresentation presentation = new LookupElementPresentation();
|
||||
|
||||
+1
-1
@@ -382,7 +382,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
myLookup.addItem(item.getLookupElement(), item.getPrefixMatcher());
|
||||
myCount++;
|
||||
|
||||
if (myCount == 1) {
|
||||
if (myCount == 1 && !ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user