Integrated: 8347916: Simplify javax.swing.text.html.CSS.LengthUnit.getValue

Andrey Turbanov aturbanov at openjdk.org
Mon Jan 20 12:57:41 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

This pull request has now been integrated.

Changeset: 93469847
Author:    Andrey Turbanov <aturbanov at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/9346984725ed09e9917e825094b34c3a033af23e
Stats:     20 lines in 1 file changed: 2 ins; 14 del; 4 mod

8347916: Simplify javax.swing.text.html.CSS.LengthUnit.getValue

Reviewed-by: azvegint, aivanov

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

PR: https://git.openjdk.org/jdk/pull/21833


More information about the client-libs-dev mailing list