BaseInspectionVisitor () { return new BaseInspectionVisitor() { @Override public void visitFile(@NotNull GroovyFileBase file) { if (!(file instanceof GroovyFile)) return; if (!myCheckScripts && file.isScript()) return; String expectedPackage = ExpectedPackageNameProviderKt.inferExpectedPackageName((GroovyFile)file); String actual = file.getPackageName(); if (!expectedPackage.equals(actual)) { PsiElement toHighlight = getElementToHighlight((GroovyFile)file); if (toHighlight == null) return; registerError(toHighlight, GroovyBundle.message("inspection.message.package.name.mismatch.actual.0.expected.1", actual, expectedPackage), new LocalQuickFix[]{new ChangePackageQuickFix(expectedPackage), GroovyQuickFixFactory.getInstance().createGrMoveToDirFix(actual)}, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } } }; }