mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
normalize declaration fix: enable for fields (IDEA-84563)
This commit is contained in:
@@ -39,6 +39,10 @@ public class NormalizeDeclarationFix extends InspectionGadgetsFix {
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
if (parent instanceof PsiField) {
|
||||
parent.normalizeDeclaration();
|
||||
return;
|
||||
}
|
||||
final PsiElement grandParent = parent.getParent();
|
||||
if (!(grandParent instanceof PsiDeclarationStatement)) {
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.siyeh.igfixes.style.multiple_declaration;
|
||||
|
||||
public class SimpleStringBuffer {
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.siyeh.igfixes.style.multiple_declaration;
|
||||
|
||||
public class SimpleStringBuffer {
|
||||
int i = 0, j<caret> = 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.siyeh.igfixes.style.multiple_declaration;
|
||||
|
||||
public class SimpleStringBuffer {
|
||||
String foo() {
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.siyeh.igfixes.style.multiple_declaration;
|
||||
|
||||
public class SimpleStringBuffer {
|
||||
String foo() {
|
||||
int i = 0, j<caret> = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2012 Bas Leijdekkers
|
||||
*
|
||||
* 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.siyeh.ig.fixes.style;
|
||||
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.IGQuickFixesTestCase;
|
||||
import com.siyeh.ig.style.MultipleDeclarationInspection;
|
||||
|
||||
public class MultipleDeclarationFixTest extends IGQuickFixesTestCase {
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myFixture.enableInspections(new MultipleDeclarationInspection());
|
||||
myRelativePath = "style/multiple_declaration";
|
||||
myDefaultHint = InspectionGadgetsBundle.message("normalize.declaration.quickfix");
|
||||
}
|
||||
|
||||
public void testLocalVariable() { doTest(); }
|
||||
public void testField() { doTest(); }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user