[BUG] Java generated code compilation failure
Created by: rgala
When model name contains single digit or digits only, for example "1", it will generate Model1.java class with the following equals method:
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Model1 1 = (Model1) o;
return Objects.equals(this.error, 1.error);
}
The compilation of
Model1 1 = (Model1) o;
fails because the java variable name cannot start with digits. It should be escaped like it happens for model names starting with digits and having letters too, for example 5abff9bf gets renamed to _5abff9bf.
The
if (name.matches("^[A-Z0-9_]*$")) {
regex in AbstractJavaCodegen class should not match digits only names.