Why does this() and super() have to be the first statement in a constructor?

Mike Duigou mike.duigou at oracle.com
Tue Oct 11 13:03:49 PDT 2011

I submitted a proposal for exactly this request as part of the original coin call for proposals. 


(long thread follows)

The request also resulted in the identification of several older requests:


The first issue (4093999) points out that the JVMS specification only requires that super() or this() be called before instance members (including "this") are accessed. The restriction that super() or this() must be the first statement of a constructor is a tighter restriction imposed by the Java language. 

The proposal was ultimately not selected for project coin:


Note that the resolution in leaves open the opportunity (*not* commitment) for it to be addressed in future coin efforts or at any time by an enterprising compiler hacker. 

I do still think the restriction is an annoyance :-)


More information about the coin-dev mailing list