ModCommand (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { if (!(descriptor.getPsiElement() instanceof PsiExpression initializer)) return ModCommand.nop(); if (!(initializer.getParent() instanceof PsiVariable variable)) return ModCommand.nop(); List<ModCommandAction> subActions; List<PsiExpression> sideEffects = SideEffectChecker.extractSideEffectExpressions(initializer); if (!sideEffects.isEmpty() && !ContainerUtil.exists(sideEffects, se -> VariableAccessUtils.variableIsUsed(variable, se))) { subActions = List.of(new SideEffectAwareRemove(initializer), new DeleteElementFix(initializer, JavaBundle.message("delete.initializer.completely"))); } else { subActions = List.of(new DeleteElementFix(initializer)); } return new ModChooseAction(JavaBundle.message("inspection.unused.assignment.remove.initializer.quickfix.title"), subActions); }