-
-
Notifications
You must be signed in to change notification settings - Fork 353
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
review: fix: get correct descriptions from CtJavaDocImpl #4061
Conversation
…tains a qualified name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewbwogi thanks for the PR, could you have a look at my comment?
while (this.getContent().length() > indexEndSentence + 1 | ||
&& !Character.isWhitespace(this.getContent().charAt(indexEndSentence + 1)) | ||
&& indexEndSentence != -1) { | ||
indexEndSentence = this.getContent().indexOf('.', indexEndSentence + 1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks rather complicated to me. Could you extract searching for the end-sentence index to a separate method (something like int indexOfFirstSentenceEnd(String content)
)?
Also, in comparisons, I'd strongly recommend putting the "dynamic" element (the value that changes) on the left, and only that. For example:
// not ideal IMO, as the key variable of the comparison is on the right (less evident)
// and part of a subexpression (+)
this.getContent().length() > indexEndSentence + 1
// better, they key variable is now on the left (immediately catches the eye) and stands on its own
indexEndSentence < this.getContent().length() - 1
I'd argue that's the standard for out-of-bounds checks at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @slarse, a new commit coming up.
ping @andrewbwogi to complete this one? |
Thanks @andrewbwogi, that's nice and easy to read! |
closes #4059