disable inline to anonymous for type params (IDEA-140846)

This commit is contained in:
Anna Kozlova
2015-05-29 17:42:26 +02:00
parent 63e11cc0f9
commit f2ebc25583
3 changed files with 11 additions and 0 deletions
@@ -203,6 +203,9 @@ public class InlineToAnonymousClassHandler extends JavaInlineActionHandler {
@Nullable
public static String getCannotInlineMessage(final PsiClass psiClass) {
if (psiClass instanceof PsiTypeParameter) {
return "Type parameters cannot be inlined";
}
if (psiClass.isAnnotationType()) {
return "Annotation types cannot be inlined";
}
@@ -0,0 +1,4 @@
class B<K>{}
class A<<caret>T> extends B<T> {
A<String> a;
}
@@ -332,6 +332,10 @@ public class InlineToAnonymousClassTest extends LightRefactoringTestCase {
doTestNoInline("Library classes cannot be inlined");
}
public void testNoInlineTypeParameter() throws Exception {
doTestNoInline("Type parameters cannot be inlined");
}
public void testNoInlineNoUsages() throws Exception {
doTestPreprocessUsages("Class is never used");
}