From 630cfaa3790fe682c18c009ad232061a9288df71 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 27 Dec 2011 14:59:56 +0100 Subject: [PATCH] IDEA-79271 Smart completion in ARM-try block produces trailing semicolon --- .../codeInsight/ExpectedTypesProvider.java | 2 +- .../smartType/DiamondCollapsed-out.java | 2 +- .../smartType/DiamondNotCollapsed-out.java | 17 +---------------- .../smartType/DiamondNotCollapsed.java | 15 --------------- ...otCollapsedInCaseOfAnonymousClasses-out.java | 2 +- .../completion/SmartType17CompletionTest.java | 5 +++++ 6 files changed, 9 insertions(+), 34 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java b/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java index 39445d9cfdfd..128276a52113 100644 --- a/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java @@ -444,7 +444,7 @@ public class ExpectedTypesProvider { @Override public void visitVariable(PsiVariable variable) { PsiType type = variable.getType(); ExpectedTypeInfoImpl info = createInfoImpl(type, ExpectedTypeInfo.TYPE_OR_SUBTYPE, type, - TailType.SEMICOLON); + variable instanceof PsiResourceVariable ? TailType.NONE : TailType.SEMICOLON); info.expectedName = getPropertyName(variable); myResult = new ExpectedTypeInfo[]{info}; } diff --git a/java/java-tests/testData/codeInsight/completion/smartType/DiamondCollapsed-out.java b/java/java-tests/testData/codeInsight/completion/smartType/DiamondCollapsed-out.java index 7b91bc8c1162..9e5947758168 100644 --- a/java/java-tests/testData/codeInsight/completion/smartType/DiamondCollapsed-out.java +++ b/java/java-tests/testData/codeInsight/completion/smartType/DiamondCollapsed-out.java @@ -1,6 +1,6 @@ class MyClass { public void foo() { - MyDD d = new MyDD<>() + MyDD d = new MyDD<>(); } } diff --git a/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsed-out.java b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsed-out.java index f9430cdb29a0..b0e0ac58e018 100644 --- a/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsed-out.java +++ b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsed-out.java @@ -1,21 +1,6 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ class MyClass { public void foo() { - MyDD d = new MyDD() + MyDD d = new MyDD(); } } diff --git a/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsed.java b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsed.java index 69a12ec44ec7..1267915c5dc1 100644 --- a/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsed.java +++ b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsed.java @@ -1,18 +1,3 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ class MyClass { public void foo() { MyDD d = new MyD diff --git a/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses-out.java b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses-out.java index a18195cbc50e..eb27e9eea8ae 100644 --- a/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses-out.java +++ b/java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses-out.java @@ -1,7 +1,7 @@ class MyClass { public void foo() { MyDD d = new MyDD() { - } + }; } } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java index 7ec019f86ab2..96dda9979256 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java @@ -27,6 +27,11 @@ public class SmartType17CompletionTest extends LightFixtureCompletionTestCase { return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/completion/smartType/"; } + @Override + protected void complete() { + myItems = myFixture.complete(CompletionType.SMART); + } + @NotNull @Override protected LightProjectDescriptor getProjectDescriptor() {