Set<PsiElement> () { Set<PsiElement> parents = new HashSet<>(); TaintNode parent = ObjectUtils.tryCast(getParentDescriptor(), TaintNode.class); while (parent != null) { PsiElement parentPsiElement = parent.getPsiElement(); if (parentPsiElement == null || parent.getParentDescriptor() == null) return parents; parents.add(parentPsiElement); parent = ObjectUtils.tryCast(parent.getParentDescriptor(), TaintNode.class); } return parents; }