Skip to content

[BUG] [Java] Compilation warnings in RFC3339JavaTimeModule and RFC3339InstantDeserializer #21242

@ksn-partisia

Description

@ksn-partisia

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • 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

The latest release (7.13.0) introduced some new java files, RFC3339JavaTimeModule.java and RFC3339InstantDeserializer.java. These contains compilation warnings which when using the compiler options -Xlint:all, -Werror fails the compilation.

[WARNING] COMPILATION WARNING : 
[INFO] -------------------------------------------------------------
[WARNING] rest/client/RFC3339JavaTimeModule.java:[22,8] serializable class com.example.rest.client.RFC3339JavaTimeModule has no definition of serialVersionUID
[WARNING] rest/client/RFC3339InstantDeserializer.java:[32,8] serializable class com.example.rest.client.RFC3339InstantDeserializer has no definition of serialVersionUID
openapi-generator version

7.13.0

OpenAPI declaration file content or url
{
  "openapi": "3.0.3",
  "info": {
    "version": "1.0.0",
    "description": "Minimal example",
    "title": "Minimal example"
  },
  "paths": {}
}
Generation Details

Compiled using mvn compile

Steps to reproduce

I'm using this pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.example</groupId>
  <artifactId>openapi-minimum-example</artifactId>
  <version>1.0.0</version>

  <properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.16.1</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jsr310</artifactId>
      <version>2.16.1</version>
    </dependency>
    <dependency>
      <groupId>jakarta.annotation</groupId>
      <artifactId>jakarta.annotation-api</artifactId>
      <version>2.1.1</version>
    </dependency>
    <dependency>
      <groupId>jakarta.ws.rs</groupId>
      <artifactId>jakarta.ws.rs-api</artifactId>
      <version>3.1.0</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-jackson</artifactId>
      <version>3.1.7</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-client</artifactId>
      <version>3.1.7</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-multipart</artifactId>
      <version>3.1.7</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.12.1</version>
        <configuration>
          <showWarnings>true</showWarnings>
          <compilerArgs>
            <arg>-Xlint:all</arg>
            <arg>-Xlint:-processing</arg>
            <arg>-Xlint:-options</arg>
            <arg>-Werror</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.openapitools</groupId>
        <artifactId>openapi-generator-maven-plugin</artifactId>
        <version>7.13.0</version>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <apiNameSuffix>Client</apiNameSuffix>
              <inputSpec>${project.basedir}/openapi.json</inputSpec>
              <generatorName>java</generatorName>

              <apiPackage>com.example.rest.client.api</apiPackage>
              <generateApiTests>false</generateApiTests>
              <generateApiDocumentation>false</generateApiDocumentation>

              <modelPackage>com.example.rest</modelPackage>
              <generateModelTests>false</generateModelTests>
              <generateModelDocumentation>false</generateModelDocumentation>

              <configOptions>
                <annotationLibrary>none</annotationLibrary>
                <library>jersey3</library>
                <serializationLibrary>jackson</serializationLibrary>
                <useJakartaEe>true</useJakartaEe>
                <openApiNullable>false</openApiNullable>
                <supportUrlQuery>false</supportUrlQuery>
              </configOptions>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
Related issues/PRs

Fixed in #21243

Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions