You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[+] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Generator generates code with this-escape warnings in ApiClient.
If you add -Xlint:all, -Werror to java compiler options, you will get error on any open-api specification.
Java compiler logs
...\project\build\java\src\main\java\org\openapitools\example\invoker\ApiClient.java:103: warning: [this-escape] possible 'this' escape before subclass is fully initialized
this.init();
^
...\project\build\java\src\main\java\org\openapitools\example\invoker\ApiClient.java:107: warning: [this-escape] possible 'this' escape before subclass is fully initialized
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient()), createDefaultDateFormat());
^
...\project\build\java\src\main\java\org\openapitools\example\invoker\ApiClient.java:122: warning: [this-escape] previous possible 'this' escape happens here via invocation
this.init();
^
...\project\build\java\src\main\java\org\openapitools\example\invoker\ApiClient.java:111: warning: [this-escape] possible 'this' escape before subclass is fully initialized
this(buildWebClient(mapper.copy()), format);
^
...\project\build\java\src\main\java\org\openapitools\example\invoker\ApiClient.java:122: warning: [this-escape] previous possible 'this' escape happens here via invocation
this.init();
^
...\project\build\java\src\main\java\org\openapitools\example\invoker\ApiClient.java:115: warning: [this-escape] possible 'this' escape before subclass is fully initialized
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
^
...\project\build\java\src\main\java\org\openapitools\example\invoker\ApiClient.java:122: warning: [this-escape] previous possible 'this' escape happens here via invocation
this.init();
^
Bug Report Checklist
Description
Generator generates code with this-escape warnings in
ApiClient
.If you add
-Xlint:all
,-Werror
to java compiler options, you will get error on any open-api specification.Java compiler logs
openapi-generator version
v7.2.0
OpenAPI declaration file content or URL
https://github.com/OpenAPITools/openapi-generator/blob/1105759a6f20edac389fa547359c7d5e6c4f9ac8/modules/openapi-generator-gradle-plugin/samples/local-spec/petstore-v3.0.yaml
Information to reproduce
jdk: Oracle OpenJDK 21.0.1
gradle: 8.5
open-api generator plugin: 7.2.0
build.gradle.kts
Suggest a fix
Change
init
method in classApiClient
The text was updated successfully, but these errors were encountered: