RFR: 8302472 WebColorFieldSkin should use precompiled Pattern
Michael Strauß
mstrauss at openjdk.org
Thu Feb 16 15:48:38 UTC 2023
On Tue, 14 Feb 2023 16:12:29 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
> Split off from https://github.com/openjdk/jfx/pull/837
>
> This uses a precompiled regex pattern and cleans up the code in WebColorFieldSkin a bit.
modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/skin/WebColorFieldSkin.java line 42:
> 40: private static final String HEX_DIGIT = "[A-Fa-f0-9]";
> 41: private static final Pattern PATTERN = Pattern.compile("#?" + HEX_DIGIT + "{6}");
> 42: private static final Pattern PARTIAL_PATTERN = Pattern.compile("#?" + HEX_DIGIT + "{0,6}");
You might also use the character class `\p{XDigit}`, which matches a hexadecimal character.
-------------
PR: https://git.openjdk.org/jfx/pull/1032
More information about the openjfx-dev
mailing list