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