Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isEqualTo has broken semantics for NPM type (is not symmetric) #43

Open
broglep-work opened this issue Jan 23, 2020 · 2 comments
Open

Comments

@broglep-work
Copy link

The changes in #36 resulted in quite unexpected isEqualTo semantics:

final Semver v1 = new Semver("2.10.1", Semver.SemverType.NPM);
final Semver v2 = new Semver("2.99", Semver.SemverType.NPM);

System.out.println(v1.isEqualTo(v2)); // --> true
System.out.println(v2.isEqualTo(v1)); // --> false

This violates basic symmetric requirement on the equality operation.

@michaelkrog
Copy link

I second that.
Issue seems to be here:
https://github.com/vdurmont/semver4j/blob/master/src/main/java/com/vdurmont/semver4j/Semver.java#L360

If version being checked against does not have patch (fx. 1.0 instead of 1.0.0) then the result is always true.

@piotrooo
Copy link

@broglep-work if you are still interesting, I've made copy of this lib and fix bug reported by you. Look for version 2.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants