OpenJDK / amber / amber
changeset 44265:ac63ae089927
8160956: Runtime.Version.compareTo/compareToIgnoreOpt problem
Reviewed-by: mr
author | prappo |
---|---|
date | Thu, 16 Mar 2017 15:30:54 +0000 |
parents | 8ff59e9e832c |
children | 2b9cc0e5e79f |
files | jdk/src/java.base/share/classes/java/lang/Runtime.java jdk/test/java/lang/Runtime/Version/Basic.java |
diffstat | 2 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/src/java.base/share/classes/java/lang/Runtime.java Thu Mar 16 14:46:50 2017 +0100 +++ b/jdk/src/java.base/share/classes/java/lang/Runtime.java Thu Mar 16 15:30:54 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -955,7 +955,7 @@ * * <p> A <em>version number</em>, {@code $VNUM}, is a non-empty sequence * of elements separated by period characters (U+002E). An element is - * either zero, or a unsigned integer numeral without leading zeros. The + * either zero, or an unsigned integer numeral without leading zeros. The * final element in a version number must not be zero. The format is: * </p> * @@ -1053,8 +1053,8 @@ * * </ul> * - * <p> A version number {@code 10-ea} matches {@code $VNUM = "10"} and - * {@code $PRE = "ea"}. The version number {@code 10+-ea} matches + * <p> A version string {@code 10-ea} matches {@code $VNUM = "10"} and + * {@code $PRE = "ea"}. The version string {@code 10+-ea} matches * {@code $VNUM = "10"} and {@code $OPT = "ea"}. </p> * * <p> When comparing two version strings, the value of {@code $OPT}, if @@ -1247,7 +1247,7 @@ * Compares this version to another. * * <p> Each of the components in the <a href="#verStr">version</a> is - * compared in the follow order of precedence: version numbers, + * compared in the following order of precedence: version numbers, * pre-release identifiers, build numbers, optional build information. * </p> * @@ -1375,9 +1375,9 @@ if (oBuild.isPresent()) { return (build.isPresent() ? build.get().compareTo(oBuild.get()) - : 1); + : -1); } else if (build.isPresent()) { - return -1; + return 1; } return 0; } @@ -1461,7 +1461,7 @@ * * @return {@code true} if, and only if, the given object is a {@code * Version} that is identical to this {@code Version} - * ignoring the optinal build information + * ignoring the optional build information * */ public boolean equalsIgnoreOptional(Object ob) {
--- a/jdk/test/java/lang/Runtime/Version/Basic.java Thu Mar 16 14:46:50 2017 +0100 +++ b/jdk/test/java/lang/Runtime/Version/Basic.java Thu Mar 16 15:30:54 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @summary Unit test for java.lang.Runtime.Version. - * @bug 8072379 8144062 8161236 + * @bug 8072379 8144062 8161236 8160956 */ import java.lang.reflect.InvocationTargetException; @@ -140,7 +140,7 @@ testEHC("9.1.1.2-2a", "9.1.1.2-12", false, false, 1, 1); testEHC("9.1.1.2-12", "9.1.1.2-4", false, false, 1, 1); - testEHC("27.16", "27.16+120", false, false, 1, 1); + testEHC("27.16", "27.16+120", false, false, -1, -1); testEHC("10", "10-ea", false, false, 1, 1); testEHC("10.1+1", "10.1-ea+1", false, false, 1, 1); testEHC("10.0.1+22", "10.0.1+21", false, false, 1, 1); @@ -152,7 +152,7 @@ testEHC("9-internal", "9", false, false, -1, -1); testEHC("9-ea+120", "9+120", false, false, -1, -1); testEHC("9-ea+120", "9+120", false, false, -1, -1); - testEHC("9+101", "9", false, false, -1, -1); + testEHC("9+101", "9", false, false, 1, 1); testEHC("9+101", "9+102", false, false, -1, -1); testEHC("1.9-ea", "9-ea", false, false, -1, -1);