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

protoc-generated Java files generate lots of warnings with Java 8 javadoc #304

Closed
huxi opened this issue Apr 26, 2015 · 7 comments
Closed

Comments

@huxi
Copy link

huxi commented Apr 26, 2015

warning: no @return
warning: no @param for value
warning: no @param for index
warning: no @param for builderForValue

See also Turning off doclint in JDK 8 Javadoc for a workaround.

@gliptak
Copy link

gliptak commented Jun 16, 2015

Could the compiler generate the Javadoc tags?

@huxi
Copy link
Author

huxi commented Jun 16, 2015

There are some options:

  1. it could generate stupid comments like @param value the value
  2. it could not generate any of those comments at all
  3. it could generate the current comments, but starting with /* instead of /** - so they are not real javadoc comments.

I'd go for either 1. or 3.

@gliptak
Copy link

gliptak commented Jun 17, 2015

The compiler probably has "knowledge" what all the parameters are (as it generates a patterned set of accessor methods).

rameshdharan added a commit to rameshdharan/cloud-bigtable-client that referenced this issue Jul 25, 2016
The javadoc linter in Java 8 produces a larger number of warnings that
are not easily fixable for us since they depend on upstream fixes, see
e.g. protocolbuffers/protobuf#304

So just run without the linter for now.
rameshdharan added a commit to rameshdharan/cloud-bigtable-client that referenced this issue Jul 25, 2016
The javadoc linter in Java 8 produces a larger number of warnings that
are not easily fixable for us since they depend on upstream fixes, see
e.g. protocolbuffers/protobuf#304

So just run without the linter for now.
rameshdharan added a commit to rameshdharan/cloud-bigtable-client that referenced this issue Jul 28, 2016
The javadoc linter in Java 8 produces a larger number of warnings that
are not easily fixable for us since they depend on upstream fixes, see
e.g. protocolbuffers/protobuf#304

So just run without the linter for now.
sduskis pushed a commit to googleapis/java-bigtable-hbase that referenced this issue Jul 31, 2016
* Exclude v1 API from javadoc generation

I think it's best to skip this set since the V1 API is deprecated (and
it generates a bunch of warnings). We can always change our minds later
of course if we have to revisit this.

Testing Done:
- verified that the warnings produced during javadoc:javadoc for v1
  protos go away

* Remove executable permissions from README.md

No need for +x on this markdown file.

* Autofix a large number of javadoc warnings

This change is the result of using javadoc:fix to mostly automatically
fix a huge set of javadoc warnings.

There were a couple of cases where I had to fix up what the autofixer
produced:

BigtableOptions.java
- for some reason the autofixer inserted copies of a large number of
  functions and members resulting in duplicated / redefined names and a
  non-compiling file. Fixed it manually after inspecting the damage.

BulkOptions.java
- tool didn't know to change '<' to '&lt;' and so generated bad HTML.

author tags:
The tool inserted @author dharan all over the place and I manually
changed it to sduskis since that seemed like the logical default.

Testing Done:
- mvn javadoc:javadoc (still produces warnings, but less of them now)
- mvn clean install (all tests pass)

* Silence the javadoc linter

The javadoc linter in Java 8 produces a larger number of warnings that
are not easily fixable for us since they depend on upstream fixes, see
e.g. protocolbuffers/protobuf#304

So just run without the linter for now.

* Fix remaining javadoc warnings

- fix a couple of warnings for @link cases that javadoc was unable to
  resolve, and add a link to the gRPC docs and make sure
  io.grpc.Status.Code can be resolved
- Remove autofixer's mistakenly applied @inheritdoc
- fixup documentation for Logger class to better explain varargs use
niketanpansare referenced this issue in apache/systemds Apr 20, 2017
This experimental interface is called Caffe2DML and doesnot affect other functionality.

- Updated the interface to match the Caffe specification as per
  @bertholdreinwald 's suggestion.
- Added support for fine-tuning.
- Added support for explain, statistics and gpu.

Closes #422.
@liujisi
Copy link
Contributor

liujisi commented Dec 11, 2017

We are closing open issues. Feel free to send PRs and reopen if you'd like to follow up on the issue.

@ST-DDT
Copy link
Contributor

ST-DDT commented Sep 13, 2018

Is that issue fixed yet? AFAICT it isn't in com.google.protobuf:protoc:3.6.1.

I tested it in my maven project with a config similar to this one.

<build>
	<extensions>
		<extension>
			<groupId>kr.motd.maven</groupId>
			<artifactId>os-maven-plugin</artifactId>
			<version>1.6.0</version>
		</extension>
	</extensions>

	<plugins>
		<plugin>
			<groupId>org.xolstice.maven.plugins</groupId>
			<artifactId>protobuf-maven-plugin</artifactId>
			<version>0.5.1</version>
			<configuration>
				<clearOutputDirectory>false</clearOutputDirectory>
				<protocArtifact>com.google.protobuf:protoc:3.6.1:exe:${os.detected.classifier}</protocArtifact>
			</configuration>
			<executions>
				<execution>
					<phase>generate-sources</phase>
					<goals>
						<goal>compile</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
		<plugin>
			<artifactId>maven-javadoc-plugin</artifactId>
			<executions>
				<execution>
					<id>attach-javadoc</id>
					<goals>
						<goal>jar</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

which generates classes with methods like these:

  /**
   * <code>repeated string tag = 3;</code>
   */
  java.util.List<java.lang.String>
      getTagList();
  /**
   * <code>repeated string tag = 3;</code>
   */
  int getTagCount();
  /**
   * <code>repeated string tag = 3;</code>
   */
  java.lang.String getTag(int index);
  /**
   * <code>repeated string tag = 3;</code>
   */
  com.google.protobuf.ByteString
      getTagBytes(int index);

