mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CreateTypeParameterFromUsageFix: stop searching variants when inside enum
This commit is contained in:
+6
-1
@@ -185,7 +185,8 @@ public class CreateTypeParameterFromUsageFix extends BaseIntentionAction {
|
||||
if (element instanceof PsiField && ((PsiField)element).hasModifierProperty(PsiModifier.STATIC)) {
|
||||
break;
|
||||
}
|
||||
if (element instanceof PsiMethod || (element instanceof PsiClass && !(element instanceof PsiTypeParameter))) {
|
||||
if (element instanceof PsiClass && ((PsiClass)element).isEnum()) break;
|
||||
if (element instanceof PsiMethod || isValidClass(element)) {
|
||||
if (((PsiMember)element).getName() != null) {
|
||||
parents.add((PsiNameIdentifierOwner)element);
|
||||
if (findFirstOnly) {
|
||||
@@ -198,4 +199,8 @@ public class CreateTypeParameterFromUsageFix extends BaseIntentionAction {
|
||||
}
|
||||
return parents;
|
||||
}
|
||||
|
||||
private static boolean isValidClass(PsiElement element) {
|
||||
return element instanceof PsiClass && !(element instanceof PsiTypeParameter);
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create type parameter 'T'" "false"
|
||||
|
||||
public class Test {
|
||||
private enum State {
|
||||
VALID, INVALID;
|
||||
private T<caret> info;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user