private static void addDefaultConstructor(
     JavaChangeInfo changeInfo, PsiClass aClass, final UsageInfo[] usages)
     throws IncorrectOperationException {
   if (!(aClass instanceof PsiAnonymousClass)) {
     PsiElementFactory factory = JavaPsiFacade.getElementFactory(aClass.getProject());
     PsiMethod defaultConstructor =
         factory.createMethodFromText(aClass.getName() + "(){}", aClass);
     defaultConstructor =
         (PsiMethod)
             CodeStyleManager.getInstance(aClass.getProject()).reformat(defaultConstructor);
     defaultConstructor = (PsiMethod) aClass.add(defaultConstructor);
     PsiUtil.setModifierProperty(
         defaultConstructor, VisibilityUtil.getVisibilityModifier(aClass.getModifierList()), true);
     addSuperCall(changeInfo, defaultConstructor, null, usages);
   } else {
     final PsiElement parent = aClass.getParent();
     if (parent instanceof PsiNewExpression) {
       final PsiExpressionList argumentList = ((PsiNewExpression) parent).getArgumentList();
       final PsiClass baseClass = changeInfo.getMethod().getContainingClass();
       final PsiSubstitutor substitutor =
           TypeConversionUtil.getSuperClassSubstitutor(baseClass, aClass, PsiSubstitutor.EMPTY);
       fixActualArgumentsList(argumentList, changeInfo, true, substitutor);
     }
   }
 }
 @Nullable
 public static PsiMethod findPsiMethod(PsiManager manager, String externalName) {
   final int spaceIdx = externalName.indexOf(' ');
   final String className = externalName.substring(0, spaceIdx);
   final PsiClass psiClass = ClassUtil.findPsiClass(manager, className);
   if (psiClass == null) return null;
   try {
     PsiElementFactory factory =
         JavaPsiFacade.getInstance(psiClass.getProject()).getElementFactory();
     String methodSignature = externalName.substring(spaceIdx + 1);
     PsiMethod patternMethod = factory.createMethodFromText(methodSignature, psiClass);
     return psiClass.findMethodBySignature(patternMethod, false);
   } catch (IncorrectOperationException e) {
     // Do nothing. Returning null is acceptable in this case.
     return null;
   }
 }
 @NotNull
 private static MethodSignature createSignatureFromText(
     @NotNull PsiElementFactory factory, @NotNull String text) {
   return factory.createMethodFromText(text, null).getSignature(PsiSubstitutor.EMPTY);
 }