void (List<PsiJavaCodeReferenceElement> expressionToExpand, @Nullable PsiJavaCodeReferenceElement refExpr, PsiImportStaticStatement staticImport) { if (refExpr != null) { expressionToExpand.add(refExpr); } expressionToExpand.sort((o1, o2) -> o2.getTextOffset() - o1.getTextOffset()); for (PsiJavaCodeReferenceElement expression : expressionToExpand) { expand(expression, staticImport); } staticImport.delete(); }