1
1
/*
2
- * Copyright (c) 1995, 2021 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 1995, 2022 , Oracle and/or its affiliates. All rights reserved.
3
3
* Copyright (c) 2019, Azul Systems, Inc. All rights reserved.
4
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
5
*
36
36
import java .util .StringTokenizer ;
37
37
38
38
import jdk .internal .access .SharedSecrets ;
39
- import jdk .internal .loader .NativeLibrary ;
40
39
import jdk .internal .reflect .CallerSensitive ;
41
40
import jdk .internal .reflect .Reflection ;
42
41
@@ -1075,7 +1074,7 @@ public static Version parse(String s) {
1075
1074
m .group (VersionPattern .OPT_GROUP ));
1076
1075
1077
1076
// empty '+'
1078
- if (! build .isPresent ()) {
1077
+ if (build .isEmpty ()) {
1079
1078
if (m .group (VersionPattern .PLUS_GROUP ) != null ) {
1080
1079
if (optional .isPresent ()) {
1081
1080
if (pre .isPresent ())
@@ -1087,7 +1086,7 @@ public static Version parse(String s) {
1087
1086
+ " build or optional components: '" + s + "'" );
1088
1087
}
1089
1088
} else {
1090
- if (optional .isPresent () && ! pre .isPresent ()) {
1089
+ if (optional .isPresent () && pre .isEmpty ()) {
1091
1090
throw new IllegalArgumentException ("optional component"
1092
1091
+ " must be preceded by a pre-release component"
1093
1092
+ " or '+': '" + s + "'" );
@@ -1353,11 +1352,11 @@ private int compareVersion(Version obj) {
1353
1352
1354
1353
private int comparePre (Version obj ) {
1355
1354
Optional <String > oPre = obj .pre ();
1356
- if (! pre .isPresent ()) {
1355
+ if (pre .isEmpty ()) {
1357
1356
if (oPre .isPresent ())
1358
1357
return 1 ;
1359
1358
} else {
1360
- if (! oPre .isPresent ())
1359
+ if (oPre .isEmpty ())
1361
1360
return -1 ;
1362
1361
String val = pre .get ();
1363
1362
String oVal = oPre .get ();
@@ -1388,11 +1387,11 @@ private int compareBuild(Version obj) {
1388
1387
1389
1388
private int compareOptional (Version obj ) {
1390
1389
Optional <String > oOpt = obj .optional ();
1391
- if (! optional .isPresent ()) {
1390
+ if (optional .isEmpty ()) {
1392
1391
if (oOpt .isPresent ())
1393
1392
return -1 ;
1394
1393
} else {
1395
- if (! oOpt .isPresent ())
1394
+ if (oOpt .isEmpty ())
1396
1395
return 1 ;
1397
1396
return optional .get ().compareTo (oOpt .get ());
1398
1397
}
0 commit comments