[JAVA] generate package-info.java for the auth package with useJspecify - #24808
Open
HDPark95 wants to merge 1 commit into
Open
[JAVA] generate package-info.java for the auth package with useJspecify#24808HDPark95 wants to merge 1 commit into
HDPark95 wants to merge 1 commit into
Conversation
The Java client generator writes a @NullMarked package-info.java for the model, api and invoker packages when useJspecify is enabled, but the authentication classes live in <invokerPackage>.auth, a sub-package that inherits nothing from the invoker package-info. That package was left outside the null-marked scope. Register authPackageInfo.mustache in JavaClientCodegen.applyJspecify(), guarded on an auth template actually being scheduled, so libraries that generate no authentication class (native) do not get a package-info.java for an empty package. Fixes OpenAPITools#24664
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #24664
With
useJspecify=truethe Java client generator writes a@NullMarkedpackage-info.javafor the model, api and invoker packages. The authentication classes sit in<invokerPackage>.auth; a sub-package inherits nothing from the invokerpackage-info.java, so it stays outside the null-marked scope.applyJspecify()now registersauthPackageInfo.mustachefor that folder, guarded on anauth/template actually being scheduled, sonative(no authentication class) gets nopackage-info.javafor an empty package.JavaClientCodegenTest#testJspecifyasserts the file for restclient/webclient/resttemplate and its absence for native; 6 of its 7 rows fail without the generator change. Full class 275/275 green, and the 4 regenerated samples compile.cc @martin-mfg @jpfinne
Summary by cubic
Fixes #24664 by generating a
@NullMarkedpackage-info.javafor the auth package whenuseJspecifyis enabled; previously the auth sub-package stayed outside the null-marked scope.Details
auth/template is actually scheduled, so libraries likenativethat produce no auth classes don't get apackage-info.javafor an empty package.testJspecifyto assert the file for restclient, webclient, and resttemplate, and its absence fornative; regenerated samples include it.Written for commit 793f23a. Summary will update on new commits.