PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { return !PsiUtil.isModuleFile(holder.getFile()) ? PsiElementVisitor.EMPTY_VISITOR : new JavaElementVisitor() { @Override public void visitModule(@NotNull PsiJavaModule module) { super.visitModule(module); PsiJavaModuleReferenceElement name = module.getNameIdentifier(); Ref<String> newName = Ref.create(); psiTraverser().children(name).filter(PsiIdentifier.class).forEach(id -> { String text = id.getText(); if (text.length() > 0 && Character.isDigit(text.charAt(text.length() - 1))) { String message = JavaAnalysisBundle.message("inspection.java.module.naming.terminal.digits", text); if (newName.isNull()) { newName.set(StringUtil.join(psiTraverser().children(name).filter(PsiIdentifier.class).map(i -> trimDigits(i.getText())), ".")); } holder.registerProblem(id, message, QuickFixFactory.getInstance().createRenameElementFix(module, newName.get())); } }); } }; }