public static @Nullable PsiElement getContainer(PsiElement unresolvedReference) {
    PsiElement container = PsiTreeUtil.getParentOfType(unresolvedReference, PsiCodeBlock.class, PsiClass.class);
    if (!(container instanceof PsiCodeBlock)) return null;
    while (container.getParent() instanceof PsiStatement || container.getParent() instanceof PsiCatchSection) {
      container = container.getParent();
    }
    return container;
  }
public static @Nullable PsiElement getContainer(PsiElement unresolvedReference)