I am having a weird problem that I cannot get to the bottom of. I have a class as follows:
public class I18nTextBox extends I18nAbstractTextBox<String> {
public I18nTextBox() {
this("", Consts.MAXL_BASIC);
}
public I18nTextBox(String keyTitle) {
this(keyTitle, Consts.MAXL_BASIC);
}
public I18nTextBox(String keyTitle, int maxLength, String ... substitutions) {
super(keyTitle, maxLength, substitutions);
}
// ...
}
With its superclass defined as follows:
public abstract class I18nAbstractTextBox<T> extends TextBox implements IRefreshableDisplay, IModelDataField<T> {
// some properties ...
public I18nAbstractTextBox() {
this("", Consts.MAXL_BASIC);
}
public I18nAbstractTextBox(String keyTitle) {
this(keyTitle, Consts.MAXL_BASIC);
}
public I18nAbstractTextBox(String keyTitle, int maxLength, String ... substitutions) {
// do some logic
}
//...
}
Eclipse shows no compiler errors whatsoever, yet when I run GWT's debug mode, as soon as it tries to load the app I get a whole load of The constructor I18nTextBox() is undefined errors, every time I instantiate the first class (I18nTextBox).
It used to be the case that there was just one class, the I18nTextBox, but we took it, made it abstract and created I18nTextBox to extend it because we needed a special type of typing, so I know that the class works in its own right.
To summarise:
- Constructor is defined on subclass, and in superclass.
- Eclipse sees nothing wrong.
- When project is compiled by the GWT compiler, I get loads of "constructor not found" errors.
No-one at work seems to be able to see the problem, does anyone have any idea what might be going on?
Update
So it has been pointed out that a 2 argument constructor is missing, but there are two things to say on this:
- the argument
String ... substitutionsis an optional argument, so should default to null if not specified. - this worked before when there was only I18nTextBox and no abstract super class (we abstracted as explained above).
If I go on and specify another constructor, as follows:
public I18nTextBox(String keyTitle, int maxLength) {
this(keyTitle, maxLength, "");
}
Then I fix the error in I18nTextBox, but get the same error for I18nIntegerTextBox which is defined in exactly the same way:
public class I18nIntegerTextBox extends I18nAbstractTextBox<Integer> {
public I18nIntegerTextBox() {
this("", Consts.MAXL_BASIC);
}
public I18nIntegerTextBox(String keyTitle) {
this(keyTitle, Consts.MAXL_BASIC);
}
public I18nIntegerTextBox(String keyTitle, int maxLength) {
this(keyTitle, maxLength, "");
}
public I18nIntegerTextBox(String keyTitle, int maxLength, String ... substitutions) {
super(keyTitle, maxLength, substitutions);
}
// ...
}
So I just don't understand what is going wrong!