Commit f0e6d95
committed
[Java][jaxrs-spec] add JSpecify support
jaxrs-spec had no jspecify support at all — no `useJspecify` option, and
the generator emitted no nullability annotations for any library. This
adds it generator-wide rather than per-library, because the model and
parameter templates are shared by all six libraries (default, quarkus,
thorntail, openliberty, helidon, kumuluzee); only quarkus overrides
formParams.
- JavaJAXRSSpecServerCodegen: `useJspecify` cliOption, applyJspecify()
and the Nullable imports for models and operations.
- Shared pojo.mustache (field, getter, setter, fluent setter) and the
six parameter partials, plus the quarkus formParams override.
- New JavaJaxRS/spec copies of modelPackageInfo/apiPackageInfo and the
nullable* partials: unlike the java client libraries, which all share
one `Java` template dir, jaxrs-spec has its own with no fallback.
- Base pom swaps jsr305 for jspecify under the flag, matching how the
java client libraries handle it; the quarkus pom adds jspecify.
applyJspecify() must run *after* the `supportingFiles.clear()` in
processOpts(), which would otherwise drop the @NullMarked package-info
files.
jaxrs-cxf-cdi extends this generator but uses its own cxf-cdi template
directory, so it would have advertised the option without honouring it —
the exact defect this change fixes elsewhere. It calls removeOption,
alongside the existing removeOption(GENERATE_JSON_CREATOR).
Every template change is guarded by {{#useJspecify}}: flag-off output is
byte-identical to before, verified by diffing against a jar built from
the parent branch for both the default and quarkus libraries.
Adds a sample (jaxrs-spec-quarkus-jspecify, registered in samples-jdk17
since the quarkus library targets Java 17) and two tests covering the
annotations, type-use placement on qualified types, and that the flag
off still emits jsr305 and no annotations.1 parent b7daf51 commit f0e6d95
43 files changed
Lines changed: 1708 additions & 11 deletions
File tree
- .github/workflows
- bin/configs
- docs/generators
- modules/openapi-generator/src
- main
- java/org/openapitools/codegen/languages
- resources/JavaJaxRS/spec
- libraries/quarkus
- test/java/org/openapitools/codegen/java/jaxrs
- samples/server/petstore/jaxrs-spec-quarkus-jspecify
- .openapi-generator
- src
- gen/java/org/openapitools
- api
- model
- main
- docker
- resources
- META-INF
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
| |||
255 | 256 | | |
256 | 257 | | |
257 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
258 | 264 | | |
259 | 265 | | |
260 | 266 | | |
| |||
348 | 354 | | |
349 | 355 | | |
350 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
351 | 361 | | |
352 | 362 | | |
353 | 363 | | |
| |||
481 | 491 | | |
482 | 492 | | |
483 | 493 | | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
484 | 497 | | |
485 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
486 | 508 | | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
0 commit comments