Skip to content

Move C++ virtual destructor definition to .cpp files (#21529)#21530

Merged
wing328 merged 2 commits intoOpenAPITools:masterfrom
pylaterreur:master
Feb 24, 2026
Merged

Move C++ virtual destructor definition to .cpp files (#21529)#21530
wing328 merged 2 commits intoOpenAPITools:masterfrom
pylaterreur:master

Conversation

@pylaterreur
Copy link
Copy Markdown
Contributor

@pylaterreur
Copy link
Copy Markdown
Contributor Author

pylaterreur commented Jul 8, 2025

Also, we probably want to look at why the destructors were/are not noexcept.

And there is an actual issue with the restbed cpp generator, it's creating classes inheriting from restbedcpp "Resource" which has a delete copy ctor, but these derived class define a default copy ctor, I'm not sure how that can work. The delete copy ctor in restbed cpp has been like this for 10 years. Are there enough tests for this?

@wing328
Copy link
Copy Markdown
Member

wing328 commented Jul 9, 2025

thanks for the pr

please follow step 3 in the pr checklist to update the samples

@pylaterreur
Copy link
Copy Markdown
Contributor Author

thanks for the pr

please follow step 3 in the pr checklist to update the samples

That's now done, in a 2nd commit in this PR.

There is 1 file I didn't commit, however, because I don't think this is due to any code changes of mine, it's a java generated file:

index 5062b4c48e..86be74c431 100644
--- a/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/model/Fruit.java
+++ b/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/model/Fruit.java
@@ -30,9 +30,7 @@ import javax.annotation.Generated;
 @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fruitType", visible = true)
 @JsonSubTypes({
   @JsonSubTypes.Type(value = Apple.class, name = "APPLE"),
-  @JsonSubTypes.Type(value = Banana.class, name = "BANANA"),
-  @JsonSubTypes.Type(value = Apple.class, name = "Apple"),
-  @JsonSubTypes.Type(value = Banana.class, name = "Banana")
+  @JsonSubTypes.Type(value = Banana.class, name = "BANANA")
 })
 
 @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")```
 
My JAVA_HOME is set to be /usr/ as this is where "java" is installed on my machine
java --version
openjdk 11.0.27 2025-04-15
OpenJDK Runtime Environment (build 11.0.27+6-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.27+6-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

@wing328
Copy link
Copy Markdown
Member

wing328 commented Jul 10, 2025

There is 1 file I didn't commit, however, because I don't think this is due to any code changes of mine, it's a java generated file:

that should be updated in the latest master

@wing328
Copy link
Copy Markdown
Member

wing328 commented Jul 10, 2025

thanks again for the pr

is it correct to say that you've tested the change locally in your environment (e.g. production) and confirm it's working for your use cases?

@wing328 wing328 merged commit e438e15 into OpenAPITools:master Feb 24, 2026
15 checks passed
@wing328 wing328 added Server: C++ Enhancement: Code Cleanup General refactoring, removal of deprecated things, commenting, etc. labels Feb 24, 2026
@wing328 wing328 added this to the 7.21.0 milestone Feb 24, 2026
@wing328
Copy link
Copy Markdown
Member

wing328 commented Feb 24, 2026

fyi @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @MartinDelille (2018/03) @muttleyxd (2019/08) @aminya (2025/05)

@aminya
Copy link
Copy Markdown
Contributor

aminya commented Feb 24, 2026

Approved

davidricodias pushed a commit to davidricodias/openapi-generator that referenced this pull request Mar 11, 2026
) (OpenAPITools#21530)

* Move C++ virtual destructor definition to .cpp files (OpenAPITools#21529)

* Subsequent commit with codegened C++ - PR step 3 (OpenAPITools#21529)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement: Code Cleanup General refactoring, removal of deprecated things, commenting, etc. Server: C++

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants