List<PsiJavaCodeReferenceElement> (PsiFile file, @Nullable final PsiJavaCodeReferenceElement refExpr, final PsiImportStaticStatement staticImport) { final List<PsiJavaCodeReferenceElement> expressionToExpand = new ArrayList<>(); file.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement expression) { if (refExpr != expression) { final PsiElement resolveScope = expression.advancedResolve(true).getCurrentFileResolveScope(); if (resolveScope == staticImport) { expressionToExpand.add(expression); } } super.visitElement(expression); } }); return expressionToExpand; }