ensure var.normalizeDeclaration invoked after readOnly check

This commit is contained in:
Anna Kozlova
2015-05-22 19:17:36 +02:00
parent 67c234c191
commit d36fe31e1d
2 changed files with 3 additions and 2 deletions
@@ -100,7 +100,6 @@ public class ConvertFieldToAtomicIntention extends PsiElementBaseIntentionAction
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
final PsiVariable psiVariable = getVariable(element);
LOG.assertTrue(psiVariable != null);
psiVariable.normalizeDeclaration();
final Query<PsiReference> refs = ReferencesSearch.search(psiVariable);
@@ -111,6 +110,8 @@ public class ConvertFieldToAtomicIntention extends PsiElementBaseIntentionAction
}
if (!FileModificationService.getInstance().preparePsiElementsForWrite(elements)) return;
psiVariable.normalizeDeclaration();
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
final PsiType fromType = psiVariable.getType();
@@ -70,7 +70,6 @@ public class ConvertFieldToThreadLocalIntention extends PsiElementBaseIntentionA
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
final PsiField psiField = PsiTreeUtil.getParentOfType(element, PsiField.class);
LOG.assertTrue(psiField != null);
psiField.normalizeDeclaration();
final Query<PsiReference> refs = ReferencesSearch.search(psiField);
final Set<PsiElement> elements = new HashSet<PsiElement>();
@@ -79,6 +78,7 @@ public class ConvertFieldToThreadLocalIntention extends PsiElementBaseIntentionA
elements.add(reference.getElement());
}
if (!FileModificationService.getInstance().preparePsiElementsForWrite(elements)) return;
psiField.normalizeDeclaration();
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);