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

[FEATURE] Add Java docs and mandate for all new classes #27

Closed
saratvemulapalli opened this issue Jun 23, 2022 · 9 comments · Fixed by #45
Closed

[FEATURE] Add Java docs and mandate for all new classes #27

saratvemulapalli opened this issue Jun 23, 2022 · 9 comments · Fixed by #45
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@saratvemulapalli
Copy link
Member

Is your feature request related to a problem?

We are missing Java docs for this repository.

What solution would you like?

Lets add support for Java docs and mandate all new classes to have them.
We could run this check as part of the PR check workflow.

@dbwiddis
Copy link
Member

+1. We are small enough right now to fix this without too much effort.

@dbwiddis
Copy link
Member

dbwiddis commented Jul 7, 2022

When I submitted a PR on the core repo yesterday the PR template included a check-off for Javadocs. I'll add that to this repo; may not be an automated check but it will be something that submitters will see when they submit a PR, and should prompt code reviewers to do so as well.

Also can we be clear on the policy for Javadocs? My thoughts:

  • Required for all classes
  • Required for all public and protected methods, with the exception of getters and setters where the only javadoc would be "gets the foo"; "sets the foo". Optional for private methods if the usage isn't obvious.
    • First line should be short and end in a period.
    • Separate paragraphs with <p>
    • @param required if any parameters. Explicitly state if null is allowed.
    • @param required for generics, e.g., <T>
    • @return required including what return values represent error conditions. Explicitly state if null is returned.
    • @throws required for runtime exceptions that aren't caught

@dbwiddis
Copy link
Member

dbwiddis commented Jul 8, 2022

I should have added to the above list. If a method overrides a method in a superclass, it automatically inherits that javadoc so it isn't required -- but can be added with the inheritdoc annotation if there's anything additional to say that the superclass/interface javadoc doesn't cover.

@dbwiddis dbwiddis self-assigned this Jul 8, 2022
@dbwiddis dbwiddis added documentation Improvements or additions to documentation and removed untriaged labels Jul 10, 2022
@dbwiddis
Copy link
Member

https://github.com/plume-lib/require-javadoc

@dbwiddis
Copy link
Member

After spending way too much time yesterday implementing the way that the main project does this, I'm thinking I'd prefer to use the require-javadoc dependency linked in the previous comment.

Existing method:

  • requires duplicating (and then tweaking) the entire doc-tools directory from the OpenSearch site, including two build.gradle scripts and a file originated from Apache Solr, making it a derivative of a derivative. Like the game of telephone, the further away from the source the more likely there are to be unknown errors.
  • is not configurable at all and is extremely strict
    • doesn't allow skipping for trivial property accessors (getters and setters) or default, no-arg constructors (requires creating a constructor just to javadoc it!)
  • will not be automatically updated with bug fixes or features, etc.
  • The underlying javadoc checks (param, return, etc.) come from the javadoc tool itself, this import is only used to verify their presence as javadoc won't warn on a missing one.

In contrast, require-javadoc:

  • is published on Maven Central and importing it is a one-liner compared to an entire file structure
  • is supported: I submitted a feature request yesterday and there's already a PR on it (that I have reviewed)

@saratvemulapalli and @owaiskazi19 what are your thoughts?

@peternied
Copy link
Member

I would rather add dependencies on maintained components, I'd cast my vote with either require-javadoc or checkstyle.

If there are missing features in either tool, this would be a good reason to improve them with a proposal and pull request(s) to unblock adoption.

@saratvemulapalli
Copy link
Member Author

saratvemulapalli commented Jul 12, 2022

@saratvemulapalli and @owaiskazi19 what are your thoughts?

I would always prefer relying on standard implementation vs something for us to maintain down the line.
I would go with require-javadoc, also take our learnings to opensearch repository.

@owaiskazi19
Copy link
Member

@saratvemulapalli and @owaiskazi19 what are your thoughts?

Discussed offline. +1 to @saratvemulapalli

@dbwiddis
Copy link
Member

OK, will switch to require-javadoc for this repo, and get some lessons learned and if we like it suggest for the main repo.

FYI, I requested plume-lib/require-javadoc#143 to help minimize trivial documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants