RFR: 8314261: Make fields final in sun.net.www [v3]

Claes Redestad redestad at openjdk.org
Tue Aug 15 11:48:07 UTC 2023


On Tue, 15 Aug 2023 11:29:45 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

>> A few classes in `sun.net.www` package have non-final fields which could easily be marked `final`.
>
> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8314261: Make fields final in sun.net.www

Looks good to me.

src/java.base/share/classes/sun/net/www/MimeTable.java line 48:

> 46: 
> 47:     /** Keyed by content type, returns MimeEntries */
> 48:     private final Hashtable<String, MimeEntry> entries = new Hashtable<>();

Drive-by observation: These two `Hashtable`s can be changed to `HashMap` since every method that uses them is `synchronized`, making the implicit synchronization from `Hashtable` redundant.

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

Marked as reviewed by redestad (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14977#pullrequestreview-1578390240
PR Review Comment: https://git.openjdk.org/jdk/pull/14977#discussion_r1294482151


More information about the net-dev mailing list