private static @Nullable Icon scaleIconToSize(@Nullable Icon icon, int maxIconWidth, int maxIconHeight) {
    if (icon == null) {
      return icon;
    }

    if (icon instanceof EmptyIcon) {
      return icon.getIconWidth() == maxIconWidth && icon.getIconHeight() == maxIconHeight
             ? icon
             : EmptyIcon.create(maxIconWidth, maxIconHeight);
    }

    float scale = (float)Math.min(maxIconWidth, maxIconHeight) / Math.min(icon.getIconWidth(), icon.getIconHeight());
    return scale == 1 ? icon : CustomIconUtilKt.scaleIconOrLoadCustomVersion(icon, scale);
  }
private static @Nullable Icon scaleIconToSize(@Nullable Icon icon, int maxIconWidth, int maxIconHeight)