< prev index next >
jdk/src/java.base/share/classes/java/lang/Runtime.java
Print this page
*** 943,953 ****
}
return version;
}
/**
! * A representation of a version string for an implemenation of the
* Java SE Platform. A version string contains a version number
* optionally followed by pre-release and build information.
*
* <h2><a name="verNum">Version numbers</a></h2>
*
--- 943,953 ----
}
return version;
}
/**
! * A representation of a version string for an implementation of the
* Java SE Platform. A version string contains a version number
* optionally followed by pre-release and build information.
*
* <h2><a name="verNum">Version numbers</a></h2>
*
*** 1056,1069 ****
* {@code $VNUM = "10"} and {@code $OPT = "ea"}. </p>
*
* <p> When comparing two version strings, the value of {@code $OPT}, if
* present, may or may not be significant depending on the chosen
* comparison method. The comparison methods {@link #compareTo(Version)
! * compareTo()} and {@link #compareToIgnoreOpt(Version)
! * compareToIgnoreOpt()} should be used consistently with the
* corresponding methods {@link #equals(Object) equals()} and {@link
! * #equalsIgnoreOpt(Object) equalsIgnoreOpt()}. </p>
*
* <p> A <em>short version string</em>, {@code $SVSTR}, often useful in
* less formal contexts, is a version number optionally followed by a
* pre-release identifier:
*
--- 1056,1069 ----
* {@code $VNUM = "10"} and {@code $OPT = "ea"}. </p>
*
* <p> When comparing two version strings, the value of {@code $OPT}, if
* present, may or may not be significant depending on the chosen
* comparison method. The comparison methods {@link #compareTo(Version)
! * compareTo()} and {@link #compareToIgnoreOptional(Version)
! * compareToIgnoreOptional()} should be used consistently with the
* corresponding methods {@link #equals(Object) equals()} and {@link
! * #equalsIgnoreOptional(Object) equalsIgnoreOptional()}. </p>
*
* <p> A <em>short version string</em>, {@code $SVSTR}, often useful in
* less formal contexts, is a version number optionally followed by a
* pre-release identifier:
*
*** 1247,1257 ****
* given {@code Version}
*
* @throws NullPointerException
* If the given object is {@code null}
*/
! public int compareToIgnoreOpt(Version ob) {
return compare(ob, true);
}
private int compare(Version ob, boolean ignoreOpt) {
if (ob == null)
--- 1247,1257 ----
* given {@code Version}
*
* @throws NullPointerException
* If the given object is {@code null}
*/
! public int compareToIgnoreOptional(Version ob) {
return compare(ob, true);
}
private int compare(Version ob, boolean ignoreOpt) {
if (ob == null)
*** 1268,1278 ****
ret = compareBuild(ob);
if (ret != 0)
return ret;
if (!ignoreOpt)
! return compareOpt(ob);
return 0;
}
private int compareVersion(Version ob) {
--- 1268,1278 ----
ret = compareBuild(ob);
if (ret != 0)
return ret;
if (!ignoreOpt)
! return compareOptional(ob);
return 0;
}
private int compareVersion(Version ob) {
*** 1323,1333 ****
return -1;
}
return 0;
}
! private int compareOpt(Version ob) {
Optional<String> oOpt = ob.optional();
if (!optional.isPresent()) {
if (oOpt.isPresent())
return -1;
} else {
--- 1323,1333 ----
return -1;
}
return 0;
}
! private int compareOptional(Version ob) {
Optional<String> oOpt = ob.optional();
if (!optional.isPresent()) {
if (oOpt.isPresent())
return -1;
} else {
*** 1382,1392 ****
* Version} that is identical to this {@code Version}
*
*/
@Override
public boolean equals(Object ob) {
! boolean ret = equalsIgnoreOpt(ob);
if (!ret)
return false;
Version that = (Version)ob;
return (this.optional().equals(that.optional()));
--- 1382,1392 ----
* Version} that is identical to this {@code Version}
*
*/
@Override
public boolean equals(Object ob) {
! boolean ret = equalsIgnoreOptional(ob);
if (!ret)
return false;
Version that = (Version)ob;
return (this.optional().equals(that.optional()));
*** 1405,1415 ****
* @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
*
*/
! public boolean equalsIgnoreOpt(Object ob) {
if (this == ob)
return true;
if (!(ob instanceof Version))
return false;
--- 1405,1415 ----
* @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
*
*/
! public boolean equalsIgnoreOptional(Object ob) {
if (this == ob)
return true;
if (!(ob instanceof Version))
return false;
< prev index next >