Improvement JavaVersion get method

When nom is null, return directly without unnecessary judgment.
This commit is contained in:
Stzx 2019-08-17 13:28:01 +08:00
parent add397b177
commit c2b082b54a
1 changed files with 3 additions and 4 deletions

View File

@ -194,7 +194,9 @@ public enum JavaVersion {
* version is unknown
*/
static JavaVersion get(final String nom) {
if ("0.9".equals(nom)) {
if (nom == null) {
return null;
} else if ("0.9".equals(nom)) {
return JAVA_0_9;
} else if ("1.1".equals(nom)) {
return JAVA_1_1;
@ -223,9 +225,6 @@ public enum JavaVersion {
} else if ("13".equals(nom)) {
return JAVA_13;
}
if (nom == null) {
return null;
}
final float v = toFloatVersion(nom);
if ((v - 1.) < 1.) { // then we need to check decimals > .9
final int firstComma = Math.max(nom.indexOf('.'), nom.indexOf(','));