On Fri, 7 May 2021 19:57:02 GMT, Phil Race <p...@openjdk.org> wrote: > Leaving aside specification. what does an app really want this to return ? > Should we start from there ?
We are returning current dock icon image from system. > Do we definitely not want to just hang on to whatever an application set so > we can return it without modification ? > What are the problems with that ? It might be a good solution, but I see some difficulties here. If we just save passed image instance, its content might be modified by user between `setIconImage()` and `getIconImage()` calls. `setIconImage()` internally converts passed image, so it does not follow its changes. Thus we will get a discrepancy between result from `getIconImage()` and actual dock icon image on macOS side. (Probably we can mitigate this by modifying the javadoc with some vague wording though.) Ideally we should make a copy of an icon passed to `setIconImage()` method to prevent modification of its content. `setIconImage()`/`getIconImage()` works with too wide type `java.awt.Image`, and I am not aware of any reliable way to clone every possible subtype of it. ------------- PR: https://git.openjdk.java.net/jdk/pull/3250