Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javadoc for generated gRPC classes has warnings and errors #2139

Merged
merged 4 commits into from
Mar 10, 2022

Conversation

idelpivnitskiy
Copy link
Member

@idelpivnitskiy idelpivnitskiy commented Mar 10, 2022

Motivation:

Generated gRPC classes have javadoc with illegal HTML characters
< and > and misses some @param. It causes build failures when
project compiles with -Xwerror flag.

Modifications:

  • Replace parametrized types with non-parametrized for javadoc @link;
  • Add missing @param;
  • Include generated classes into testJavadoc task for
    servicetalk-grpc-protoc;

Result:

Project generates javadoc successfully when run with -Xwerror flag.

Motivation:

Generated gRPC classes have javadoc with illegal HTML characters
`<` and `>` and misses some `@param`. It causes build failures when
project compiles with `-Xwerror` flag.

Modifications:

- Replace parametrized types with non-parametrized for javadoc `@link`;
- Add missing `@param`;

Result:

Project generates javadoc successfully when run with `-Xwerror` flag.
@Scottmitch
Copy link
Member

Scottmitch commented Mar 10, 2022

looks like we still have some javadoc warnings due to generics <> still. here is how we can run javadoc validation during testing ... looks like protobuf-java also has some warnings so we won't be able to commit this yet but we can leave it commented out in the code to evaluate (and open an issue with protobuf-java).

diff --git a/servicetalk-grpc-protoc/build.gradle b/servicetalk-grpc-protoc/build.gradle
index e9e0ee541..1e024012b 100644
--- a/servicetalk-grpc-protoc/build.gradle
+++ b/servicetalk-grpc-protoc/build.gradle
@@ -108,3 +108,18 @@ afterEvaluate {
 clean {
   delete protobuf.generatedFilesBaseDir
 }
+
+sourceSets {
+  testJavaDocSourceSet {
+    java.srcDir file("$buildDir/generated/sources/proto")
+    sourceSets.test.allJava
+  }
+}
+
+task testJavadoc(type: Javadoc) {
+  source = sourceSets.testJavaDocSourceSet.allJava
+  classpath = sourceSets.test.compileClasspath
+  destinationDir = file("${buildDir}/tmp/testjavadoc")
+}
+
+test.finalizedBy(testJavadoc)

@Scottmitch
Copy link
Member

lets see if build passes, we may have to deactivate testing javadoc as part of the build bcz protobuf-java has some javadoc issues. however the error detection doesn't always flag it...

> Task :servicetalk-grpc-protoc:testJavadoc
/Users/scott/git/servicetalk/servicetalk-grpc-protoc/build/generated/sources/proto/test/java/test/shared/TestShared.java:1507: warning: no @param for value
      public Builder setUntilValue(

@idelpivnitskiy idelpivnitskiy merged commit dbcbfd8 into apple:main Mar 10, 2022
@idelpivnitskiy idelpivnitskiy deleted the grpc-javadoc branch March 10, 2022 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants