8277536: Use String.blank in jdk.javadoc where applicable

Reviewed-by: jjg
This commit is contained in:
Andrey Turbanov 2021-12-07 14:54:32 +00:00 committed by Jonathan Gibbons
parent 5b81d5eeb4
commit bb50b92b80
2 changed files with 6 additions and 20 deletions
src/jdk.javadoc/share/classes/jdk/javadoc/internal
doclets/formats/html
doclint

@ -896,7 +896,7 @@ public class HtmlDocletWriter {
* Return the link for the given member.
*
* @param context the id of the context where the link will be printed.
* @param typeElement the typeElement that we should link to. This is not
* @param typeElement the typeElement that we should link to. This is
* not necessarily the type containing element since we may be
* inheriting comments.
* @param element the member being linked to.
@ -912,7 +912,7 @@ public class HtmlDocletWriter {
* Return the link for the given member.
*
* @param context the id of the context where the link will be printed.
* @param typeElement the typeElement that we should link to. This is not
* @param typeElement the typeElement that we should link to. This is
* not necessarily the type containing element since we may be
* inheriting comments.
* @param element the member being linked to.
@ -929,7 +929,7 @@ public class HtmlDocletWriter {
* Return the link for the given member.
*
* @param context the id of the context where the link will be printed.
* @param typeElement the typeElement that we should link to. This is not
* @param typeElement the typeElement that we should link to. This is
* not necessarily the type containing element since we may be
* inheriting comments.
* @param element the member being linked to.
@ -945,7 +945,7 @@ public class HtmlDocletWriter {
* Return the link for the given member.
*
* @param context the id of the context where the link will be printed.
* @param typeElement the typeElement that we should link to. This is not
* @param typeElement the typeElement that we should link to. This is
* not necessarily the type containing element since we may be
* inheriting comments.
* @param element the member being linked to.
@ -1407,14 +1407,6 @@ public class HtmlDocletWriter {
return false;
}
boolean isAllWhiteSpace(String body) {
for (int i = 0 ; i < body.length(); i++) {
if (!Character.isWhitespace(body.charAt(i)))
return false;
}
return true;
}
// Notify the next DocTree handler to take necessary action
private boolean commentRemoved = false;
@ -1505,7 +1497,7 @@ public class HtmlDocletWriter {
// Ignore any trailing whitespace OR whitespace after removed html comment
if ((isLastNode || commentRemoved)
&& tag.getKind() == TEXT
&& isAllWhiteSpace(ch.getText(tag)))
&& ch.getText(tag).isBlank())
continue;
// Ignore any leading html comments

@ -1236,13 +1236,7 @@ public class Checker extends DocTreePathScanner<Void, Void> {
}
boolean hasNonWhitespace(TextTree tree) {
String s = tree.getBody();
for (int i = 0; i < s.length(); i++) {
Character c = s.charAt(i);
if (!Character.isWhitespace(s.charAt(i)))
return true;
}
return false;
return !tree.getBody().isBlank();
}
// </editor-fold>