int (@NotNull PsiMethod method) { JavaFindUsagesHandlerFactory factory = JavaFindUsagesHandlerFactory.getInstance(getProject()); int[] count = {0}; factory.createFindUsagesHandler(method, false).processElementUsages(method, info -> { count[0]++; return true; }, factory.getFindMethodOptions()); return count[0]; }