use of com.intellij.psi.PsiClassOwner in project intellij-plugins by JetBrains.
the class PackageAccessibilityInspection method checkFile.
@Nullable
@Override
public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull final InspectionManager manager, final boolean isOnTheFly) {
if (!(file instanceof PsiClassOwner) || !checkTests && ProjectRootsUtil.isInTestSource(file)) {
return null;
}
final OsmorcFacet facet = OsmorcFacet.getInstance(file);
if (facet == null) {
return null;
}
final List<ProblemDescriptor> problems = ContainerUtil.newSmartList();
DependenciesBuilder.analyzeFileDependencies(file, new DependenciesBuilder.DependencyProcessor() {
@Override
public void process(PsiElement place, PsiElement dependency) {
if (dependency instanceof PsiClass) {
Problem problem = checkAccessibility((PsiClass) dependency, facet);
if (problem != null) {
problems.add(manager.createProblemDescriptor(place, problem.message, isOnTheFly, problem.fixes, problem.type));
}
}
}
}, DependencyVisitorFactory.VisitorOptions.SKIP_IMPORTS);
return problems.isEmpty() ? null : problems.toArray(new ProblemDescriptor[problems.size()]);
}
Aggregations