I am not sure if we can always return 0d for getVersion() even if we deprecate this method. Doubt that people are relying on this, but don't we normally keep the functionality the same after deprecating a method?

"9.0d" is not the supported version format. The new version string syntax follows what's suggested in Verona JEP, not the the direct string representation of double. 9.0d is only for specifying double value in the older constructor. I don't think it means you can call the new constructor by just adding a quote around it to convert it into a String.
Maybe we need to document it somewhere to prevent this potential user error?

Valerie

On 6/22/2016 8:35 PM, Wang Weijun wrote:
In fact, now that getVersion() is deprecated, can we just always return 0d?

On the other hand, your parseVersionStr(s) is not able to handle "9.0d".

--Max

On Jun 23, 2016, at 3:47 AM, Valerie Peng <[email protected]> wrote:

Max,

Thanks for the comments~

The String.valueOf() calls are for handling null values.
The name and id fields are also of type String and they use the 
String.valueOf() calls when putting in the Provider.id attribute values, so I 
follow the same convention. I also updated the parseVersionStr(String) utility 
method to handle null or invalid version strings though, and assign 0d if 
parsing fails.

According to the Verona JEP, "java.specification.version" should be $VNUM which 
is a non-empty sequence of non- negative integer numerals, without leading zeros, 
separated by period characters.
I am not sure if we can assume the same format for supplied version string 
though. So, the current impl of parsing of version string can take the $VSTR 
(again in Verona JEP) which consists of $VUM optionally followed by pre-release 
and build info, i.e. $VNUM(-$PRE)?(\+$BUILD)?(-$OPT)?

Webrev updated:
http://cr.openjdk.java.net/~valeriep/8130181/webrev.01

Valerie

On 6/15/2016 8:33 PM, Wang Weijun wrote:
You used String.valueOf(provider.getVersionStr()) on lines 70 and 861. Why not 
just provider.getVersionStr()?

For parseVersionStr(), where is the spec for "java.specification.version"? Can 
we just use regex /(^\d+(\.\d+)?)/ to match the substring and turn it into a double?

--Max

Reply via email to