and causes warnings like these:

[WARNING] public Builder setTag(
[WARNING] ^
[WARNING] [...]/SampleProto.java:666: warning: no @param for value
[WARNING] public Builder setTag(
[WARNING] ^
[WARNING] [...]/SampleProto.java:666: warning: no @return
[WARNING] public Builder setTag(
[WARNING] ^
[WARNING] [...]/SampleProto.java:679: warning: no @param for value
[WARNING] public Builder addTag(
[WARNING] ^
[WARNING] [...]/SampleProto.java:679: warning: no @return
[WARNING] public Builder addTag(
[WARNING] ^
[WARNING] [...]/SampleProto.java:692: warning: no @param for values
[WARNING] public Builder addAllTag(
[WARNING] ^
[WARNING] [...]/SampleProto.java:692: warning: no @return
[WARNING] public Builder addAllTag(
[WARNING] ^
[WARNING] [...]/SampleProto.java:703: warning: no @return
[WARNING] public Builder clearTag() {
[WARNING] ^
[WARNING] [...]/SampleProto.java:712: warning: no @param for value
[WARNING] public Builder addTagBytes(
[WARNING] ^
[WARNING] [...]/SampleProto.java:712: warning: no @return
[WARNING] public Builder addTagBytes(
[WARNING] ^

@vmsh0
Copy link

vmsh0 commented Dec 13, 2019

+1 I would like to see this fixed, either by having informative documentation generated or by having dummy tags added.

@ST-DDT
Copy link
Contributor

ST-DDT commented Dec 13, 2019

I recently started with the second batch of javadoc additions, but there are plenty of different cases.

getFieldOrBuilder, getFieldBuilder, getRepeatedFieldOrBuilderAtIndex, getRepeatedFieldBuilderAtIndex, addRepeatedFieldBuilder, addRepeatedFieldBuilderAtIndex

and these are just a few of them that return a Builder or an XOrBuilder.
Maybe I can do the "simple" ones in the next month so we get less warnings for the start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants