mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
raw type to parameterized: warn about conflicts (IDEA-173770)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import java.util.*;
|
||||
|
||||
public class F<T> {
|
||||
{
|
||||
List list<caret>= new ArrayList<T>();
|
||||
list.add("");
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,11 @@ import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.miscGenerics.RawTypeCanBeGenericInspection;
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil;
|
||||
import com.intellij.refactoring.BaseRefactoringProcessor;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -63,6 +66,17 @@ public class RawTypeCanBeGenericTest extends LightCodeInsightFixtureTestCase {
|
||||
doTest(getMessage("list", "List<String>"));
|
||||
}
|
||||
|
||||
public void testConflict() {
|
||||
try {
|
||||
doTest(getMessage("list", "List<T>"));
|
||||
fail("No conflict detected");
|
||||
}
|
||||
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
|
||||
assertEquals("Cannot convert type of expression <b>""</b> from <b>java.lang.String</b> to <b>T</b><br>",
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void testAtInitializer() {
|
||||
assertIntentionNotAvailable(getMessagePrefix());
|
||||
}
|
||||
@@ -92,4 +106,10 @@ public class RawTypeCanBeGenericTest extends LightCodeInsightFixtureTestCase {
|
||||
String message = InspectionsBundle.message("inspection.raw.variable.type.can.be.generic.quickfix", "@", "@");
|
||||
return message.substring(0, message.indexOf("@"));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return JAVA_1_6;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user