From c9db4a5d1202f636b6095f146f9065c760fee595 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 17 May 2010 14:53:38 +0100 Subject: [PATCH] IDEA-54459 Smart type completion for anonymous class after 'new' inserts '{}' inside '()' if the class has two generic parameters --- .../codeInsight/completion/ConstructorInsertHandler.java | 3 +++ .../completion/smartType/NewAnonymousFunction-out.java | 5 +++++ .../completion/smartType/NewAnonymousFunction.java | 4 ++++ .../codeInsight/completion/SmartTypeCompletionTest.java | 2 ++ 4 files changed, 14 insertions(+) create mode 100644 java/java-tests/testData/codeInsight/completion/smartType/NewAnonymousFunction-out.java create mode 100644 java/java-tests/testData/codeInsight/completion/smartType/NewAnonymousFunction.java diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/ConstructorInsertHandler.java b/java/java-impl/src/com/intellij/codeInsight/completion/ConstructorInsertHandler.java index 38c0516be775..73422a5172ce 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/ConstructorInsertHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/ConstructorInsertHandler.java @@ -18,6 +18,7 @@ import com.intellij.openapi.editor.ScrollType; import com.intellij.openapi.project.Project; import com.intellij.psi.*; import com.intellij.psi.codeStyle.CodeStyleManager; +import com.intellij.psi.impl.source.PostprocessReformattingAspect; import com.intellij.psi.infos.CandidateInfo; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; @@ -53,6 +54,8 @@ class ConstructorInsertHandler implements InsertHandler { } +class A { + private static final Function a = new Function() { + }; +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartType/NewAnonymousFunction.java b/java/java-tests/testData/codeInsight/completion/smartType/NewAnonymousFunction.java new file mode 100644 index 000000000000..4a63599c4297 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/NewAnonymousFunction.java @@ -0,0 +1,4 @@ +interface Function { } +class A { + private static final Function a = new +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java index ffb13f847f70..2eb7e0ff5d59 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java @@ -633,6 +633,8 @@ public class SmartTypeCompletionTest extends LightCompletionTestCase { public void testDefaultAnnoMethodValue() throws Throwable { doTest(); } + public void testNewAnonymousFunction() throws Throwable { doTest(); } + public void testUseIntConstantsFromTargetClass() throws Throwable { doTest(); } public void testUseIntConstantsFromTargetClassReturnValue() throws Throwable { doTest(); } public void testUseIntConstantsFromConstructedClass() throws Throwable { doTest(); }