RFR: 8347916: Simplify javax.swing.text.html.CSS.LengthUnit.getValue
Alexey Ivanov
aivanov at openjdk.org
Mon Jan 20 12:16:37 UTC 2025
On Fri, 1 Nov 2024 14:43:39 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> Static and non-static `CSS.LengthUnit.getValue` methods essentially do the same thing.
> https://github.com/openjdk/jdk/blob/751a914b0a377d4e1dd30d2501f0ab4e327dea34/src/java.desktop/share/classes/javax/swing/text/html/CSS.java#L3085-L3096
>
> https://github.com/openjdk/jdk/blob/751a914b0a377d4e1dd30d2501f0ab4e327dea34/src/java.desktop/share/classes/javax/swing/text/html/CSS.java#L3098-L3108
>
> 1. delegate one to another to reduce code duplication.
> 2. use primitive `boolean` type as parameter to avoid boxing
> 3. take advantage of `Map.getOrDefault()` to simplify code futher
The tests are green, too.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21833#issuecomment-2602265953
More information about the client-libs-dev
mailing list