diff --git a/.editorconfig b/.editorconfig
index eb669a1..763df0e 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,4 +1,4 @@
-root = true
+root=true
[*.{java,kt,kts}]
charset=utf-8
@@ -16,5 +16,5 @@ ij_kotlin_imports_layout=*,java.**,javax.**,kotlin.**,^
[*.java]
ij_java_names_count_to_use_import_on_demand=2147483647
ij_java_class_count_to_use_import_on_demand=2147483647
-ij_java_layout_static_imports_separately = true
-ij_java_imports_layout=*,javax.**,java.**,|,$*
\ No newline at end of file
+ij_java_layout_static_imports_separately=true
+ij_java_imports_layout=*,javax.**,java.**,|,$*
diff --git a/.gitignore b/.gitignore
index 51c2edd..0cdcaaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,189 @@
-*.iml
+# Reference gitignore https://gist.github.com/G00fY2/81c0aa67943cca021e915840bf73ee1b
+
+# Built application files
+*.apk
+*.aar
+*.ap_
+*.aab
+
+# Files for the ART/Dalvik VM
+*.dex
+
+# Java class files
+*.class
+
+# Generated files
+bin/
+gen/
+out/
+
+# Gradle files
.gradle
-/local.properties
-.idea/
+.gradle/
+build/
+gradle-app.setting
+.gradletasknamecache
+
+# Signing files
+.signing/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+# Log Files
+*.log
+
+# Android Studio
+/*/debug/
+/*/release/
+/*/build/
+/*/local.properties
+/*/out
+/*/*/build
+/*/*/production
+/*/*/staging
+*.ipr
+*~
+*.swp
+
+# Android Patch
+gen-external-apklibs
+
+# Android Studio Navigation editor temp files
+.navigation/
+
+# Android Studio captures folder
+captures/
+
+# IntelliJ
+*.iml
+*.iws
+.idea/*
+!.idea/codeStyles/Project.xml
+!.idea/codeStyles/codeStyleConfig.xml
+# optional
+# !.idea/dictionaries
+# !.idea/inspectionProfiles
+# !.idea/runConfigurations
+# !.idea/runConfigurations.xml
+
+# Keystore files
+*.jks
+*.keystore
+
+# External native build folder generated in Android Studio 2.2 and later
+.externalNativeBuild
+
+# NDK
+obj/
+
+# CMake
+cmake-build-*/
+
+# Google Services (e.g. APIs or Firebase)
+google-services.json
+
+# Freeline
+freeline.py
+freeline/
+freeline_project_description.json
+
+# fastlane
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots
+fastlane/test_output
+fastlane/readme.md
+
+#Crashlytics
+crashlytics-build.properties
+com_crashlytics_export_strings.xml
+crashlytics.properties
+fabric.properties
+
+## Plugin-specific files:
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# Mongo Explorer plugin
+.idea/mongoSettings.xml
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+## OS specific files:
+
+# General
.DS_Store
-/build
-/captures
-.externalNativeBuild
\ No newline at end of file
+.DS_Store?
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+# Windows thumbnail cache files
+Thumbs.db
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
\ No newline at end of file
diff --git a/README.md b/README.md
index fb09c55..603cccd 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-Version Compare [![Maven Central](https://img.shields.io/maven-central/v/io.github.g00fy2/versioncompare)](https://search.maven.org/artifact/io.github.g00fy2/versioncompare) [![GitHub Actions](
+Version Compare [![GitHub Actions](
https://github.com/g00fy2/version-compare/actions/workflows/build.yml/badge.svg)](https://github.com/G00fY2/version-compare/actions) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=G00fY2_version-compare&metric=coverage)](https://sonarcloud.io/dashboard?id=G00fY2_version-compare)
=====
Lightweight library for Android, Java and Kotlin to compare version strings.
@@ -7,25 +7,58 @@ This library allows you to easily compare version strings. Versions can but do n
Pure Java (java.util), no dependencies, very small method count.
-## Usage
-> ⚠️ **With version 1.4.0 this library moved to MavenCentral! As a result the *groupId* had to be changed. If you use the old `com.g00fy2:versioncompare` artifact check out the migration guide in the [release notes](https://github.com/G00fY2/version-compare/releases/tag/1.4.0).**
+## Download [![Maven Central](https://img.shields.io/maven-central/v/io.github.g00fy2/versioncompare)](https://search.maven.org/artifact/io.github.g00fy2/versioncompare)
-**Gradle:**
-```
+
+ Gradle
+
+```kotlin
dependencies {
- implementation("io.github.g00fy2:versioncompare:1.4.1")
+ implementation("io.github.g00fy2:versioncompare:1.5.0")
}
```
-**Maven:**
-```
+
+
+ Maven
+
+```xml
io.github.g00fy2
versioncompare
- 1.4.1
+ 1.5.0
```
+
+> ⚠️ Starting with version 1.4.0 this library moved to MavenCentral. As a result the *groupId* had to be changed. If you use the old `com.g00fy2:versioncompare` artifact check out the migration guide in the [release notes](https://github.com/G00fY2/version-compare/releases/tag/1.4.0).
+
+## Usage
To compare two version strings just create a new Version object. Invalid inputs (*null* or non-numeric first char) will by default be handled as `0.0.0`.
+
+
+ Kotlin
+
+You can use the default [comparison operators](https://kotlinlang.org/docs/operator-overloading.html#comparison-operators) to compare version objects:
+
+```kotlin
+var result: Boolean
+
+result = Version("1.2.1") > Version("1.2") // result = true
+
+result = Version("1.0.2-rc2") < Version("1.0.2-rc3") // result = true
+
+result = Version("1.3") == Version("1.3.0") // result = true
+
+result = Version("2.1.0") >= Version("2.0") // result = true
+
+result = Version("2.0.0-beta") >= Version("2.0") // result = false
+result = Version("2.0.0-beta").isAtLeast("2.0", /* ignoreSuffix: */ true) // result = true
+```
+
+
+
+ Java
+
```java
boolean result;
@@ -38,6 +71,7 @@ result = new Version("1.3").isEqual("1.3.0"); // result = true
result = new Version("2.0.0-beta").isAtLeast("2.0"); // result = false
result = new Version("2.0.0-beta").isAtLeast("2.0", /* ignoreSuffix: */ true); // result = true
```
+
### For more detailed usage, check out the [documentation](https://g00fy2.github.io/version-compare/io/github/g00fy2/versioncompare/Version.html).
@@ -90,7 +124,7 @@ suffix compare logic ||
## Sample App
![Image](https://raw.githubusercontent.com/G00fY2/version-compare/gh-pages/images/version_compare_sampleapp_framed.png)
-**Try out the sample app to compare your version inputs: [Download APK](https://github.com/G00fY2/version-compare/releases/download/1.4.1/version-compare-1.4.1-sample.apk)**
+**Try out the sample app to compare your version inputs: [Download APK](https://github.com/G00fY2/version-compare/releases/download/1.5.0/version-compare-1.5.0-sample.apk)**
## License
Copyright (C) 2021 Thomas Wirth
diff --git a/build.gradle.kts b/build.gradle.kts
index eeb18e5..8a0c650 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,27 +1,17 @@
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-
plugins {
- id("com.android.application") version "4.1.3" apply false
- kotlin("android") version "1.4.32" apply false
- id("org.sonarqube") version "3.1.1"
+ id("com.android.application") version "7.0.4" apply false
+ kotlin("android") version "1.6.10" apply false
+ id("org.sonarqube") version "3.3"
}
subprojects {
apply(plugin = "org.sonarqube")
- sonarqube {
- if (name == "sample") {
- isSkipProject = true
- } else {
- properties {
- property("sonar.coverage.jacoco.xmlReportPaths", "$buildDir/reports/jacoco/test/jacocoTestReport.xml")
- }
- }
- }
-
- tasks.withType().configureEach {
- kotlinOptions {
- jvmTarget = JavaVersion.VERSION_1_8.toString()
+ if (name == "sample") {
+ sonarqube.isSkipProject = true
+ } else {
+ sonarqube.properties {
+ property("sonar.coverage.jacoco.xmlReportPaths", "$buildDir/reports/jacoco/test/jacocoTestReport.xml")
}
}
}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index e708b1c..7454180 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 3c4101c..2e6e589 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 4f906e0..a58591e 100755
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
-#!/usr/bin/env sh
+#!/bin/sh
#
-# Copyright 2015 the original author or authors.
+# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,67 +17,101 @@
#
##############################################################################
-##
-## Gradle start up script for UN*X
-##
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
##############################################################################
# Attempt to set APP_HOME
+
# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
+APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
warn () {
echo "$*"
-}
+} >&2
die () {
echo
echo "$*"
echo
exit 1
-}
+} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACMD=$JAVA_HOME/jre/sh/java
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
- JAVACMD="java"
+ JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@@ -106,80 +140,95 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
fi
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
fi
- i=`expr $i + 1`
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
done
- case $i in
- 0) set -- ;;
- 1) set -- "$args0" ;;
- 2) set -- "$args0" "$args1" ;;
- 3) set -- "$args0" "$args1" "$args2" ;;
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
fi
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=`save "$@"`
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
-exec "$JAVACMD" "$@"
+exec "$JAVACMD" "$@"
\ No newline at end of file
diff --git a/sample/.gitignore b/sample/.gitignore
deleted file mode 100644
index 7b7f1b1..0000000
--- a/sample/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/build
-/debug
-/release
diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts
index 6154272..3f3dbfd 100644
--- a/sample/build.gradle.kts
+++ b/sample/build.gradle.kts
@@ -2,12 +2,13 @@ plugins {
id("com.android.application")
id("kotlin-android")
}
+
android {
- compileSdkVersion(30)
+ compileSdk = 31
defaultConfig {
applicationId = "io.github.g00fy2.versioncomparesample"
- minSdkVersion(14)
- targetSdkVersion(30)
+ minSdk = 14
+ targetSdk = 31
versionCode = 1
versionName = "1.0"
}
@@ -21,25 +22,19 @@ android {
buildFeatures {
viewBinding = true
}
- sourceSets.getByName("main").java.srcDirs("src/main/kotlin")
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
- lintOptions {
- disable(
- "UnusedResources",
- "LockedOrientationActivity",
- "HardcodedText",
- "GoogleAppIndexingWarning",
- "Autofill",
- "AllowBackup"
- )
- isAbortOnError = false
- isIgnoreTestSources = true
+ kotlinOptions {
+ jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
+tasks.lint {
+ enabled = false
+}
+
repositories {
google()
mavenCentral()
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index fe03c82..e210507 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -1,14 +1,18 @@
+ android:theme="@style/AppTheme"
+ android:allowBackup="false">
+ android:exported="true"
+ android:screenOrientation="portrait"
+ tools:ignore="LockedOrientationActivity">
diff --git a/sample/src/main/kotlin/io/github/g00fy2/versioncomparesample/MainActivity.kt b/sample/src/main/kotlin/io/github/g00fy2/versioncomparesample/MainActivity.kt
index d12fc80..d446276 100644
--- a/sample/src/main/kotlin/io/github/g00fy2/versioncomparesample/MainActivity.kt
+++ b/sample/src/main/kotlin/io/github/g00fy2/versioncomparesample/MainActivity.kt
@@ -30,9 +30,9 @@ class MainActivity : Activity() {
val versionA = Version(versionStringA)
val versionB = Version(versionStringB)
- binding.isHigherCheckedtextview.isChecked = versionA.isHigherThan(versionB)
- binding.isLowerCheckedtextview.isChecked = versionA.isLowerThan(versionB)
- binding.isEqualCheckedtextview.isChecked = versionA.isEqual(versionB)
+ binding.isHigherCheckedtextview.isChecked = versionA > versionB
+ binding.isLowerCheckedtextview.isChecked = versionA < versionB
+ binding.isEqualCheckedtextview.isChecked = versionA == versionB
setVersionDescriptionViews(versionA, versionB)
} else {
diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml
index 5a14780..e800231 100644
--- a/sample/src/main/res/layout/activity_main.xml
+++ b/sample/src/main/res/layout/activity_main.xml
@@ -1,9 +1,11 @@
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 391fdbb..6b9b4c4 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -5,9 +5,4 @@ pluginManagement {
google()
gradlePluginPortal()
}
- resolutionStrategy {
- eachPlugin {
- if (requested.id.namespace == "com.android") useModule("com.android.tools.build:gradle:${requested.version}")
- }
- }
}
\ No newline at end of file
diff --git a/versioncompare/.gitignore b/versioncompare/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/versioncompare/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/versioncompare/build.gradle.kts b/versioncompare/build.gradle.kts
index ecd9a45..1ee2099 100644
--- a/versioncompare/build.gradle.kts
+++ b/versioncompare/build.gradle.kts
@@ -11,34 +11,35 @@ java {
}
jacoco {
- toolVersion = "0.8.6"
+ toolVersion = "0.8.7"
}
tasks.test {
+ testLogging.events("failed", "passed", "skipped")
finalizedBy(tasks.jacocoTestReport)
}
+
tasks.jacocoTestReport {
reports {
- xml.isEnabled = true
- csv.isEnabled = false
+ xml.required.set(true)
+ csv.required.set(false)
}
}
repositories {
- google()
mavenCentral()
}
dependencies {
- compileOnly("com.google.code.findbugs:jsr305:3.0.2")
+ compileOnly("org.jetbrains:annotations:23.0.0")
testImplementation("junit:junit:4.13.2")
- testImplementation("nl.jqno.equalsverifier:equalsverifier:3.5.5")
+ testImplementation("nl.jqno.equalsverifier:equalsverifier:3.8.1")
}
group = "io.github.g00fy2"
-version = "1.4.1"
-rootProject.version = "1.4.1" // set version for sonarcloud
+version = "1.5.0"
+rootProject.version = "1.5.0" // set version for sonarcloud
tasks.register("javadocJar") {
archiveClassifier.set("javadoc")
@@ -108,8 +109,8 @@ signing {
}
fun Project.findStringProperty(propertyName: String): String? {
- return findProperty(propertyName) as String? ?: {
- logger.error("$propertyName missing in gradle.properties")
+ return findProperty(propertyName) as String? ?: run {
+ println("$propertyName missing in gradle.properties")
null
- }()
+ }
}
\ No newline at end of file
diff --git a/versioncompare/src/main/java/io/github/g00fy2/versioncompare/Version.java b/versioncompare/src/main/java/io/github/g00fy2/versioncompare/Version.java
index b3b43ca..4e91cfb 100644
--- a/versioncompare/src/main/java/io/github/g00fy2/versioncompare/Version.java
+++ b/versioncompare/src/main/java/io/github/g00fy2/versioncompare/Version.java
@@ -1,21 +1,23 @@
package io.github.g00fy2.versioncompare;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
-@SuppressWarnings("WeakerAccess")
public class Version implements Comparable {
@Nullable
private final String originalString;
- @Nonnull
- private final List subversionNumbers = new ArrayList<>();
- @Nonnull
- private final List subversionNumbersWithoutTrailingZeros = new ArrayList<>();
- @Nonnull
- private String suffix = "";
+ @NotNull
+ private final List<@NotNull Long> subversionNumbers = new ArrayList<>();
+ @NotNull
+ private final List<@NotNull Long> trimmedSubversionNumbers = new ArrayList<>();
+ @NotNull
+ private final String suffix;
+ @NotNull
+ private final VersionComparator.ReleaseType releaseType;
+ private final long preReleaseVersion;
/**
* Initializes a newly created Version object that represents the parsed version information.
@@ -41,7 +43,7 @@ public Version(@Nullable String versionString) {
public Version(@Nullable String versionString, boolean throwExceptions) {
if (throwExceptions) {
if (versionString == null) {
- throw new NullPointerException("Argument versionString is null");
+ throw new IllegalArgumentException("Argument versionString is null");
}
if (!VersionComparator.startsNumeric(versionString)) {
throw new IllegalArgumentException("Argument versionString is no valid version");
@@ -49,7 +51,44 @@ public Version(@Nullable String versionString, boolean throwExceptions) {
}
originalString = versionString;
- initVersion();
+ if (originalString != null && VersionComparator.startsNumeric(originalString)) {
+ String[] versionTokens = originalString.replaceAll("\\s", "").split("\\.");
+ boolean suffixFound = false;
+ StringBuilder suffixSb = null;
+
+ for (String versionToken : versionTokens) {
+ if (suffixFound) {
+ suffixSb.append(".");
+ suffixSb.append(versionToken);
+ } else if (VersionComparator.isNumeric(versionToken)) {
+ subversionNumbers.add(VersionComparator.safeParseLong(versionToken));
+ } else {
+ for (int i = 0; i < versionToken.length(); i++) {
+ if (!Character.isDigit(versionToken.charAt(i))) {
+ suffixSb = new StringBuilder();
+ if (i > 0) {
+ subversionNumbers.add(VersionComparator.safeParseLong(versionToken.substring(0, i)));
+ suffixSb.append(versionToken.substring(i));
+ } else {
+ suffixSb.append(versionToken);
+ }
+ suffixFound = true;
+ break;
+ }
+ }
+ }
+ }
+ suffix = (suffixSb != null) ? suffixSb.toString() : "";
+ trimmedSubversionNumbers.addAll(subversionNumbers);
+ while (!trimmedSubversionNumbers.isEmpty() &&
+ trimmedSubversionNumbers.lastIndexOf(0L) == trimmedSubversionNumbers.size() - 1) {
+ trimmedSubversionNumbers.remove(trimmedSubversionNumbers.lastIndexOf(0L));
+ }
+ } else {
+ suffix = "";
+ }
+ releaseType = VersionComparator.qualifierToReleaseType(suffix);
+ preReleaseVersion = VersionComparator.preReleaseVersion(suffix, releaseType);
}
/**
@@ -57,8 +96,8 @@ public Version(@Nullable String versionString, boolean throwExceptions) {
*
* @return the major version, default 0.
*/
- public int getMajor() {
- return subversionNumbers.size() > VersionComparator.MAJOR ? subversionNumbers.get(VersionComparator.MAJOR) : 0;
+ public long getMajor() {
+ return trimmedSubversionNumbers.size() > 0 ? trimmedSubversionNumbers.get(0) : 0L;
}
/**
@@ -66,8 +105,8 @@ public int getMajor() {
*
* @return the minor version, default 0.
*/
- public int getMinor() {
- return subversionNumbers.size() > VersionComparator.MINOR ? subversionNumbers.get(VersionComparator.MINOR) : 0;
+ public long getMinor() {
+ return trimmedSubversionNumbers.size() > 1 ? trimmedSubversionNumbers.get(1) : 0L;
}
/**
@@ -75,8 +114,8 @@ public int getMinor() {
*
* @return the patch version, default 0.
*/
- public int getPatch() {
- return subversionNumbers.size() > VersionComparator.PATCH ? subversionNumbers.get(VersionComparator.PATCH) : 0;
+ public long getPatch() {
+ return trimmedSubversionNumbers.size() > 2 ? trimmedSubversionNumbers.get(2) : 0L;
}
/**
@@ -84,8 +123,8 @@ public int getPatch() {
*
* @return a list with all numeric version parts found, default empty.
*/
- @Nonnull
- public List getSubversionNumbers() {
+ @NotNull
+ public List<@NotNull Long> getSubversionNumbers() {
return subversionNumbers;
}
@@ -94,7 +133,7 @@ public List getSubversionNumbers() {
*
* @return the suffix (first non-numeric part), default empty.
*/
- @Nonnull
+ @NotNull
public String getSuffix() {
return suffix;
}
@@ -130,13 +169,7 @@ public boolean isHigherThan(String otherVersion) {
* @see #isHigherThan(String otherVersion)
*/
public boolean isHigherThan(Version otherVersion) {
- int subversionsResult = VersionComparator.compareSubversionNumbers(
- subversionNumbersWithoutTrailingZeros,
- otherVersion.subversionNumbersWithoutTrailingZeros);
- if (subversionsResult != 0) {
- return subversionsResult > 0;
- }
- return VersionComparator.compareSuffix(suffix, otherVersion.suffix) > 0;
+ return compareTo(otherVersion) > 0;
}
/**
@@ -160,14 +193,7 @@ public boolean isLowerThan(String otherVersion) {
* @see #isLowerThan(String otherVersion)
*/
public boolean isLowerThan(Version otherVersion) {
- int subversionsResult = VersionComparator.compareSubversionNumbers(
- subversionNumbersWithoutTrailingZeros,
- otherVersion.subversionNumbersWithoutTrailingZeros
- );
- if (subversionsResult != 0) {
- return subversionsResult < 0;
- }
- return VersionComparator.compareSuffix(suffix, otherVersion.suffix) < 0;
+ return compareTo(otherVersion) < 0;
}
/**
@@ -191,10 +217,7 @@ public boolean isEqual(String otherVersion) {
* @see #isEqual(String otherVersion)
*/
public boolean isEqual(Version otherVersion) {
- return VersionComparator.compareSubversionNumbers(
- subversionNumbersWithoutTrailingZeros,
- otherVersion.subversionNumbersWithoutTrailingZeros
- ) == 0 && VersionComparator.compareSuffix(suffix, otherVersion.suffix) == 0;
+ return compareTo(otherVersion) == 0;
}
/**
@@ -218,7 +241,7 @@ public boolean isAtLeast(String otherVersion) {
* @see #isAtLeast(String otherVersion)
*/
public boolean isAtLeast(Version otherVersion) {
- return isAtLeast(otherVersion, false);
+ return compareTo(otherVersion) >= 0;
}
/**
@@ -244,77 +267,46 @@ public boolean isAtLeast(String otherVersion, boolean ignoreSuffix) {
* @see #isAtLeast(String otherVersion, boolean ignoreSuffix)
*/
public boolean isAtLeast(Version otherVersion, boolean ignoreSuffix) {
- int subversionsResult = VersionComparator.compareSubversionNumbers(
- subversionNumbersWithoutTrailingZeros,
- otherVersion.subversionNumbersWithoutTrailingZeros
- );
- if (subversionsResult == 0 && !ignoreSuffix) {
- return VersionComparator.compareSuffix(suffix, otherVersion.suffix) >= 0;
- }
- return subversionsResult >= 0;
+ return compareTo(otherVersion, ignoreSuffix) >= 0;
}
- private void initVersion() {
- if (originalString != null && VersionComparator.startsNumeric(originalString)) {
- String[] versionTokens = originalString.replaceAll("\\s", "").split("\\.");
- boolean suffixFound = false;
- StringBuilder suffixSb = null;
-
- for (String versionToken : versionTokens) {
- if (suffixFound) {
- suffixSb.append(".");
- suffixSb.append(versionToken);
- } else if (VersionComparator.isNumeric(versionToken)) {
- subversionNumbers.add(VersionComparator.safeParseInt(versionToken));
- } else {
- for (int i = 0; i < versionToken.length(); i++) {
- if (!Character.isDigit(versionToken.charAt(i))) {
- suffixSb = new StringBuilder();
- if (i > 0) {
- subversionNumbers.add(VersionComparator.safeParseInt(versionToken.substring(0, i)));
- suffixSb.append(versionToken.substring(i));
- } else {
- suffixSb.append(versionToken);
- }
- suffixFound = true;
- break;
- }
- }
- }
- }
- subversionNumbersWithoutTrailingZeros.addAll(subversionNumbers);
- while (!subversionNumbersWithoutTrailingZeros.isEmpty() &&
- subversionNumbersWithoutTrailingZeros.lastIndexOf(0) == subversionNumbersWithoutTrailingZeros.size() - 1) {
- subversionNumbersWithoutTrailingZeros.remove(subversionNumbersWithoutTrailingZeros.lastIndexOf(0));
- }
- if (suffixSb != null) suffix = suffixSb.toString();
- }
+ @Override
+ public final int compareTo(@NotNull Version version) {
+ return compareTo(version, false);
}
- @Override
- public final int compareTo(@Nonnull Version version) {
- if (this.isEqual(version)) return 0;
- else if (this.isLowerThan(version)) return -1;
- else return 1;
+ private int compareTo(@NotNull Version version, boolean ignoreSuffix) {
+ int versionNumberResult = VersionComparator.compareSubversionNumbers(
+ trimmedSubversionNumbers,
+ version.trimmedSubversionNumbers
+ );
+ if (versionNumberResult != 0 || ignoreSuffix) {
+ return versionNumberResult;
+ }
+ int releaseTypeResult = releaseType.compareTo(version.releaseType);
+ if (releaseTypeResult != 0) {
+ return releaseTypeResult;
+ } else {
+ return Long.compare(preReleaseVersion, version.preReleaseVersion);
+ }
}
@Override
public final boolean equals(Object o) {
- if (o instanceof Version && this.isEqual((Version) o)) return true;
+ if (o instanceof Version && isEqual((Version) o)) return true;
else return super.equals(o);
}
@Override
public final int hashCode() {
- final int prime = 31;
- int hash = 1;
- hash = prime * hash + subversionNumbersWithoutTrailingZeros.hashCode();
- if (suffix.isEmpty()) return hash;
+ int result = trimmedSubversionNumbers.hashCode();
+ result = 31 * result + releaseType.hashCode();
+ result = 31 * result + (int) (preReleaseVersion ^ (preReleaseVersion >>> 32));
+ return result;
+ }
- int releaseQualifier = VersionComparator.qualifierToNumber(suffix);
- int releaseQualifierVersion = VersionComparator.preReleaseVersion(suffix, releaseQualifier);
- hash = prime * hash + releaseQualifier;
- hash = prime * hash + releaseQualifierVersion;
- return hash;
+ @Override
+ public String toString() {
+ return String.valueOf(originalString);
}
}
diff --git a/versioncompare/src/main/java/io/github/g00fy2/versioncompare/VersionComparator.java b/versioncompare/src/main/java/io/github/g00fy2/versioncompare/VersionComparator.java
index 6a66102..978ff9a 100644
--- a/versioncompare/src/main/java/io/github/g00fy2/versioncompare/VersionComparator.java
+++ b/versioncompare/src/main/java/io/github/g00fy2/versioncompare/VersionComparator.java
@@ -1,6 +1,6 @@
package io.github.g00fy2.versioncompare;
-import javax.annotation.Nonnull;
+import org.jetbrains.annotations.NotNull;
import java.util.List;
final class VersionComparator {
@@ -9,11 +9,6 @@ private VersionComparator() {
// utility class should not be instantiated
}
- // position of SemVer version part
- static final int MAJOR = 0;
- static final int MINOR = 1;
- static final int PATCH = 2;
-
// supported PreRelease suffixes
private static final String SNAPSHOT_STRING = "snapshot";
private static final String PRE_STRING = "pre";
@@ -22,110 +17,99 @@ private VersionComparator() {
private static final String RC_STRING = "rc";
// weighting of the PreRelease suffixes
- private static final int SNAPSHOT = 0;
- private static final int PRE_ALPHA = 1;
- private static final int ALPHA = 2;
- private static final int BETA = 3;
- private static final int RC = 4;
- private static final int UNKNOWN = 5;
-
- static int compareSubversionNumbers(@Nonnull final List subversionsA,
- @Nonnull final List subversionsB) {
- final int versASize = subversionsA.size();
- final int versBSize = subversionsB.size();
- final int maxSize = Math.max(versASize, versBSize);
-
- for (int i = 0; i < maxSize; i++) {
- if ((i < versASize ? subversionsA.get(i) : 0) > (i < versBSize ? subversionsB.get(i) : 0)) {
- return 1;
- } else if ((i < versASize ? subversionsA.get(i) : 0) < (i < versBSize ? subversionsB.get(i) : 0)) {
- return -1;
- }
- }
- return 0;
+ enum ReleaseType {
+ SNAPSHOT,
+ PRE_ALPHA,
+ ALPHA,
+ BETA,
+ RC,
+ STABLE
}
- static int compareSuffix(@Nonnull final String suffixA, @Nonnull final String suffixB) {
- if (suffixA.length() > 0 || suffixB.length() > 0) {
- final int qualifierA = qualifierToNumber(suffixA);
- final int qualifierB = qualifierToNumber(suffixB);
+ static int compareSubversionNumbers(@NotNull final List versionNumbersA,
+ @NotNull final List versionNumbersB) {
+ final int numbersSizeA = versionNumbersA.size();
+ final int numbersSizeB = versionNumbersB.size();
+ final int maxSize = Math.max(numbersSizeA, numbersSizeB);
- if (qualifierA > qualifierB) {
+ for (int i = 0; i < maxSize; i++) {
+ if ((i < numbersSizeA ? versionNumbersA.get(i) : 0) > (i < numbersSizeB ? versionNumbersB.get(i) : 0)) {
return 1;
- } else if (qualifierA < qualifierB) {
+ } else if ((i < numbersSizeA ? versionNumbersA.get(i) : 0) < (i < numbersSizeB ? versionNumbersB.get(i) : 0)) {
return -1;
- } else if (qualifierA != UNKNOWN && qualifierA != SNAPSHOT) {
- final int suffixVersionA = preReleaseVersion(suffixA, qualifierA);
- final int suffixVersionB = preReleaseVersion(suffixB, qualifierB);
-
- if (suffixVersionA > suffixVersionB) {
- return 1;
- } else if (suffixVersionA < suffixVersionB) {
- return -1;
- }
}
}
return 0;
}
- static int qualifierToNumber(@Nonnull String suffix) {
+ static ReleaseType qualifierToReleaseType(@NotNull String suffix) {
if (suffix.length() > 0) {
suffix = suffix.toLowerCase();
- if (suffix.contains(RC_STRING)) return RC;
- if (suffix.contains(BETA_STRING)) return BETA;
+ if (suffix.contains(RC_STRING)) return ReleaseType.RC;
+ if (suffix.contains(BETA_STRING)) return ReleaseType.BETA;
if (suffix.contains(ALPHA_STRING)) {
if (suffix.substring(0, suffix.indexOf(ALPHA_STRING)).contains(PRE_STRING)) {
- return PRE_ALPHA;
+ return ReleaseType.PRE_ALPHA;
} else {
- return ALPHA;
+ return ReleaseType.ALPHA;
}
}
- if (suffix.contains(SNAPSHOT_STRING)) return SNAPSHOT;
+ if (suffix.contains(SNAPSHOT_STRING)) return ReleaseType.SNAPSHOT;
}
- return UNKNOWN;
+ return ReleaseType.STABLE;
}
- static int preReleaseVersion(@Nonnull final String suffix, final int qualifier) {
- final int startIndex = indexOfQualifier(suffix, qualifier);
+ static long preReleaseVersion(@NotNull final String suffix, final ReleaseType releaseType) {
+ if (releaseType == ReleaseType.STABLE || releaseType == ReleaseType.SNAPSHOT) return 0;
+
+ final int startIndex = indexOfQualifier(suffix, releaseType);
if (startIndex < suffix.length()) {
final int maxStartIndex = Math.min(startIndex + 2, suffix.length());
if (containsNumeric(suffix.substring(startIndex, maxStartIndex))) {
- StringBuilder versionNumber = new StringBuilder();
+ final StringBuilder versionNumber = new StringBuilder();
for (int i = startIndex; i < suffix.length(); i++) {
- char c = suffix.charAt(i);
+ final char c = suffix.charAt(i);
if (Character.isDigit(c)) {
versionNumber.append(c);
} else if (i != startIndex) {
break;
}
}
- return safeParseInt(versionNumber.toString());
+ return safeParseLong(versionNumber.toString());
}
}
return 0;
}
- private static int indexOfQualifier(@Nonnull final String suffix, final int qualifier) {
- if (qualifier == RC) return suffix.indexOf(RC_STRING) + RC_STRING.length();
- if (qualifier == BETA) return suffix.indexOf(BETA_STRING) + BETA_STRING.length();
- if (qualifier == ALPHA || qualifier == PRE_ALPHA) return suffix.indexOf(ALPHA_STRING) + ALPHA_STRING.length();
- return 0;
+ private static int indexOfQualifier(@NotNull String suffix, final ReleaseType releaseType) {
+ suffix = suffix.toLowerCase();
+ switch (releaseType) {
+ case RC:
+ return suffix.indexOf(RC_STRING) + RC_STRING.length();
+ case BETA:
+ return suffix.indexOf(BETA_STRING) + BETA_STRING.length();
+ case ALPHA:
+ case PRE_ALPHA:
+ return suffix.indexOf(ALPHA_STRING) + ALPHA_STRING.length();
+ default:
+ return 0;
+ }
}
// helper methods
- static boolean startsNumeric(@Nonnull String str) {
+ static boolean startsNumeric(@NotNull String str) {
str = str.trim();
return str.length() > 0 && Character.isDigit(str.charAt(0));
}
- static int safeParseInt(@Nonnull String numbers) {
- if (numbers.length() > 9) {
- numbers = numbers.substring(0, 9);
+ static long safeParseLong(@NotNull String numbers) {
+ if (numbers.length() > 19) {
+ numbers = numbers.substring(0, 19);
}
- return Integer.parseInt(numbers);
+ return Long.parseLong(numbers);
}
- static boolean isNumeric(@Nonnull final CharSequence cs) {
+ static boolean isNumeric(@NotNull final CharSequence cs) {
final int sz = cs.length();
if (sz > 0) {
for (int i = 0; i < sz; i++) {
@@ -138,7 +122,7 @@ static boolean isNumeric(@Nonnull final CharSequence cs) {
return false;
}
- private static boolean containsNumeric(@Nonnull final CharSequence cs) {
+ private static boolean containsNumeric(@NotNull final CharSequence cs) {
final int sz = cs.length();
if (sz > 0) {
for (int i = 0; i < sz; i++) {
diff --git a/versioncompare/src/main/resources/META-INF/proguard/versioncompare.pro b/versioncompare/src/main/resources/META-INF/proguard/versioncompare.pro
deleted file mode 100644
index 7744bdd..0000000
--- a/versioncompare/src/main/resources/META-INF/proguard/versioncompare.pro
+++ /dev/null
@@ -1 +0,0 @@
--dontwarn javax.annotation.**
\ No newline at end of file
diff --git a/versioncompare/src/test/java/io/github/g00fy2/versioncompare/VersionEqualsVerifierTest.java b/versioncompare/src/test/java/io/github/g00fy2/versioncompare/VersionEqualsVerifierTest.java
index 170af97..8566efb 100644
--- a/versioncompare/src/test/java/io/github/g00fy2/versioncompare/VersionEqualsVerifierTest.java
+++ b/versioncompare/src/test/java/io/github/g00fy2/versioncompare/VersionEqualsVerifierTest.java
@@ -9,7 +9,7 @@ public class VersionEqualsVerifierTest {
public void equalsContract() {
EqualsVerifier.forClass(Version.class)
.withIgnoredFields("originalString", "subversionNumbers", "suffix")
- .withNonnullFields("subversionNumbers", "subversionNumbersWithoutTrailingZeros", "suffix")
+ .withNonnullFields("trimmedSubversionNumbers", "releaseType", "preReleaseVersion")
.verify();
}
}
\ No newline at end of file
diff --git a/versioncompare/src/test/java/io/github/g00fy2/versioncompare/VersionHigherLowerTest.java b/versioncompare/src/test/java/io/github/g00fy2/versioncompare/VersionHigherLowerTest.java
index 59aff6f..7311b46 100644
--- a/versioncompare/src/test/java/io/github/g00fy2/versioncompare/VersionHigherLowerTest.java
+++ b/versioncompare/src/test/java/io/github/g00fy2/versioncompare/VersionHigherLowerTest.java
@@ -25,6 +25,7 @@ public static Collection