/** Check if the given {@link Element} is visible in the given {@link Source}. */ protected static boolean isInTheSameLibrary( Element element, AnalysisContext context, Source source) { // should be the same AnalysisContext if (!isInContext(element, context)) { return false; } // private elements are visible only in their library Source[] librarySourcesOfSource = context.getLibrariesContaining(source); Source librarySourceOfElement = element.getLibrary().getSource(); return ArrayUtils.contains(librarySourcesOfSource, librarySourceOfElement); }