@@ -37,10 +37,12 @@ public class Version implements Comparable<Version> {
3737 public final static Version V3_1_10 = new Version ("3.1.10" , 3 , 1 , 10 , 3347 , true );
3838 public final static Version V3_1_11 = new Version ("3.1.11" , 3 , 1 , 11 , 3557 , true );
3939 public final static Version V3_1_12 = new Version ("3.1.12" , 3 , 1 , 12 , 3876 , true );
40+ public final static Version V3_1_13 = new Version ("3.1.13" , 3 , 1 , 13 , 3592 , true );
41+
4042 private final static Map <String , Version > knownVersions =
41- Stream .of (V3_0_0 , V3_0_1 , V3_0_2 , V3_0_3 , V3_0_4 , V3_1_0 , V3_1_1 , V3_1_2 , V3_1_3 , V3_1_4 , V3_1_5 , V3_1_6 , V3_1_7 , V3_1_8 , V3_1_9 , V3_1_10 , V3_1_11 , V3_1_12 )
43+ Stream .of (V3_0_0 , V3_0_1 , V3_0_2 , V3_0_3 , V3_0_4 , V3_1_0 , V3_1_1 , V3_1_2 , V3_1_3 , V3_1_4 , V3_1_5 , V3_1_6 , V3_1_7 , V3_1_8 , V3_1_9 , V3_1_10 , V3_1_11 , V3_1_13 )
4244 .collect (toMap (Version ::toString , Function .identity ()));
43- public final static Version LATEST = V3_1_12 ;
45+ public final static Version LATEST = V3_1_13 ;
4446
4547 private final String origString ;
4648 private final Integer major ;
@@ -64,7 +66,8 @@ private Version(String origString, @Nullable Integer major, @Nullable Integer mi
6466 */
6567 @ Deprecated ()
6668 public Version (String versionString ) {
67- assert versionString != null ;
69+ Objects .requireNonNull (versionString );
70+
6871 Version dummy = parseVersionString (versionString );
6972
7073 this .origString = dummy .origString ;
@@ -110,8 +113,7 @@ private static Version parseVersionString(String origString) {
110113 // We need a valid major version as minimum requirement for a Version object to be valid
111114 valid = major != null ;
112115 }
113- } catch (NumberFormatException e ) {
114- valid = false ;
116+ } catch (NumberFormatException ignore ) {
115117 }
116118
117119 return new Version (origString , major , minor , bugfix , build , valid );
@@ -149,7 +151,7 @@ public boolean isValid() {
149151 /**
150152 * Returns a normalized form of the parsed version information
151153 *
152- * @return
154+ * @return normalized string
153155 */
154156 public String getNormalizedString () {
155157 if (isValid ()) {
@@ -213,9 +215,8 @@ public int compareTo(Version o, boolean nullMeansEqual) {
213215 }
214216
215217 curResult = compareToWithNulls (getBuild (), o .getBuild (), nullMeansEqual );
216- if (curResult != 0 ) {
217- return curResult ;
218- }
218+
219+ return curResult ;
219220 }
220221
221222 return 0 ;
@@ -234,11 +235,11 @@ private void versionsAreValid(Version v) throws InvalidVersionException {
234235 /**
235236 * Compares this version to a given version and returns true if this version is greater or equal than the given one
236237 * If one of the version parts of the base version is null, this level is assumed equal no matter the comparing level's version part
237- * Throws an InvalidVersionException if either this or the given version are invalid
238+ * Throws an {@link InvalidVersionException} if either this or the given version are invalid
238239 *
239240 * @param v Version to compare with
240- * @return
241- * @throws InvalidVersionException
241+ * @return true if is greater or equal
242+ * @throws InvalidVersionException If the version does not match
242243 */
243244 public boolean isGreaterOrEqualThan (Version v ) throws InvalidVersionException {
244245
@@ -247,7 +248,15 @@ public boolean isGreaterOrEqualThan(Version v) throws InvalidVersionException {
247248 return compareTo (v , true ) >= 0 ;
248249 }
249250
250-
251+ /**
252+ * Compares this version to a given version and returns true if this version is greater than the given one
253+ * If one of the version parts of the base version is null, this level is assumed equal no matter the comparing level's version part
254+ * Throws an {@link InvalidVersionException} if either this or the given version are invalid
255+ *
256+ * @param v Version to compare with
257+ * @return true if is greater
258+ * @throws InvalidVersionException If the version does not match
259+ */
251260 public boolean isGreaterThan (Version v ) throws InvalidVersionException {
252261 versionsAreValid (v );
253262
@@ -257,11 +266,11 @@ public boolean isGreaterThan(Version v) throws InvalidVersionException {
257266 /**
258267 * Compares this version to a given version and returns true if this version is less or equal than the given one
259268 * If one of the version parts of the base version is null, this level is assumed equal no matter the comparing level's version part
260- * Throws an InvalidVersionException if either this or the given version are invalid
269+ * Throws an {@link InvalidVersionException} if either this or the given version are invalid
261270 *
262271 * @param v Version to compare with
263- * @return
264- * @throws InvalidVersionException
272+ * @return if version is less or equal
273+ * @throws InvalidVersionException If version is invalid
265274 */
266275 public boolean isLessOrEqualThan (Version v ) throws InvalidVersionException {
267276
@@ -270,6 +279,15 @@ public boolean isLessOrEqualThan(Version v) throws InvalidVersionException {
270279 return compareTo (v , true ) <= 0 ;
271280 }
272281
282+ /**
283+ * Compares this version to a given version and returns true if this version is less than the given one
284+ * If one of the version parts of the base version is null, this level is assumed equal no matter the comparing level's version part
285+ * Throws an {@link InvalidVersionException} if either this or the given version are invalid
286+ *
287+ * @param v Version to compare with
288+ * @return if version is less
289+ * @throws InvalidVersionException If version is invalid
290+ */
273291 public boolean isLessThan (Version v ) throws InvalidVersionException {
274292 versionsAreValid (v );
275293
0 commit comments