private static @NotNull ThreeState getConstructorSideEffect(@NotNull PsiNewExpression newExpression) {
    if (newExpression.isArrayCreation()) return ThreeState.NO;
    PsiAnonymousClass anonymousClass = newExpression.getAnonymousClass();
    if (anonymousClass != null && anonymousClass.getInitializers().length == 0) {
      PsiClass baseClass = anonymousClass.getBaseClassType().resolve();
      if (baseClass != null && baseClass.isInterface()) {
        return ThreeState.NO;
      }
    }
    PsiJavaCodeReferenceElement classReference = newExpression.getClassReference();
    PsiClass aClass = classReference == null ? null : tryCast(classReference.resolve(), PsiClass.class);
    String qualifiedName = aClass == null ? null : aClass.getQualifiedName();
    if (qualifiedName == null) return ThreeState.UNSURE;
    if (ourSideEffectFreeClasses.contains(qualifiedName)) return ThreeState.NO;
    PsiMethod method = newExpression.resolveConstructor();
    if (method != null) {
      MutationSignature signature = MutationSignature.fromMethod(method);
      if (signature.isPure()) {
        return ThreeState.NO;
      }
      if (signature.mutatesAnything()) {
        return ThreeState.YES;
      }
    }

    PsiFile file = aClass.getContainingFile();
    PsiDirectory directory = file.getContainingDirectory();
    PsiPackage classPackage = directory == null ? null : JavaDirectoryService.getInstance().getPackage(directory);
    String packageName = classPackage == null ? null : classPackage.getQualifiedName();

    // all Throwable descendants from java.lang are side effects free
    if (CommonClassNames.DEFAULT_PACKAGE.equals(packageName) || "java.io".equals(packageName)) {
      PsiClass throwableClass = JavaPsiFacade.getInstance(aClass.getProject()).findClass(CommonClassNames.JAVA_LANG_THROWABLE, aClass.getResolveScope());
      if (throwableClass != null && com.intellij.psi.util.InheritanceUtil.isInheritorOrSelf(aClass, throwableClass, true)) {
        return ThreeState.NO;
      }
    }
    if (method == null) {
      PsiClass superClass = aClass.getSuperClass();
      if (superClass != null && CommonClassNames.JAVA_LANG_OBJECT.equals(superClass.getQualifiedName())) {
        for (PsiClassInitializer initializer : aClass.getInitializers()) {
          if (!initializer.hasModifierProperty(PsiModifier.STATIC)) return ThreeState.UNSURE;
        }
        for (PsiField field : aClass.getFields()) {
          if (!field.hasModifierProperty(PsiModifier.STATIC) && field.hasInitializer()) return ThreeState.UNSURE;
        }
        return ThreeState.NO;
      }
    }
    return ThreeState.UNSURE;
  }
private static @NotNull ThreeState getConstructorSideEffect(@NotNull PsiNewExpression newExpression)