implement comment inheritance for methods#40
Conversation
c69fcab to
4cc037b
Compare
4cc037b to
9fb9344
Compare
joelmartinez
left a comment
There was a problem hiding this comment.
Overall, this LGTM ... I left a few comments, but will mark the PR as approved from my perspective, as they are just somewhat subjective comments that you very well may have a logical answer for how you did it :) great work.
| * | ||
| * @return true if there are no comments, false otherwise | ||
| */ | ||
| public boolean isSimpleOverride() { |
There was a problem hiding this comment.
I wonder if we might be able to find a better name for this member? according to the comment, it will return true if there are no comments or there's an inheritDoc ... however in usage, it seems this is used to determine when docs should be inherited or not.
So perhaps it might be better to name it with the purpose ... the actual signal that it sends ... something like public boolean shouldInheritDocs() ?
There was a problem hiding this comment.
Make sense, will re-think for better way to describe following 2 status.
- No comment for this method.
- There is
{@inheritDoc}tag, and also its own comments.
|
|
||
| List<? extends DocTree> inheritInlineTags(CommentHelper origin, CommentHelper chInheritFrom) { | ||
| List<DocTree> mergedTags = new ArrayList<>(); | ||
| if (!origin.isSimpleOverride() && !origin.hasInheritDocTag) { |
There was a problem hiding this comment.
doesn't isSimpleOverride already call hasInheritDocTag? Are there scenarios where isSimpleOverride() would return false, but hasInheritDocTag would return true?
you're more familiar with this codebase/logic so this very well may be the case, but it seems like a candidate for simplification of logic
There was a problem hiding this comment.
Nice catch. Will re-think for this, simplification seems possible.
My initial thinking was to separate the 2 different actions.
Case 1 - The method has no comment or have only {@inheritedDoc}. For these methods we just simply assign inlineTags of its overridden or implemented item to it.
@Override
public String getName() {};
/**
* {@inheritDoc}
*/
@Override
public String getVersion() {};
Case 2 - The method has comment and {@inheritedDoc}. For these methods we just copy comments and merge with it's own comment with some collection operations.
/**
* Get version from an item
* {@inheritDoc}
*/
@Override
public String getVersion() {};
https://dev.azure.com/ceapex/Engineering/_workitems/edit/225426/
Changes in this pr includes: