On Thu, 14 Mar 2024 09:31:39 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:
>> This is try-with-resources so if i will do it in main i will have to add >> synchronizing and closing of writer which is a strange trade-off so i would >> have to do try block anyways. > > Why would you need synchronisation? > > > try (Writer writer = Files.newBufferedWriter(frameContentFile)) { > writer.write(frameContentString); > } > > would write out the contents of the file and close the file handle. In > setupGui, you would still use `frameContentFile` object only which is `final` > and immutable, therefore it's thread-safe. And that's pretty much what i do here - except for the exception handling. I just do not see a reason to move it to main, it makes no difference except now the HTML creation will be split and harder to understand. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18259#discussion_r1524607845