Aaron Patterson 5ccaeee2e8 [ruby/rubygems] Undeprecate Gem::Version.new(nil)
It seems like we were trying to deprecate passing `nil` to
Gem::Version.new.  This breaks existing code, and I don't think there is
a good reason to deprecate this usage.

I believe what we want to prevent is the following code:

```ruby
Gem::Specification.new do |spec|
  spec.version = nil
  # suddenly the spec version is 0!
  p spec.version
end
```

This commit allows people to manually construct `Gem::Version.new(nil)`,
but when someone assigns `nil` as the Gem specification version, it sets
the spec version to `nil` (making the specification invalid).  People
who manually construct `Gem::Version` objects and use nil should be
allowed to do it, and `Gem::Version.new(nil) == Gem::Version.new("0")`,
but people who assign `nil` in a gemspec will get an invalid gemspec.

I think deprecation started
[here](https://github.com/ruby/rubygems/pull/2203) but there doesn't
seem to be a reason to do it.

Fixes https://github.com/ruby/rubygems/pull/9052

https://github.com/ruby/rubygems/commit/ded5e909c2
2025-11-18 04:53:07 +00:00
..