IDEA-251250 fixes after code review

GitOrigin-RevId: 383931c2a4caf3b4856ebbe9869f83c180f81879
This commit is contained in:
Andrey.Cherkasov
2020-10-22 22:50:10 +00:00
committed by intellij-monorepo-bot
parent 5f3ad9a81f
commit ce5ed84489
10 changed files with 16 additions and 18 deletions
@@ -798,16 +798,16 @@ public class JavaDocLocalInspection extends LocalInspectionTool {
}
private static class RemoveTagWithoutDescriptionFix implements LocalQuickFix {
private final String myTag;
private final String myTagName;
RemoveTagWithoutDescriptionFix(String tag) {
myTag = tag;
RemoveTagWithoutDescriptionFix(String tagName) {
myTagName = tagName;
}
@NotNull
@Override
public String getName() {
return CommonQuickFixBundle.message("fix.remove", myTag);
return CommonQuickFixBundle.message("fix.remove", myTagName);
}
@NotNull
@@ -818,9 +818,9 @@ public class JavaDocLocalInspection extends LocalInspectionTool {
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiDocTag myTag = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiDocTag.class);
if (myTag != null) {
myTag.delete();
PsiDocTag tag = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiDocTag.class);
if (tag != null) {
tag.delete();
}
}
}
@@ -454,9 +454,7 @@ public final class JavadocHighlightUtil {
else if ("throws".equals(tag.getName()) || "exception".equals(tag.getName())) {
if (emptyThrowsTag(tag)) {
String tagText = "<code>" + tag.getName() + "</code>";
PsiDocTagValue valueElement = tag.getValueElement();
String tagTextForFix = "@" + tag.getName() + (valueElement != null ? " " + valueElement.getText() : "");
LocalQuickFix fix = holder.removeTagWithoutDescriptionFix(tagTextForFix);
LocalQuickFix fix = holder.removeTagWithoutDescriptionFix(tag.getName());
holder.problem(tag.getNameElement(), JavaBundle.message("inspection.javadoc.method.problem.missing.tag.description", tagText), fix);
}
}
@@ -1,4 +1,4 @@
// "Remove '@exception IllegalArgumentException'" "true"
// "Remove 'exception'" "true"
class Foo {
/**
@@ -1,4 +1,4 @@
// "Remove '@exception'" "true"
// "Remove 'exception'" "true"
class Foo {
/**
@@ -1,4 +1,4 @@
// "Remove '@throws IllegalArgumentException'" "true"
// "Remove 'throws'" "true"
class Foo {
/**
@@ -1,4 +1,4 @@
// "Remove '@throws'" "true"
// "Remove 'throws'" "true"
class Foo {
/**
@@ -1,4 +1,4 @@
// "Remove '@exception IllegalArgumentException'" "true"
// "Remove 'exception'" "true"
class Foo {
/**
@@ -1,4 +1,4 @@
// "Remove '@exception'" "true"
// "Remove 'exception'" "true"
class Foo {
/**
@@ -1,4 +1,4 @@
// "Remove '@throws IllegalArgumentException'" "true"
// "Remove 'throws'" "true"
class Foo {
/**
@@ -1,4 +1,4 @@
// "Remove '@throws'" "true"
// "Remove 'throws'" "true"
class Foo {
/**