@NotNull
  private static Rectangle union(Rectangle r1, Rectangle r2) {
    if (r1 == null) return r2;
    if (r2 == null) return r1;
    return r1.union(r2);
  }
@NotNull
  private static Rectangle union(Rectangle r1, Rectangle r2)