You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by oc...@ocs.cz on 2020/05/26 13:05:41 UTC

super (msg, cause) should be the first statement in the constructor

Hi there,

might it be possible for Groovy to get rid of this stupid Java abomination, especially to allow code like

class Foo {
  Foo(someargs) {
    sanitize-args
    super(sanitized-args)
  }
}

instead of the currently enforced ugly work-arounds (like e.g., using a sanitize static method for each arg or so)?

(The very remote danger of calling a method of an un-initialised object in the code above super-constructor is definitely not an excuse of such a crippling limitation. If the programmer is not a complete nincompoop, he wouldn't; and if he is, he'd shoot his own leg in a plethora of other ways anyway.)

Thanks,
OC