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

Add missing @Override annotations #23

Merged
merged 1 commit into from
Nov 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/main/java/hudson/util/VersionNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private interface Item {
*/
private static class WildCardItem implements Item {

@Override
public int compareTo(Item item) {
if (item==null) // 1.* ( > 1.99) > 1
return 1;
Expand All @@ -103,10 +104,12 @@ public int compareTo(Item item) {
}
}

@Override
public int getType() {
return WILDCARD_ITEM;
}

@Override
public boolean isNull() {
return false;
}
Expand Down Expand Up @@ -136,14 +139,17 @@ public IntegerItem(String str) {
this.value = new BigInteger(str);
}

@Override
public int getType() {
return INTEGER_ITEM;
}

@Override
public boolean isNull() {
return BigInteger_ZERO.equals(value);
}

@Override
public int compareTo(Item item) {
if (item == null) {
return BigInteger_ZERO.equals(value) ? 0 : 1; // 1.0 == 1, 1.1 > 1
Expand All @@ -167,6 +173,7 @@ public int compareTo(Item item) {
}
}

@Override
public String toString() {
return value.toString();
}
Expand Down Expand Up @@ -217,10 +224,12 @@ public StringItem(String value, boolean followedByDigit) {
this.value = ALIASES.getProperty(value, value);
}

@Override
public int getType() {
return STRING_ITEM;
}

@Override
public boolean isNull() {
return (comparableQualifier(value).compareTo(RELEASE_VERSION_INDEX) == 0);
}
Expand All @@ -241,6 +250,7 @@ public static String comparableQualifier(String qualifier) {
return i == -1 ? _QUALIFIERS.size() + "-" + qualifier : String.valueOf(i);
}

@Override
public int compareTo(Item item) {
if (item == null) {
// 1-rc < 1, 1-ga > 1
Expand All @@ -264,6 +274,7 @@ public int compareTo(Item item) {
}
}

@Override
public String toString() {
return value;
}
Expand All @@ -274,10 +285,12 @@ public String toString() {
* with '-(number)' in the version specification).
*/
private static class ListItem extends ArrayList<Item> implements Item {
@Override
public int getType() {
return LIST_ITEM;
}

@Override
public boolean isNull() {
return (size() == 0);
}
Expand All @@ -293,6 +306,7 @@ void normalize() {
}
}

@Override
public int compareTo(Item item) {
if (item == null) {
if (size() == 0) {
Expand Down Expand Up @@ -344,6 +358,7 @@ public int compareTo(Item item) {
}
}

@Override
public String toString() {
StringBuilder buffer = new StringBuilder("(");
for (Iterator<Item> iter = iterator(); iter.hasNext(); ) {
Expand Down Expand Up @@ -459,6 +474,7 @@ private static Item parseItem(boolean isDigit, String buf) {
return isDigit ? new IntegerItem(buf) : new StringItem(buf, false);
}

@Override
public int compareTo(VersionNumber o) {
int result = items.compareTo(o.items);
if (result != 0) {
Expand All @@ -483,10 +499,12 @@ public int compareTo(VersionNumber o) {
return Integer.compare(i1, i2);
}

@Override
public String toString() {
return value;
}

@Override
public boolean equals(Object o) {
if (!(o instanceof VersionNumber)) {
return false;
Expand All @@ -505,6 +523,7 @@ public boolean equals(Object o) {
return snapshot.equals(that.snapshot);
}

@Override
public int hashCode() {
return canonical.hashCode();
}
Expand All @@ -528,6 +547,7 @@ public boolean isNewerThanOrEqualTo(VersionNumber rhs) {
/**
* @deprecated see {@link #getDigitAt(int)}
*/
@Deprecated
public int digit(int idx) {
Iterator<Item> i = items.iterator();
Item item = i.next();
Expand Down