[rfc][icedtea-web] immutbale transaltor

Jiri Vanek jvanek at redhat.com
Wed Sep 17 10:58:53 UTC 2014


Attached patch is changing our new Transaltor to be immutable.

The only desired change was to
-    private ResourceBundle resources;
+    private final ResourceBundle resources;

and so .. get rid of loadResourceBundle, and so allow constructor chain of
   Translator() {

     Translator(String s) {

     Translator(ResourceBundle resources) {
         this.resources = resources;

And so make it instantiatable and consequentially adapt the test....
And so get rid of enum in favor of class, and so use handler idiom for creation....

Personally,  why people use enums for singletons?!?!?! Well very simple singletons .. yes, but once 
there is some logic... Ouch they are so so *clumsy* ... So clamsy taht they can not be even properly 
tested ( no instance!, no overrload!). And once singleton is not immutbale.... Is it still singleton?

Afaik the state after the patch is better:
  - singleton is still singleton
  - newly:
   -  initialized on demand
   -  immutable
   - the tets are done on separate copy, not on the changed singleton itself (aaargh)

Any comment why to keep enum welcomed....

-------------- next part --------------
A non-text attachment was scrubbed...
Name: immutableTransaltor.patch
Type: text/x-patch
Size: 5273 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20140917/ac5630c0/immutableTransaltor.patch>

More information about the distro-pkg-dev mailing list