3232import com .intellij .java .language .psi .util .PsiUtil ;
3333import com .intellij .java .language .psi .util .TypeConversionUtil ;
3434import consulo .annotation .access .RequiredReadAction ;
35+ import consulo .annotation .access .RequiredWriteAction ;
3536import consulo .language .editor .refactoring .util .CommonRefactoringUtil ;
3637import consulo .language .editor .ui .util .DocCommentPolicy ;
3738import consulo .language .psi .PsiElement ;
@@ -124,7 +125,7 @@ else if (element.getParent() instanceof PsiReferenceList refList) {
124125 if (refList .getParent () instanceof PsiClass inheritor
125126 && (refList .equals (inheritor .getExtendsList ()) || refList .equals (inheritor .getImplementsList ()))) {
126127 usages .add (new ReplaceExtendsListUsageInfo (
127- (PsiJavaCodeReferenceElement )element ,
128+ (PsiJavaCodeReferenceElement ) element ,
128129 mySuperClass ,
129130 inheritor
130131 ));
@@ -198,7 +199,7 @@ else if (element.getParent() instanceof PsiJavaCodeReferenceElement parentCodeRe
198199 if (superConstructor .getParameterList ().getParametersCount () == 0 ) {
199200 PsiExpression expression =
200201 JavaPsiFacade .getElementFactory (myProject ).createExpressionFromText ("super()" , constructor );
201- usages .add (new InlineSuperCallUsageInfo ((PsiMethodCallExpression )expression , constrBody ));
202+ usages .add (new InlineSuperCallUsageInfo ((PsiMethodCallExpression ) expression , constrBody ));
202203 }
203204 }
204205 }
@@ -259,7 +260,7 @@ private static PsiType getPlaceExpectedType(PsiElement parent) {
259260 PsiParameter [] parameters = method .getParameterList ().getParameters ();
260261 if (i >= parameters .length ) {
261262 if (method .isVarArgs ()) {
262- return ((PsiEllipsisType )parameters [parameters .length - 1 ].getType ()).getComponentType ();
263+ return ((PsiEllipsisType ) parameters [parameters .length - 1 ].getType ()).getComponentType ();
263264 }
264265 }
265266 else {
@@ -285,6 +286,7 @@ protected boolean showConflicts(@Nonnull MultiMap<PsiElement, String> conflicts,
285286
286287 @ Override
287288 @ RequiredUIAccess
289+ @ RequiredWriteAction
288290 protected void performRefactoring (@ Nonnull UsageInfo [] pushDownUsages ) {
289291 if (myCurrentInheritor != null ) {
290292 encodeRefs ();
@@ -297,7 +299,7 @@ protected void performRefactoring(@Nonnull UsageInfo[] pushDownUsages) {
297299 for (UsageInfo usageInfo : usages ) {
298300 if (!(usageInfo instanceof ReplaceExtendsListUsageInfo || usageInfo instanceof RemoveImportUsageInfo )) {
299301 try {
300- ((FixableUsageInfo )usageInfo ).fixUsage ();
302+ ((FixableUsageInfo ) usageInfo ).fixUsage ();
301303 }
302304 catch (IncorrectOperationException e ) {
303305 LOG .info (e );
@@ -309,7 +311,7 @@ protected void performRefactoring(@Nonnull UsageInfo[] pushDownUsages) {
309311 //postpone broken hierarchy
310312 for (UsageInfo usage : usages ) {
311313 if (usage instanceof ReplaceExtendsListUsageInfo || usage instanceof RemoveImportUsageInfo ) {
312- ((FixableUsageInfo )usage ).fixUsage ();
314+ ((FixableUsageInfo ) usage ).fixUsage ();
313315 }
314316 }
315317 if (myCurrentInheritor == null ) {
@@ -324,6 +326,7 @@ protected void performRefactoring(@Nonnull UsageInfo[] pushDownUsages) {
324326 }.run ();
325327 }
326328
329+ @ RequiredWriteAction
327330 private void replaceInnerTypeUsages () {
328331 JavaPsiFacade facade = JavaPsiFacade .getInstance (myProject );
329332 PsiElementFactory elementFactory = facade .getElementFactory ();
@@ -411,6 +414,6 @@ private static PsiSubstitutor getSuperClassSubstitutor(
411414 @ Nonnull
412415 @ Override
413416 protected String getCommandName () {
414- return InlineSuperClassRefactoringHandler .REFACTORING_NAME ;
417+ return InlineSuperClassRefactoringHandler .REFACTORING_NAME . get () ;
415418 }
416419}
0 commit comments