private static void correctMethodAnnotations(PsiMethod listOwner, EKey primaryKey, MethodAnnotations methodAnnotations) {
    if (methodAnnotations.mutates.isPure()) {
      String contractValues = methodAnnotations.contractsValues.get(primaryKey);
      if (contractValues == null) return;
      List<StandardMethodContract> contracts;
      try {
        contracts = StandardMethodContract.parseContract(contractValues);
      }
      catch (StandardMethodContract.ParseException ignore) {
        return;
      }
      if (!ContainerUtil.exists(contracts, c -> c.getReturnValue().equals(ContractReturnValue.returnNew()))) {
        return;
      }
      PsiType returnType = listOwner.getReturnType();
      if (InheritanceUtil.isInheritor(returnType, CommonClassNames.JAVA_UTIL_COLLECTION) ||
          InheritanceUtil.isInheritor(returnType, CommonClassNames.JAVA_UTIL_MAP)) {
        // We consider collection/map size as collection field
        // Also, we consider the return value of pure -> new method as local object
        // As a result, collection wrappers produced by methods may be marked as local
        // while still depend on something else. Let's remove contracts conservatively in this case.
        methodAnnotations.contractsValues.remove(primaryKey);
      }
    }
  }
private static void correctMethodAnnotations(PsiMethod listOwner, EKey primaryKey, MethodAnnotations methodAnnotations)