RFR: JDK-8287838: Update Float and Double to use snippets [v2]

Alan Bateman alanb at openjdk.java.net
Tue Jun 7 06:34:10 UTC 2022


On Mon, 6 Jun 2022 16:54:29 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Double.java line 683:
>> 
>>> 681:      *       "[\\x00-\\x20]*");// Optional trailing "whitespace"
>>> 682:      *
>>> 683:      *  if (Pattern.matches(fpRegex, myString)) // @link substring="Pattern.matches" target ="java.util.regex.Pattern#matches"
>> 
>> If you want to avoid the annoyingly long line then you can put the "// @link ..." on the previous line if you want.
>
> It can be done with a snippet region like this:
> 
> 
>      *  // @link region substring="Pattern.matches" target ="java.util.regex.Pattern#matches"
>      *  if (Pattern.matches(fpRegex, myString))
>      *      Double.valueOf(myString); // Will not throw NumberFormatException
>      * // @end

Yes, that works. The alternative is to terminate the comment line with a colon (:) and that applies markup tag to the line that follows. In this case, it would be:

 ```
// @link substring="Pattern.matches" target ="java.util.regex.Pattern#matches" :

-------------

PR: https://git.openjdk.java.net/jdk/pull/9034


More information about the core-libs-dev mailing list