diff --git a/java/java-tests/testData/refactoring/introduceParameter/afterDiamond2Raw.java b/java/java-tests/testData/refactoring/introduceParameter/afterDiamond2Raw.java
new file mode 100644
index 000000000000..26f764f56093
--- /dev/null
+++ b/java/java-tests/testData/refactoring/introduceParameter/afterDiamond2Raw.java
@@ -0,0 +1,6 @@
+import java.util.ArrayList
+class Test {
+ void foo(final ArrayList anObject) {
+ ArrayList l = anObject;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/introduceParameter/beforeDiamond2Raw.java b/java/java-tests/testData/refactoring/introduceParameter/beforeDiamond2Raw.java
new file mode 100644
index 000000000000..2976ef4fdd48
--- /dev/null
+++ b/java/java-tests/testData/refactoring/introduceParameter/beforeDiamond2Raw.java
@@ -0,0 +1,6 @@
+import java.util.ArrayList
+class Test {
+ void foo() {
+ ArrayList l = new ArrayList<>();
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/DiamondSuite.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/DiamondSuite.java
new file mode 100644
index 000000000000..c7cc40d648ed
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/DiamondSuite.java
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+package com.intellij.codeInsight.daemon;
+
+import com.intellij.codeInsight.daemon.quickFix.Simplify2DiamondInspectionsTest;
+import com.intellij.refactoring.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * User: anna
+ * Date: 3/9/11
+ */
+public class DiamondSuite {
+ private DiamondSuite() {
+ }
+
+ public static Test suite() {
+ final TestSuite testSuite = new TestSuite("Diamond Suite");
+ testSuite.addTestSuite(LightAdvHighlightingJdk7Test.class);
+ testSuite.addTestSuite(Simplify2DiamondInspectionsTest.class);
+ testSuite.addTestSuite(IntroduceParameterTest.class);
+ return testSuite;
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/IntroduceParameterTest.java b/java/java-tests/testSrc/com/intellij/refactoring/IntroduceParameterTest.java
index 30481aacf6ca..73dadf190ce6 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/IntroduceParameterTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/IntroduceParameterTest.java
@@ -260,6 +260,10 @@ public class IntroduceParameterTest extends LightCodeInsightTestCase {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
+ public void testDiamond2Raw() throws Exception {
+ doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
+ }
+
private void doTestThroughHandler() throws Exception {
configureByFile("/refactoring/introduceParameter/before" + getTestName(false) + ".java");
new IntroduceParameterHandler().invoke(getProject(), myEditor, myFile, new DataContext() {
diff --git a/java/openapi/src/com/intellij/psi/PsiDiamondType.java b/java/openapi/src/com/intellij/psi/PsiDiamondType.java
index 0abeb3a0134f..81d5c016ff23 100644
--- a/java/openapi/src/com/intellij/psi/PsiDiamondType.java
+++ b/java/openapi/src/com/intellij/psi/PsiDiamondType.java
@@ -18,13 +18,11 @@ package com.intellij.psi;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
-import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -37,7 +35,6 @@ import java.util.*;
* Date: Jul 30, 2010
*/
public class PsiDiamondType extends PsiType {
- private static final PsiType[] NULL_TYPES = new PsiType[]{NULL};
private PsiManager myManager;
private final PsiTypeElement myTypeElement;
private static final Logger LOG = Logger.getInstance("#" + PsiDiamondType.class.getName());
@@ -232,7 +229,7 @@ public class PsiDiamondType extends PsiType {
public static final DiamondInferenceResult NULL_RESULT = new DiamondInferenceResult() {
@Override
public PsiType[] getTypes() {
- return NULL_TYPES;
+ return PsiType.EMPTY_ARRAY;
}
@Override
@@ -257,7 +254,7 @@ public class PsiDiamondType extends PsiType {
public PsiType[] getTypes() {
if (myErrorMessage != null) {
- return NULL_TYPES;
+ return PsiType.EMPTY_ARRAY;
}
final PsiType[] result = new PsiType[myInferredTypes.size()];
for (int i = 0, myInferredTypesSize = myInferredTypes.size(); i < myInferredTypesSize; i++) {
@@ -273,6 +270,9 @@ public class PsiDiamondType extends PsiType {
return result;
}
+ /**
+ * @return all inferred types even if inference failed
+ */
public List getInferredTypes() {
return myInferredTypes;
}