mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
Don't warn about missing tag description on void methods
GitOrigin-RevId: 7125c41e5adfb4a45f96b6f5c9b6db12a9a0da6d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ea5b5de628
commit
1a75f19cff
@@ -326,7 +326,7 @@ public class JavaDocLocalInspection extends LocalInspectionTool {
|
||||
}
|
||||
|
||||
if (!myIgnoreEmptyDescriptions) {
|
||||
JavadocHighlightUtil.checkEmptyMethodTagsDescription(tags, holder);
|
||||
JavadocHighlightUtil.checkEmptyMethodTagsDescription(tags, method, holder);
|
||||
}
|
||||
|
||||
checkBasics(docComment, tags, method, false, METHOD_OPTIONS, holder);
|
||||
|
||||
@@ -438,14 +438,16 @@ public final class JavadocHighlightUtil {
|
||||
}
|
||||
}
|
||||
|
||||
static void checkEmptyMethodTagsDescription(PsiDocTag @NotNull [] tags, @NotNull ProblemHolder holder) {
|
||||
static void checkEmptyMethodTagsDescription(PsiDocTag @NotNull [] tags,
|
||||
@NotNull PsiMethod psiMethod,
|
||||
@NotNull ProblemHolder holder) {
|
||||
for (PsiDocTag tag : tags) {
|
||||
if (ContainerUtil
|
||||
.exists(tag.getChildren(), e -> e instanceof PsiInlineDocTag && ((PsiInlineDocTag)e).getName().equals("inheritDoc"))) {
|
||||
continue;
|
||||
}
|
||||
if ("return".equals(tag.getName())) {
|
||||
if (emptyTag(tag)) {
|
||||
if (!PsiType.VOID.equals(psiMethod.getReturnType()) && emptyTag(tag)) {
|
||||
String tagText = "<code>@return</code>";
|
||||
LocalQuickFix fix = holder.removeTagWithoutDescriptionFix("return");
|
||||
holder.problem(tag.getNameElement(), JavaBundle.message("inspection.javadoc.method.problem.missing.tag.description", tagText), fix);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
/**
|
||||
* <warning descr="Tag 'return' is not allowed here">@return</warning>
|
||||
*/
|
||||
public void foo() {}
|
||||
}
|
||||
@@ -74,6 +74,7 @@ public class JavadocHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testSeeConstants() { doTest(); }
|
||||
public void testSeeNonRefs() { doTest(); }
|
||||
public void testReturn0() { doTest(); }
|
||||
public void testReturn1() { doTest(); }
|
||||
public void testException0() { doTest(); }
|
||||
public void testException1() { doTest(); }
|
||||
public void testException2() { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user