void (@NotNull PsiMethod method) { PsiAnnotation annotation = JavaMethodContractUtil.findContractAnnotation(method); if (annotation == null || annotation.getOwner() != method.getModifierList()) return; String text = AnnotationUtil.getStringAttributeValue(annotation, null); if (text == null || text.trim().isEmpty()) return; List<StandardMethodContract> contracts; try { contracts = StandardMethodContract.parseContract(text); } catch (StandardMethodContract.ParseException ignore) { return; } List<StandardMethodContract> newContracts = ContainerUtil.map(contracts, contract -> { ContractReturnValue value = contract.getReturnValue(); return value instanceof ContractReturnValue.BooleanReturnValue ? contract.withReturnValue(((ContractReturnValue.BooleanReturnValue)value).negate()) : contract; }); if (newContracts.equals(contracts)) return; PsiAnnotation newAnnotation = JavaMethodContractUtil.updateContract(annotation, newContracts); if (newAnnotation != null) { annotation.replace(newAnnotation); } }