RFR: 8300176: URLEncoder/URLDecoder static fields should be private static final
Claes Redestad
redestad at openjdk.org
Sun Jan 22 19:24:06 UTC 2023
On Fri, 20 Jan 2023 17:41:55 GMT, Darragh Clarke <duke at openjdk.org> wrote:
> Made the `static` fields `private static final`, updated the naming as well to reflect this.
>
> This meant I updated `URLDecoder` to set the `DEFAULT_ENCODING_NAME` itself since it had been previously getting it from `URLEncoder`.
>
> Since these fields are only referenced from inside the classes nothing else needed updated
src/java.base/share/classes/java/net/URLEncoder.java line 124:
> 122: DONT_NEED_ENCODING = new BitSet(256);
> 123: int i;
> 124: for (i = 'a'; i <= 'z'; i++) {
These three for-loops could be simplified to:
DONT_NEED_ENCODING.set('a', 'z' + 1);
DONT_NEED_ENCODING.set('A', 'Z' + 1);
DONT_NEED_ENCODING.set('0', '9' + 1);
-------------
PR: https://git.openjdk.org/jdk/pull/12122
More information about the net-dev
mailing list