Modify AppDirsFactory.getInstance() to return the singleton instance#118
Conversation
I am not entirely sure if `WindowsAppDirs` is thread-safe or not. It looks reasonable to assume it is, but if the assumption is wrong, I might have to revert this.
| } | ||
|
|
||
| /** Singleton instance holder. */ | ||
| private static class Holder { |
There was a problem hiding this comment.
Nitpick: singletons should be done with enum: https://github.com/HugoMatilla/Effective-JAVA-Summary?tab=readme-ov-file#3-enforce-the-singleton-property-with-a-private-constructor-or-an-enum-type
There was a problem hiding this comment.
I am not sure if we can apply the enum singleton here.
If you have a clear idea, could you show me the essential part? (or send a PR if you prefer)
If it is not thread safe, one could make use of
Yeah, sounds good! Thank you for the quick action taken! |
I couldn't verify whether
WindowsAppDirsis thread-safe or not.It looks reasonable to assume it is, but if the assumption is wrong, we might have to revert this.
This won't break any existing solutions, but I plan to bump the minor version to 1.4.0 just in case.
Should fix #117
Cc: @koppor