[BUG][JavaSpring] Model classes attempt to use java.util.Arrays without importing it
Created by: anno1985
Bug Report Checklist
Description
The pojo.mustache template seems to attempt to use the Arrays class (four times) if #vendorExtensions.x-jackson-optional-nullable-helpers is set. However, the model.mustache doesn't seem to import java.util.Arrays;.
This results in a failing build at compile time (here with maven):
[ERROR] /path/to/target/generated-sources/openapi/src/gen/java/com/example/generated/model/MyModel.java:[100, 114] cannot find symbol
[ERROR] symbol: variable Arrays
[ERROR] location: class com.example.generated.model.MyModel
The issue appears when using openapi-generator-maven-plugin:5.2.1
Suggest a fix
I'm not familiar with mustache syntax, but I'm guessing adding something similar to the following to model.mustache around line 32 should do the trick:
{{^isEnum}}
{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
import java.util.Arrays;
{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
{{/isEnum}}
Alternatively, the respective code lines in pojo.mustache could be changed to use the fully qualified class name, java.util.Arrays instead of just Arrays (on lines 135, 142, 147 and 155).
Note that I haven't verified if the import is actually added correctly already if isByteArray is set, in which case changes to lines 135 and 147 would be superfluous (and the first option, changes to imports, might be preferable to sometimes fully qualifying the class and sometimes (when dealing with ByteArrays) relying on imports).