Search in sources :

Example 1 with RefJavaUtil

use of com.intellij.codeInspection.reference.RefJavaUtil in project intellij-community by JetBrains.

the class InitializationDependencyUtils method tabulateInitializationDependentClasses.

@SuppressWarnings({ "MethodWithMultipleLoops" })
private static void tabulateInitializationDependentClasses(RefElement element, Set<RefClass> dependents) {
    final Collection<RefElement> references = element.getInReferences();
    final RefJavaUtil refUtil = RefJavaUtil.getInstance();
    for (RefElement reference : references) {
        final RefClass refClass = refUtil.getTopLevelClass(reference);
        if (refClass != null) {
            dependents.add(refClass);
        }
    }
    final List<RefEntity> children = element.getChildren();
    for (RefEntity child : children) {
        if (child instanceof RefElement) {
            tabulateInitializationDependentClasses((RefElement) child, dependents);
        }
    }
}
Also used : RefElement(com.intellij.codeInspection.reference.RefElement) RefClass(com.intellij.codeInspection.reference.RefClass) RefEntity(com.intellij.codeInspection.reference.RefEntity) RefJavaUtil(com.intellij.codeInspection.reference.RefJavaUtil)

Example 2 with RefJavaUtil

use of com.intellij.codeInspection.reference.RefJavaUtil in project intellij-community by JetBrains.

the class InitializationDependencyUtils method tabulateInitializationDependencyClasses.

@SuppressWarnings({ "MethodWithMultipleLoops" })
static void tabulateInitializationDependencyClasses(RefElement element, Set<RefClass> dependencies) {
    final Collection<RefElement> references = element.getOutReferences();
    final RefJavaUtil refUtil = RefJavaUtil.getInstance();
    for (RefElement reference : references) {
        final RefClass refClass = refUtil.getTopLevelClass(reference);
        if (refClass != null) {
            dependencies.add(refClass);
        }
    }
    final List<RefEntity> children = element.getChildren();
    for (RefEntity child : children) {
        if (child instanceof RefElement) {
            tabulateInitializationDependencyClasses((RefElement) child, dependencies);
        }
    }
}
Also used : RefElement(com.intellij.codeInspection.reference.RefElement) RefClass(com.intellij.codeInspection.reference.RefClass) RefEntity(com.intellij.codeInspection.reference.RefEntity) RefJavaUtil(com.intellij.codeInspection.reference.RefJavaUtil)

Aggregations

RefClass (com.intellij.codeInspection.reference.RefClass)2 RefElement (com.intellij.codeInspection.reference.RefElement)2 RefEntity (com.intellij.codeInspection.reference.RefEntity)2 RefJavaUtil (com.intellij.codeInspection.reference.RefJavaUtil)2