Hey android devs. Double-curly brace initialization has a couple of issues that particularly affect resource-constrained mobile devices: * Memory leaks: double-curly braces create an anonymous class that contains a reference to the containing class, which could prevent the potentially large containing class (e.g. the Activity) from ever getting GC'd. * Creating new types: it creates an anonymous class and generates new types just for your Object, which affects our APK size and method count limits
For more information on just what double-curly brace initialization is and why you don't want to do it, please see [1]. As part of my whitespace checkstyle changes [2], I found several uses of it, which I removed. fwiw, checkstyle should warn you if you try to do this in the future (yay, checkstyle is working!). Stopping you from having fun, Mike (:mcomella) [1]: https://blog.jooq.org/2014/12/08/dont-be-clever-the-double-curly-braces-anti-pattern/ [2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1258789
_______________________________________________ mobile-firefox-dev mailing list mobile-firefox-dev@mozilla.org https://mail.mozilla.org/listinfo/mobile-firefox-dev