Is it safe by default, like Java’s single-element-enum pattern or is it e. g. necessary to define readResolve or similar methods somewhere to prevent accidental or malicious breakage of the singleton contract?
Is it safe by default, like Java’s single-element-enum pattern or is it e. g.
Share
Yes, it is safe by default:
When you compile the object with scalac and decompile it (for example with JAD) you will get following Java-file: