BaseInspectionVisitor () { return new BaseInspectionVisitor() { @Override public void visitJavaFile(@NotNull PsiJavaFile file) { final PsiPackageStatement packageStatement = file.getPackageStatement(); if (packageStatement == null) { return; } final PsiJavaCodeReferenceElement packageReference = packageStatement.getPackageReference(); final PsiElement target = packageReference.resolve(); if (!(target instanceof PsiPackage aPackage)) { return; } if (MoveAnnotationToPackageInfoFileFix.getPackageInfoFile(aPackage) != null) { return; } registerError(packageReference, packageStatement); } }; }