void (@NotNull Project project, @NotNull PsiElement startElement, @NotNull ModPsiUpdater updater) { final PsiImportStaticStatement importStatement = (PsiImportStaticStatement)startElement; final PsiJavaCodeReferenceElement importReference = importStatement.getImportReference(); if (importReference == null) { return; } final JavaResolveResult[] importTargets = importReference.multiResolve(false); if (importTargets.length == 0) { return; } final boolean onDemand = importStatement.isOnDemand(); final StaticImportReferenceCollector referenceCollector = new StaticImportReferenceCollector(importTargets, onDemand); final PsiJavaFile file = (PsiJavaFile)importStatement.getContainingFile(); file.accept(referenceCollector); final List<PsiJavaCodeReferenceElement> references = referenceCollector.getReferences(); final Map<PsiJavaCodeReferenceElement, PsiMember> referenceTargetMap = new HashMap<>(); for (PsiJavaCodeReferenceElement reference : references) { final PsiElement target = reference.resolve(); if (target instanceof PsiEnumConstant && reference instanceof PsiExpression && PsiImplUtil.getSwitchLabel((PsiExpression)reference) != null) continue; if (target instanceof PsiMember member) { referenceTargetMap.put(reference, member); } } new CommentTracker().deleteAndRestoreComments(importStatement); for (Map.Entry<PsiJavaCodeReferenceElement, PsiMember> entry : referenceTargetMap.entrySet()) { removeReference(entry.getKey(), entry.getValue()); } }