aboutsummaryrefslogtreecommitdiffstats
path: root/api/src/main/java
diff options
context:
space:
mode:
authorjulien <[email protected]>2014-08-25 15:32:48 -0700
committerjulien <[email protected]>2014-08-25 15:32:48 -0700
commit0dcfda525c68f4c672dce542e5ec42ef3acca219 (patch)
tree08ef1bc7864ebef4da256ca37c4dfb9da2264cc4 /api/src/main/java
parentd0ca15e2e1844b39c0030f8fb6e4e16b58e9462a (diff)
fix next
Diffstat (limited to 'api/src/main/java')
-rwxr-xr-xapi/src/main/java/org/semver/Version.java18
1 files changed, 15 insertions, 3 deletions
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<Version> {
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+">");
}