@Nullable public static HighlightInfo checkPackageAnnotationContainingFile( final PsiPackageStatement statement) { if (statement.getAnnotationList() == null) { return null; } PsiFile file = statement.getContainingFile(); if (file != null && !PsiPackage.PACKAGE_INFO_FILE.equals(file.getName())) { String description = JavaErrorMessages.message("invalid.package.annotation.containing.file"); HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR); builder.range(statement.getAnnotationList().getTextRange()); builder.descriptionAndTooltip(description); return builder.create(); } return null; }