[Java][RestClient] Mark non-required API method parameters @Nullable under JSpecify
Fixes #24388
Root cause
Under useJspecify, the Java restclient library rendered the public {operationId} and {operationId}WithHttpInfo method parameters via {{>nullable_var_annotations}} {{{dataType}}}. That emits @Nullable as a prefix, which JSpecifyNullableLambda then strips (so it can be re-injected TYPE_USE-style into the datatype by the jSpecifyDatatype lambda). Because these two methods did not wrap the datatype in {{#lambda.jSpecifyDatatype}}, the stripped @Nullable was never re-injected and the annotation was dropped entirely — so non-required parameters were left unmarked even though the generated package is @NullMarked. The private *RequestCreation and public *WithResponseSpec methods already used {{>nullableArgument}} and rendered correctly, which is why the same parameters were @Nullable on those methods but not on {operationId}/{operationId}WithHttpInfo.
Change
api.mustache (restclient library): the two affected public methods now use {{>nullableArgument}} — the same partial the correct-behaving methods already use. nullableArgument = {{>nullable_var_annotations}} {{#lambda.jSpecifyDatatype}}{{{dataType}}}{{/lambda.jSpecifyDatatype}}, so the @Nullable is correctly placed inside the type (java.time.@Nullable Instant). In non-JSpecify mode the two forms are equivalent, so output is unchanged there.
Verification done
- Built the CLI (JDK21) from a freshly-synced
masterand regenerated the affected sample (java-restclient-springBoot4-jackson3-jspecify). The only diff is the two public methods now marking the non-requireddtParam/dtQuery/dtCookieasjava.time.@Nullable Instant, byte-for-byte identical to the already-correct privatefooDtParamGetRequestCreationin the same file (which uses the existingorg.jspecify.annotations.Nullableimport). A required parameter (fileIdGet(String id)) correctly stays non-null. - Regenerated the non-JSpecify restclient samples (
java-restclient,java-restclient-springBoot4-jackson3,java-restclient-springBoot4-jackson2): zero diff, confirming the change is behavior-preserving outside JSpecify.
Summary by cubic
Marks non-required parameters in generated Java RestClient public methods as @Nullable under JSpecify. Fixes #24388 and keeps non-JSpecify output unchanged.
- Bug Fixes
- Use
{{>nullableArgument}}for params in{operationId}and{operationId}WithHttpInfoto enable type-use placement viajSpecifyDatatype. - Non-required params now render as
java.time.@Nullable Instantin@NullMarkedpackages, matching*RequestCreation/*WithResponseSpec. - Regenerated samples: JSpecify variant updated as expected; non-JSpecify variants unchanged.
- Use