@ApiStatus.Internal
  @Nullable
  static PackageSet doExcludeSelected(@NotNull PackageSet set, @Nullable PackageSet current) {
    if (current == null) {
      current = new ComplementPackageSet(set);
    }
    else if (current instanceof InvalidPackageSet) {
      current = StringUtil.isEmpty(current.getText())
                ? new ComplementPackageSet(set)
                : IntersectionPackageSet.create(current, new ComplementPackageSet(set));
    }
    else {
      final boolean[] append = {true};
      final PackageSet simplifiedScope = processComplementaryScope(current, set, false, append);
      if (!append[0]) {
        current = simplifiedScope;
      }
      else if (simplifiedScope == null) {
        current = new ComplementPackageSet(set);
      }
      else {
        PackageSet[] sets = simplifiedScope instanceof IntersectionPackageSet ?
                            ((IntersectionPackageSet)simplifiedScope).getSets() :
                            new PackageSet[]{simplifiedScope};

        current = IntersectionPackageSet.create(ArrayUtil.append(sets, new ComplementPackageSet(set)));
      }
    }
    return current;
  }
@ApiStatus.Internal
  @Nullable
  static PackageSet doExcludeSelected(@NotNull PackageSet set, @Nullable PackageSet current)