[BUG][JAXRS-CXF-Client]Missing import of java.util.Objects in model classes
Created by: KiriRea
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I've generated jaxrs-cxf-client by OpenAPI Generator CLI (6.0.1). After generate, I found all model classes have import error of "java.util.Objects;". I think all model classess should be added import of "java.util.Objects;" during generating jaxrs-cxf-client.
openapi-generator version
6.0.1
OpenAPI declaration file content or url
Any OpenAPI declaration file like below. https://editor.swagger.io/ File -> Convert and save as JSON
Generation Details
- Access above link(https://editor.swagger.io/), and click "File" -> "Convert and save as JSON" (download swagger.json).
- Generate jaxrs-cxf-client by openapi-generator-cli.jar.
java -jar openapi-generator-cli-6.0.1.jar generate -g jaxrs-cxf-client -o PetStoreSample -i swagger.json
Steps to reproduce
- After generate jaxrs-cxf-clint, check model classes.
- equals method and hashCode method have import error about java.util.Objects.
public class Category {
...
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(id, category.id) &&
Objects.equals(name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
Related issues/PRs
None.
Suggest a fix
Automatically add "import java.util.Objects;" to each model class.