refactor(JavaLangDoc): delete simple method
This commit is contained in:
@@ -51,7 +51,7 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
|
||||
return null;
|
||||
}
|
||||
// must supper
|
||||
@Nullable PsiDocComment psiDocComment = OwnerToPsiDocUtils.supperMethodDoc(psiMethod);
|
||||
@Nullable PsiDocComment psiDocComment = PsiMethodToPsiDoc.supperMethodDoc(psiMethod);
|
||||
return docElementToStr(info, psiDocComment);
|
||||
}
|
||||
if (info.appSettings.fromNew) {
|
||||
|
||||
@@ -81,7 +81,8 @@ public class JavaTree {
|
||||
@Nullable
|
||||
static PsiDocComment dirDoc(@NotNull PsiDirectory child) {
|
||||
while (true) {
|
||||
@Nullable PsiDocComment docComment = OwnerToPsiDocUtils.dirDoc(child);
|
||||
@Nullable PsiPackage psiPackage = JavaDirectoryService.getInstance().getPackage(child);
|
||||
@Nullable PsiDocComment docComment = OwnerToPsiDocUtils.packageDoc(psiPackage);
|
||||
if (docComment != null) {
|
||||
return docComment;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public class OwnerToPsiDocUtils {
|
||||
private OwnerToPsiDocUtils() {}
|
||||
|
||||
@Nullable
|
||||
public static PsiDocComment srcOrByteCodeDoc(@NotNull PsiDocCommentOwner psiDocCommentOwner) {
|
||||
private static PsiDocComment srcOrByteCodeDoc(@NotNull PsiDocCommentOwner psiDocCommentOwner) {
|
||||
PsiElement navElement;
|
||||
try {
|
||||
navElement = psiDocCommentOwner.getNavigationElement();
|
||||
@@ -31,16 +31,6 @@ public class OwnerToPsiDocUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiDocComment methodDoc(@NotNull PsiMethod psiMethod) {
|
||||
return PsiMethodToPsiDoc.methodSupperNewPropDoc(psiMethod);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiDocComment supperMethodDoc(@NotNull PsiMethod psiMethod) {
|
||||
return PsiMethodToPsiDoc.supperMethodDoc(psiMethod);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiDocComment packageDoc(@Nullable PsiPackage psiPackage) {
|
||||
if (psiPackage == null) {
|
||||
@@ -91,10 +81,4 @@ public class OwnerToPsiDocUtils {
|
||||
PsiClass psiClass = classes[0];
|
||||
return srcOrByteCodeDoc(psiClass);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiDocComment dirDoc(@NotNull PsiDirectory psiDirectory) {
|
||||
@Nullable PsiPackage psiPackage = JavaDirectoryService.getInstance().getPackage(psiDirectory);
|
||||
return packageDoc(psiPackage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ParamDoc {
|
||||
if (method == null) {
|
||||
return null;
|
||||
}
|
||||
@Nullable PsiDocComment psiDocComment = OwnerToPsiDocUtils.methodDoc(method);
|
||||
@Nullable PsiDocComment psiDocComment = PsiMethodToPsiDoc.methodSupperNewPropDoc(method);
|
||||
if (psiDocComment == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class PsiMethodToPsiDoc {
|
||||
private PsiMethodToPsiDoc() {}
|
||||
|
||||
@Nullable
|
||||
static PsiDocComment methodSupperNewPropDoc(@NotNull PsiMethod psiMethod) {
|
||||
public static PsiDocComment methodSupperNewPropDoc(@NotNull PsiMethod psiMethod) {
|
||||
@Nullable PsiDocComment docComment = psiMethod.getDocComment();
|
||||
if (docComment != null) {
|
||||
return docComment;
|
||||
@@ -41,7 +41,7 @@ public class PsiMethodToPsiDoc {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static PsiDocComment supperMethodDoc(@NotNull PsiMethod psiMethod) {
|
||||
public static PsiDocComment supperMethodDoc(@NotNull PsiMethod psiMethod) {
|
||||
@NotNull PsiMethod[] superMethods;
|
||||
try {
|
||||
superMethods = psiMethod.findSuperMethods();
|
||||
@@ -59,7 +59,7 @@ public class PsiMethodToPsiDoc {
|
||||
if (navElement instanceof PsiMethod) {
|
||||
superMethod = (PsiMethod) navElement;
|
||||
}
|
||||
@Nullable PsiDocComment superDoc = OwnerToPsiDocUtils.methodSupperNewPropDoc(superMethod);
|
||||
@Nullable PsiDocComment superDoc = PsiMethodToPsiDoc.methodSupperNewPropDoc(superMethod);
|
||||
if (superDoc != null) {
|
||||
return superDoc;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.intellij.psi.PsiDocCommentOwner;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import io.github.linwancen.plugin.show.bean.SettingsInfo;
|
||||
import io.github.linwancen.plugin.show.java.doc.OwnerToPsiDocUtils;
|
||||
import io.github.linwancen.plugin.show.java.doc.PsiMethodToPsiDoc;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -25,8 +25,8 @@ public class OwnerToPsiDocSkip {
|
||||
return null;
|
||||
}
|
||||
@Nullable PsiDocComment docComment = docOwner instanceof PsiMethod
|
||||
? OwnerToPsiDocUtils.methodDoc(((PsiMethod) docOwner))
|
||||
: OwnerToPsiDocUtils.srcOrByteCodeDoc(docOwner);
|
||||
? PsiMethodToPsiDoc.methodSupperNewPropDoc(((PsiMethod) docOwner))
|
||||
: docOwner.getDocComment();
|
||||
return SkipUtils.skipDoc(info, docComment);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user