[JAVA] generate package-info.java for the auth package with useJspecify

HD
2mo ago
+27-0

Fixes #24664

With useJspecify=true the Java client generator writes a @NullMarked package-info.java for the model, api and invoker packages. The authentication classes sit in <invokerPackage>.auth; a sub-package inherits nothing from the invoker package-info.java, so it stays outside the null-marked scope.

applyJspecify() now registers authPackageInfo.mustache for that folder, guarded on an auth/ template actually being scheduled, so native (no authentication class) gets no package-info.java for an empty package.

JavaClientCodegenTest#testJspecify asserts 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 @NullMarked package-info.java for the auth package when useJspecify is enabled; previously the auth sub-package stayed outside the null-marked scope.

Details

  • Generates the file only when an auth/ template is actually scheduled, so libraries like native that produce no auth classes don't get a package-info.java for an empty package.
  • Extends testJspecify to assert the file for restclient, webclient, and resttemplate, and its absence for native; regenerated samples include it.