mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
allow duplicate throws (IDEADEV-41667)
This commit is contained in:
@@ -96,6 +96,7 @@ public class JavaDocLocalInspection extends BaseLocalInspectionTool {
|
||||
@NonNls public Options FIELD_OPTIONS = new Options("none", "");
|
||||
public boolean IGNORE_DEPRECATED = false;
|
||||
public boolean IGNORE_JAVADOC_PERIOD = true;
|
||||
public boolean IGNORE_DUPLICATED_THROWS = false;
|
||||
public String myAdditionalJavadocTags = "";
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("com.intellij.codeInspection.javaDoc.JavaDocLocalInspection");
|
||||
@@ -242,6 +243,15 @@ public class JavaDocLocalInspection extends BaseLocalInspectionTool {
|
||||
}
|
||||
});
|
||||
add(periodCheckBox, gc);
|
||||
|
||||
final JCheckBox ignoreDuplicateThrowsCheckBox = new JCheckBox("Ignore duplicate throws tag",
|
||||
IGNORE_DUPLICATED_THROWS);
|
||||
ignoreDuplicateThrowsCheckBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
IGNORE_DUPLICATED_THROWS = ignoreDuplicateThrowsCheckBox.isSelected();
|
||||
}
|
||||
});
|
||||
add(ignoreDuplicateThrowsCheckBox, gc);
|
||||
}
|
||||
|
||||
public FieldPanel createAdditionalJavadocTagsPanel(){
|
||||
@@ -1012,7 +1022,7 @@ public class JavaDocLocalInspection extends BaseLocalInspectionTool {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void checkDuplicateTags(final PsiDocTag[] tags,
|
||||
private void checkDuplicateTags(final PsiDocTag[] tags,
|
||||
ArrayList<ProblemDescriptor> problems,
|
||||
final InspectionManager manager, boolean isOnTheFly) {
|
||||
Set<String> documentedParamNames = null;
|
||||
@@ -1037,7 +1047,7 @@ public class JavaDocLocalInspection extends BaseLocalInspectionTool {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ("throws".equals(tag.getName()) || "exception".equals(tag.getName())) {
|
||||
else if (!IGNORE_DUPLICATED_THROWS && ("throws".equals(tag.getName()) || "exception".equals(tag.getName()))) {
|
||||
PsiDocTagValue value = tag.getValueElement();
|
||||
if (value != null) {
|
||||
final PsiElement firstChild = value.getFirstChild();
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
/**
|
||||
*@throws ArrayIndexOutOfBoundsException in some case
|
||||
*@throws ArrayIndexOutOfBoundsException and in some other case
|
||||
*/
|
||||
void foo() throws ArrayIndexOutOfBoundsException {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -56,4 +56,10 @@ public class JavaDocInspectionTest extends InspectionTestCase {
|
||||
public void testGenericsParams() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIgnoreDuplicateThrows() throws Exception {
|
||||
final JavaDocLocalInspection inspection = new JavaDocLocalInspection();
|
||||
inspection.IGNORE_DUPLICATED_THROWS = true;
|
||||
doTest("javaDocInspection/" + getTestName(true), inspection);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user