RFR: 8251989: Hex formatting and parsing utility [v2]

Daniel Fuchs dfuchs at openjdk.java.net
Wed Oct 14 13:50:14 UTC 2020


On Wed, 14 Oct 2020 13:38:51 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java line 1116:
>> 
>>> 1114:         }
>>> 1115:
>>> 1116:         HexFormat format = HexFormat.of().withUpperCase();
>> 
>> Should/can this be a static final field in the class?
>
> Its a bit of a space/time trade-off.  And the balance point will change if the class is converted in the future to a
> Valhalla primitive class. At this point it looks to me like a premature optimization.

OK - but just to avoid misunderstanding - I meant a static final field in  jdk.internal.net.http.common.Utils; as in
public class Utils { ...
    private static final HexFormat HEX_FORMAT = HexFormat.of().withUpperCase();
    ...
}

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

PR: https://git.openjdk.java.net/jdk/pull/482


More information about the core-libs-dev mailing list