semver4j
semver4j copied to clipboard
isEqualTo has broken semantics for NPM type (is not symmetric)
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.
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.
@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