From 0dcfda525c68f4c672dce542e5ec42ef3acca219 Mon Sep 17 00:00:00 2001 From: julien Date: Mon, 25 Aug 2014 15:32:48 -0700 Subject: fix next --- api/src/main/java/org/semver/Version.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'api/src/main') diff --git a/api/src/main/java/org/semver/Version.java b/api/src/main/java/org/semver/Version.java index 8b14d3c..09046b8 100755 --- a/api/src/main/java/org/semver/Version.java +++ b/api/src/main/java/org/semver/Version.java @@ -125,11 +125,23 @@ public final class Version implements Comparable { switch (element) { case MAJOR: - return new Version(this.major+1, 0, 0); + if (special == null || this.minor != 0 || this.patch != 0) { + return new Version(this.major + 1, 0, 0); + } else { + return new Version(this.major, 0, 0); + } case MINOR: - return new Version(this.major, this.minor+1, 0); + if (special == null || this.patch != 0) { + return new Version(this.major, this.minor + 1, 0); + } else { + return new Version(this.major, this.minor, 0); + } case PATCH: - return new Version(this.major, this.minor, this.patch+1); + if (special == null) { + return new Version(this.major, this.minor, this.patch + 1); + } else { + return new Version(this.major, this.minor, this.patch); + } default: throw new IllegalArgumentException("Unknown element <"+element+">"); } -- cgit v1.2.3