private static boolean isInList(@NotNull PsiClassType type, @Nullable GrReferenceList list) {
    if (list == null) return false;

    PsiClass resolved = type.resolve();
    if (resolved == null) return true;

    PsiManager manager = list.getManager();
    GrCodeReferenceElement[] elements = list.getReferenceElementsGroovy();
    for (GrCodeReferenceElement element : elements) {
      if (manager.areElementsEquivalent(resolved, element.resolve())) {
        return true;
      }
    }
    return false;
  }
private static boolean isInList(@NotNull PsiClassType type, @Nullable GrReferenceList list)