Chris Uppal <> wrote:
> God help us -- that's /vile/ !
Well, I wasn't a big fan either, although I did have to be a bit more
diplomatic about things

(Perhaps tellingly, a slight elaboration
on the code in question also exposed a flaw in IntelliJ's code
inspection - clearly it's at least uncommonly used enough that the bug
escaped notice until now!)
> The problem is that it makes use of a reference to the object under
> construction (using it to create the instance of the inner class) before the
> superclass's constructor has been invoked.
I'm still fuzzy on some of the things that lurk hidden from the eyes
of the casual programmer - but yes, now that you mention it, it's
obvious.
> In fact I'm somewhat surprised that it passed verification in the JVM -- there
> are strict rules about what you can do with a reference to a allocated-but-not
> fully-initialised object, and until the call to the superclass constructor has
> returned, "this" is in an illegal state.
It seems that the Java compiler is smart enough to determine when
you've clearly overstepped your bounds - say by accessing a field in
the subclass before the superclass constructor has been called - and
when you've merely committed stylistic seppuku.
--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.