RFR: 8304913: Use OperatingSystem, Architecture, and Version in jlink [v3]

Jaikiran Pai jpai at openjdk.org
Fri May 5 14:17:26 UTC 2023


On Fri, 5 May 2023 14:10:42 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Platform.java line 71:
>> 
>>> 69:      */
>>> 70:     public static Platform runtime() {
>>> 71:         return new Platform(OperatingSystem.current(), Architecture.current());
>> 
>> Should we create a single `private static final Platform`, in this class, to represent the current platform, and keep returning it instead of creating a new instance on each call?
>
> The method is only called once and the object created is lightweight, it doesn't add much to retain a copy.

That sounds reasonable to me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13585#discussion_r1186149633


More information about the core-libs-dev mailing list