Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Especially because you were always able to bypass it by declaring a `static` function and calling that as part of the parameters to `super`:

public Foo(int x) { super(validate(x)); }

validate would run before super, even though super was technically the first statement in the constructor, and the compiler was happy.



This is such a funny workaround, I like that. But it doesn't matter in any library or your own code, since factory methods are much better (simply because they have names).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: