Comment by rich...@zschech.net: I had an idea how to reduce the code required for the immutable collections mutation methods throwing `UnsupportedOperationException`:
If the compiler detects that the bodies of two methods are the same then it can use the same Java Script method. For example in sudo Java / Java Script code: {{{ var throwUnsupportedOperationExceptionMethod = function() { throw new UnsupportedOperationException?(); } immutableCollection.add = throwUnsupportedOperationExceptionMethod; immutableCollection.addAll = throwUnsupportedOperationExceptionMethod; immutableCollection.clear = throwUnsupportedOperationExceptionMethod; }}} etc... Java Script does not care if the number of parameters the caller is using is different to what is defined. For example you can call with no issue: ` {{{ immutableCollection.add(e); immutableCollection.clear(); }}} This could be generalised to reduce the size of any code although it would be time consuming to find methods with the same bodies. For more information: http://code.google.com/p/google-web-toolkit/wiki/LightweightCollections --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---