RFR: 8162439: Runtime.Version.parse needs fast-path for major versions

Iris Clark iris.clark at oracle.com
Mon Jul 25 18:01:26 UTC 2016


Hi, Claes.

> Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8162439

I think that this change looks good.  We provide a shortcut for the common case where only the major version number is of interest without introducing a new API.

Note that this has a minor side-effect that invocations of the form Runtime.Version.parse("notANumber") will now throw NFE instead of IAE.  I don't think that this is a problem since NFE extends IAE and the order that the exceptions will be checked is intentionally unspecified.

Regards,
iris
(not a Reviewer)

-----Original Message-----
From: Claes Redestad 
Sent: Saturday, July 23, 2016 9:24 AM
To: core-libs-dev at openjdk.java.net core-libs-dev
Subject: RFR: 8162439: Runtime.Version.parse needs fast-path for major versions

Hi,

please review this patch to address a startup regression due to use of
Runtime.Version.parse("8") etc in JarFile, as introduced by JDK-8150680. 
This solution introduce a fast-path in case of what appears to be a single number is sent to Runtime.Version.parse to avoid initializing
Runtime.VersionBuilder:

Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/
Bug: https://bugs.openjdk.java.net/browse/JDK-8162439

Passes all existing tests.

Thanks!

/Claes


More information about the core-libs-dev mailing list