RFR: JDK-8307807 Replace use of System.getProperty("os.name") with PlatformUtil calls [v6]

Kevin Rushforth kcr at openjdk.org
Fri May 12 15:03:56 UTC 2023


On Fri, 12 May 2023 14:56:29 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/glass/ui/Platform.java line 67:
>> 
>>> 65:             }
>>> 66: 
>>> 67:             if (PlatformUtil.isMac()) {
>> 
>> this change might be ok, but it is not strictly equivalent.
>> before, MAC path would be selected if os.name lowercase starts from either "mac" or "darwin", after the change, only starts with "Mac".
>> Do we want to support "darwin"?
>
> I'd still prefer to use PlatformUtil, since this is a cleaner solution that the variety of methods used before:
> 
> osNameLowerCase.startsWith("wind"
> "ios".equals(System.getProperty("os.name")
> osName.startsWith("Windows"
> osName.startsWith("Mac OS"
> ("os.name").toLowerCase().indexOf("win")

I initially had the same thought. What this actually highlights, though, is the danger of having this sort of check scattered in multiple places, but done differently. If it was important that "darwin" be recognized (it isn't), then it would be wrong to have this check recognize it, but all other "isMac" checks not recognize it.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1132#discussion_r1192488457


More information about the openjfx-dev mailing list