Live data from Hacker News

Java Hack: Double Brace Initialization

refactory.org

21–22 of 22 posts

Re: Java Hack: Double Brace Initialization

#21
One thing though. I love this technique but the home built Eclipse compiler is not fully Java language compliant and it will reject certain forms of this as invalid. Specifically, the sun and eclipse compiler treat "this" differently in these code blocks. My project will not compile under eclipse because of certain usages of this pattern when combined with inner classes. The bug crops up when you need to pass the parent to the child object being initialized in the static block.
Post reply on HN