mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
bring into scope: multiple vars in one declaration should be normalized (IDEA-62848 )
This commit is contained in:
@@ -97,7 +97,7 @@ public class BringVariableIntoScopeFix implements IntentionAction {
|
||||
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
|
||||
LOG.assertTrue(myOutOfScopeVariable != null);
|
||||
PsiManager manager = file.getManager();
|
||||
|
||||
myOutOfScopeVariable.normalizeDeclaration();
|
||||
PsiUtil.setModifierProperty(myOutOfScopeVariable, PsiModifier.FINAL, false);
|
||||
PsiElement commonParent = PsiTreeUtil.findCommonParent(myOutOfScopeVariable, myUnresolvedReference);
|
||||
LOG.assertTrue(commonParent != null);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Bring 'int j' into Scope" "true"
|
||||
class a {
|
||||
void foo() {
|
||||
int j;
|
||||
{
|
||||
int i;
|
||||
j = 10;
|
||||
}
|
||||
System.out.println(<caret>j); // invoke "bring 'int j' into scope" quickfix here
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Bring 'int j' into Scope" "true"
|
||||
class a {
|
||||
void foo() {
|
||||
{
|
||||
int i, j = 10;
|
||||
}
|
||||
System.out.println(<caret>j); // invoke "bring 'int j' into scope" quickfix here
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user