So, I am creating a test library that I will use mainly for personal use, but I have a question.
With Java, if you have 2 or more constructors in your class, if you want to call one from the other, this should be the first thing you do. This is problematic for me since I have the following setup.
public Constructor(TypeA a, TypeB b, TypeC c) { if (c.getData() == null) throw new IllegalArgumentException(""); this(a, b, c.getOtherData()); } public Constructor(TypeA a, TypeB b, TypeD d) {
How can I do this, avoiding this, the "constructor error should be the first operation in the constructor" error?
source share