Primarily aesthetic reasons, particularly when looking at stack traces. Somehow the idea of creating all that litter doesn't agree with me, either -- but as I said: it's not big enough an issue.
Another annoyance: IDEs complain about lack of serialVersionUID easily in those cases. A real problem: the behaviour of equals() can be surprising since each instance initialized that way will use a different type, which means that with correct equals() implementations none will be equal to each other, independent of the content. Peter Marcelo Morales wrote: > I am curious. Why do you think an anonymous inner class is a drawback? > > Marcelo > > On Mon, Feb 23, 2009 at 8:42 PM, Peter Becker <peter.becker...@gmail.com> > wrote: > >> I quite like the instance initializers, too. The only drawback is that >> they create anonymous inner classes every time you use one, but >> considering the advantages of better encapsulation and nice scoping of >> the construction block I think the extra $n classes are a small price to >> pay. >> >> Peter >> > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javaposse@googlegroups.com To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---