semver4j icon indicating copy to clipboard operation
semver4j copied to clipboard

Handle prereleases and big numbers

Open kmck opened this issue 6 years ago • 5 comments

Hey again! Came across some more issues that my last PR didn't address (or maybe introduced).

  • I'm not much of a Java programmer, and it turns out that comparing Integers with == is a problem with numbers over 127! Who knew. (Don't ask why I need this to work with giant version numbers... 😅)
  • Fixed a case where the minor version wasn't checked for ranges that omitted the patch version
  • Modified isSatisfied to properly reject prerelease versions when a non-prerelease range is specified (eg. 2.0.0-beta should not satisfy <2.0.0 even though it's a lower version)
  • Wildcard no longer matches pre-release versions. This seems to be consistent with the Node version. I was using https://semver.npmjs.com for reference

kmck avatar Sep 14 '19 01:09 kmck

Bump! Any chance of this getting merged soon?

kmck avatar Sep 25 '19 19:09 kmck

@vdurmont would you mind taking a look at this?

kmck avatar Oct 10 '19 18:10 kmck

☠️

kmck avatar Nov 05 '19 21:11 kmck

@vdurmont I made some more changes and believe it may resolve some open issues around versions. Do you think you could take a look when you get a chance?

Some of the changes in particular:

  • isSatisfiedBy now requires the version being tested to include a minor and patch version. This is a rather opinionated change, but I think it probably makes sense as you're most likely checking a fully-qualified version against a requirement. Issues where an incomplete version (#15, #46, #48) will fail explicitly.
  • Moved the loose minor/patch version check from isEqualTo to isEquivalentTo and fixed the check. This fixes the semantics of isEqualTo (#43), although isEquivalentTo is still non symmetric so that it can validate a fully-qualified version against a less-qualified version.

kmck avatar Oct 15 '20 00:10 kmck

@vdurmont , could we get this PR reviewed, merged and released ?

hemikak avatar Feb 18 '21 18:02 hemikak