isEmpty | “扫黄”

This commit is contained in:
林万程
2023-08-31 08:03:37 +08:00
parent 54f102fdfb
commit c37148a56a
13 changed files with 20 additions and 17 deletions

View File

@@ -37,7 +37,7 @@ Show doc comment at the Project view Tree, line End, json, other
<h3>My Project</h3>
<ul>
<li>Show doc comment at the Project view Tree, line End, json etc:
<li>Show doc comment at the Project view Tree, line End, json etc.:
<a href="https://plugins.jetbrains.com/plugin/18553-show-comment">Show Comment</a>
</li>
<li>Method call usage graph and maven dependency graph:

View File

@@ -29,7 +29,7 @@ public class JavaTree {
if (docComment == null) {
return null;
}
String s = JavaLangDoc.INSTANCE.docElementToStr(settingsInfo, docComment);
@Nullable String s = JavaLangDoc.INSTANCE.docElementToStr(settingsInfo, docComment);
if (s != null && !DocSkip.skipDoc(settingsInfo, s)) {
return s;
}

View File

@@ -47,7 +47,7 @@ public class OwnerToPsiDocUtils {
return null;
}
@Nullable String name = psiPackage.getName();
if (name == null || name.length() == 0) {
if (name == null || name.isEmpty()) {
return null;
}
@NotNull PsiDirectory[] psiDirectories = psiPackage.getDirectories();

View File

@@ -27,6 +27,9 @@ public class PsiClassUtils {
return PsiClass.EMPTY_ARRAY;
}
String className = matcher.group();
if (className == null) {
return PsiClass.EMPTY_ARRAY;
}
@NotNull PsiClass[] psiClasses = nameToClass(className, project);
if (psiClasses.length != 0) {
return psiClasses;

View File

@@ -15,7 +15,7 @@ class PsiMethodToPsiDoc {
@Nullable
static PsiDocComment methodSupperNewPropDoc(@NotNull PsiMethod psiMethod) {
// .class
PsiElement navElement = null;
@Nullable PsiElement navElement;
try {
navElement = psiMethod.getNavigationElement();
} catch (Exception e) {

View File

@@ -38,7 +38,7 @@ public class LineExt {
return null;
}
@Nullable Pattern pattern = ConfCache.pattern(lineInfo.project, keyMap, path);
if (pattern == null || pattern.pattern().length() == 0) {
if (pattern == null || pattern.pattern().isEmpty()) {
return null;
}
@NotNull Map<String, Map<String, List<String>>> docMap = ConfCache.docMap(path, name, ext);
@@ -100,7 +100,7 @@ public class LineExt {
@NotNull Map<String, Map<String, List<String>>> docMap,
@NotNull Map<String, Map<String, List<String>>> treeMap) {
word = word.trim();
if (word.length() == 0) {
if (word.isEmpty()) {
return false;
}
@Nullable String wordDoc = GetFromDocMap.get(docMap, word);

View File

@@ -31,7 +31,7 @@ class ConfFactory {
String key = list.get(0);
if (key.startsWith("?")) {
exclude.add(key.substring(1));
} else if (key.length() > 0 && !exclude.contains(key)) {
} else if (!key.isEmpty() && !exclude.contains(key)) {
sb.append(key).append("|");
}
}

View File

@@ -36,13 +36,13 @@ public class TsvLoader {
@NotNull List<String> words = Splitter.on('\t').splitToList(line);
if (!words.isEmpty()) {
String key = words.get(0);
if (key.length() == 0) {
if (key.isEmpty()) {
continue;
}
if (patternKey) {
key = StringEscapeUtils.unescapeJava(key);
String del = DEL_PATTERN.matcher(key).replaceAll("");
if (del.length() != 0) {
if (!del.isEmpty()) {
key = del;
}
}

View File

@@ -177,7 +177,7 @@ public abstract class BaseLangDoc extends EditorLinePainter {
}
@NotNull String cutDoc = DocFilter.cutDoc(s, lineInfo.appSettings, true);
@NotNull String filterDoc = DocFilter.filterDoc(cutDoc, lineInfo.appSettings, lineInfo.projectSettings);
if (filterDoc.trim().length() == 0) {
if (filterDoc.trim().isEmpty()) {
return null;
}
return filterDoc;

View File

@@ -31,14 +31,14 @@ public abstract class BaseTagLangDoc<DocElement> extends BaseLangDoc {
for (@NotNull String name : names) {
appendTag(lineInfo, tagStrBuilder, docElement, name);
}
if (desc.length() > 0) {
if (!desc.isEmpty()) {
if (tagStrBuilder.length() > 0) {
tagStrBuilder.insert(0, " @ ");
}
tagStrBuilder.insert(0, desc);
}
@NotNull String text = tagStrBuilder.toString().trim();
if (text.length() == 0) {
if (text.isEmpty()) {
return null;
}
return text;

View File

@@ -42,7 +42,7 @@ public class DocFilter {
}
s = s.trim();
sb.append(s);
if (s.length() > 0) {
if (!s.isEmpty()) {
sb.append(" ");
}
lineCount++;
@@ -93,7 +93,7 @@ public class DocFilter {
*/
public static void addHtml(@NotNull StringBuilder sb, @NotNull String s) {
@NotNull String deleteHtml = html2Text(s);
if (deleteHtml.length() > 0) {
if (!deleteHtml.isEmpty()) {
sb.append(deleteHtml);
}
}

View File

@@ -52,14 +52,14 @@ public class DocSkip {
}
static boolean include(@NotNull String text, @NotNull Pattern include) {
if (include.pattern().length() == 0) {
if (include.pattern().isEmpty()) {
return true;
}
return include.matcher(text).find();
}
static boolean exclude(@NotNull String text, @NotNull Pattern exclude) {
if (exclude.pattern().length() == 0) {
if (exclude.pattern().isEmpty()) {
return false;
}
return exclude.matcher(text).find();

View File

@@ -34,7 +34,7 @@ Show doc comment at the Project view Tree, line End, json, other
<h3>My Project</h3>
<ul>
<li>Show doc comment at the Project view Tree, line End, json etc:
<li>Show doc comment at the Project view Tree, line End, json etc.:
<a href="https://plugins.jetbrains.com/plugin/18553-show-comment">Show Comment</a>
</li>
<li>Method call usage graph and maven dependency graph: