mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
disable "move initializer to" fixes on malformed fields
This commit is contained in:
+2
-1
@@ -48,7 +48,8 @@ public abstract class BaseMoveInitializerToMethodAction extends PsiElementBaseIn
|
||||
if (element instanceof PsiCompiledElement) return false;
|
||||
final PsiField field = PsiTreeUtil.getParentOfType(element, PsiField.class, false, PsiMember.class, PsiCodeBlock.class, PsiDocComment.class);
|
||||
if (field == null || hasUnsuitableModifiers(field)) return false;
|
||||
if (!field.hasInitializer()) return false;
|
||||
PsiExpression initializer = field.getInitializer();
|
||||
if (initializer == null || initializer.getNextSibling() instanceof PsiErrorElement) return false;
|
||||
PsiClass psiClass = field.getContainingClass();
|
||||
|
||||
return psiClass != null && !psiClass.isInterface() && !(psiClass instanceof PsiAnonymousClass) && !(psiClass instanceof PsiSyntheticClass);
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Move initializer to constructor" "false"
|
||||
public class X {
|
||||
int <caret>i=new ();
|
||||
|
||||
X() {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user