@@ -5,7 +5,7 @@ package org.utbot.intellij.plugin.ui.utils
5
5
* Contains three standard components: major, minor and patch.
6
6
*
7
7
* Major and minor components are always numbers, while patch
8
- * may contain a number with some postfix like -RELEASE.
8
+ * may contain a number with some optional postfix like ` -RELEASE` or `.RELEASE` .
9
9
*
10
10
* Sometimes patch is empty, e.g. for TestNg 7.5 version.
11
11
*
@@ -18,9 +18,10 @@ data class Version(
18
18
val plainText : String? = null ,
19
19
) {
20
20
fun isCompatibleWith (another : Version ): Boolean {
21
- // Non-numeric versions can't be compared to each other, so we cannot be sure that current is compatible
21
+ // Non-numeric versions can't be compared to each other,
22
+ // so we cannot be sure that current is compatible unless it's the exact match
22
23
if (! hasNumericOrEmptyPatch() || ! hasNumericOrEmptyPatch()) {
23
- return false
24
+ return plainText == another.plainText
24
25
}
25
26
26
27
return major > another.major ||
@@ -35,10 +36,11 @@ data class Version(
35
36
fun String.parseVersion (): Version ? {
36
37
val lastSemicolon = lastIndexOf(' :' )
37
38
val versionText = substring(lastSemicolon + 1 )
38
- val versionComponents = versionText.split(' .' )
39
39
40
40
// Components must be: major, minor and (optional) patch
41
- if (versionComponents.size < 2 || versionComponents.size > 3 ) {
41
+ val versionComponents = versionText.split(' .' , limit = 3 )
42
+
43
+ if (versionComponents.size < 2 ) {
42
44
return null
43
45
}
44
46
0 commit comments