void () { PsiPackage rootPackage = JavaPsiFacade.getInstance(getProject()).findPackage(""); assertNotNull(rootPackage); List<String> diffs = new ArrayList<>(); JavaRecursiveElementVisitor visitor = new PackageVisitor(GlobalSearchScope.moduleWithLibrariesScope(getModule())) { @Override protected void visitSubPackage(PsiPackage aPackage, PsiClass[] classes) { for (PsiClass aClass : classes) { for (PsiMethod method : aClass.getMethods()) { if (method.isPhysical()) { checkMethodAnnotations(method, diffs); } } for (PsiField field : aClass.getFields()) { checkFieldAnnotations(field, diffs); } } } }; rootPackage.accept(visitor); LOG.debug(String.valueOf(ClassDataIndexer.ourIndexSizeStatistics)); assertEmpty(diffs); }