Skip to content

[JAVA] Bug found in RFC3339DateFormat about clone method #11311

@fcanovas1986

Description

@fcanovas1986
Description

We have been noticed by a bug in this class from spotbugs-maven-plugin. When generating the RFC3339DateFormat class:

[ERROR] Medium:xxxxxxxx.rest.client.invoker.RFC3339DateFormat.clone() does not call super.clone() [xxxxxxxxxx.rest.client.invoker.RFC3339DateFormat] At RFC3339DateFormat.java:[line 53] CN_IDIOM_NO_SUPER_CALL

If I check the class template RFC3339DateFormat.mustache I can see how it is true that the override method clone() does not call super.clone(). It only calls return this;, so it is not cloning the object.

@Override
  public Object clone() {
    return this;
  }

Find the reference to this bug here

openapi-generator version

5.3.0

Suggest a fix/enhancement

Calling super.clone method inside clone() method of RFC3339DateFormat would be enough. I would be happy to contribute if you want.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions