diff --git a/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspection.java b/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspection.java
index 4eedb6c34abe..9c4b90c9a5ab 100644
--- a/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspection.java
@@ -1120,7 +1120,7 @@ public class JavaDocLocalInspection extends BaseLocalInspectionTool {
@NotNull
public String getGroupDisplayName() {
- return "";
+ return InspectionsBundle.message("group.names.javadoc.issues");
}
@NotNull
diff --git a/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocReferenceInspection.java b/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocReferenceInspection.java
index f014c86a0349..af46d0c795d8 100644
--- a/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocReferenceInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocReferenceInspection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -202,7 +202,7 @@ public class JavaDocReferenceInspection extends BaseLocalInspectionTool {
@NotNull
public String getGroupDisplayName() {
- return "";
+ return InspectionsBundle.message("group.names.javadoc.issues");
}
@NotNull
diff --git a/java/openapi/src/com/intellij/codeInsight/daemon/GroupNames.java b/java/openapi/src/com/intellij/codeInsight/daemon/GroupNames.java
index 489bb3c8211a..80ca8cc766b0 100644
--- a/java/openapi/src/com/intellij/codeInsight/daemon/GroupNames.java
+++ b/java/openapi/src/com/intellij/codeInsight/daemon/GroupNames.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,4 +73,5 @@ public interface GroupNames {
String JAVAEE_GROUP_NAME = InspectionsBundle.message("group.names.javaee.issues");
String CONCURRENCY_ANNOTATION_ISSUES = "Concurrency annotation issues";
+ String JAVADOC_GROUP_NAME = InspectionsBundle.message("group.names.javadoc.issues");
}
diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties
index 85036f71891a..a0d72a67868c 100644
--- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties
@@ -211,8 +211,8 @@ inspection.problem.descriptor.count={0, choice, 0#|1#(1 item)|2#({0,number,integ
inspection.action.go.next=Go Next Problem
inspection.actiongo.prev=Go Prev Problem
-inspection.javadoc.display.name=Declaration has javadoc problems
-inspection.javadoc.ref.display.name=Declaration has problems in javadoc references
+inspection.javadoc.display.name=Declaration has Javadoc problems
+inspection.javadoc.ref.display.name=Declaration has problems in Javadoc references
inspection.javadoc.option.tab.title=Class
inspection.javadoc.option.tab.title.method=Method
inspection.javadoc.option.tab.title.field=Field
@@ -223,8 +223,8 @@ inspection.javadoc.option.ignore.period=Ignore period problems
inspection.scope.for.title=Scope
inspection.javadoc.required.tags.option.title=Required Tags
-inspection.javadoc.problem.descriptor=Required javadoc is absent
-inspection.javadoc.problem.descriptor1=Period in the documentation is missing. The period is used by the javadoc tool to generate the comment for the overview page
+inspection.javadoc.problem.descriptor=Required Javadoc is absent
+inspection.javadoc.problem.descriptor1=Period in the documentation is missing. The period is used by the Javadoc tool to generate the comment for the overview page
inspection.javadoc.problem.missing.tag=Required tag {0} is missing
inspection.javadoc.problem.missing.author.description=Author is missing after @author tag
inspection.javadoc.problem.missing.version.description=Version is missing after @version tag
@@ -240,7 +240,7 @@ inspection.javadoc.problem.duplicate.param=Duplicate @param tag for parameter ''
inspection.javadoc.problem.duplicate.throws=Duplicate @throws or @exception tag for exception ''{0}''
inspection.javadoc.problem.duplicate.tag=Duplicate @{0} tag
inspection.javadoc.problem.add.tag=Add tag @{0} {1}
-inspection.javadoc.problem.add.tag.family=Add missing javadoc tag
+inspection.javadoc.problem.add.tag.family=Add missing Javadoc tag
inspection.javadoc.problem.add.param.tag=Add tag @param for parameter ''{0}''
inspection.export.results.abstract=abstract
@@ -259,8 +259,8 @@ inspection.surround.if.quickfix=Surround with ''if ({0} != null)''
inspection.surround.if.family=Surround with if
inspection.dependency.configure.button.text=Configure dependency rules
-inspection.javadoc.label.text=Additional JavaDoc Tags
-inspection.javadoc.dialog.title=Edit Additional JavaDoc Tags
+inspection.javadoc.label.text=Additional Javadoc Tags
+inspection.javadoc.dialog.title=Edit Additional Javadoc Tags
inspection.javadoc.html.not.required.label.text=Additional Not Required Html Attributes
inspection.javadoc.html.not.required.dialog.title=Edit Additional Not Required Html Attributes
inspection.required.attributes.display.name=Missing required attribute
@@ -473,6 +473,7 @@ group.names.javabeans.issues=JavaBeans issues
group.names.inheritance.issues=Inheritance issues
group.names.data.flow.issues=Data flow issues
group.names.declaration.redundancy=Declaration Redundancy
+group.names.javadoc.issues=Javadoc issues
duplicate.property.display.name=Duplicate Property
diff --git a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties
index 8948f9e10095..7cfdd938a2bf 100644
--- a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties
+++ b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties
@@ -1745,13 +1745,13 @@ listener.may.use.adapter.display.name=Class may extend adapter instead of implem
listener.may.use.adapter.problem.descriptor=Class ''{0}'' may extend ''{1}'' instead of implementing #ref #loc
listener.may.use.adapter.quickfix=Replace with ''extends {0}''
listener.may.use.adapter.emtpy.methods.option=&Only warn when empty implementing methods are found
-unnecessary.inherit.doc.display.name=Unnecessary {@inheritDoc} JavaDoc Comment
-unnecessary.inherit.doc.problem.descriptor=JavaDoc comment containing only #ref is unnecessary #loc
+unnecessary.inherit.doc.display.name=Unnecessary {@inheritDoc} Javadoc Comment
+unnecessary.inherit.doc.problem.descriptor=Javadoc comment containing only #ref is unnecessary #loc
unnecessary.inherit.doc.quickfix=Remove unnecessary @inheritDoc
multiple.exceptions.declared.on.test.method.display.name=Multiple exceptions declared on test method
multiple.exceptions.declared.on.test.method.problem.descriptor=#ref could be replaced with 'throws Exception' #loc
multiple.exceptions.declared.on.test.method.quickfix=Replace with 'throws Exception'
-unnecessary.javadoc.link.display.name=Unnecessary JavaDoc link
+unnecessary.javadoc.link.display.name=Unnecessary Javadoc link
unnecessary.javadoc.link.super.method.problem.descriptor=#ref pointing to super method is unnecessary #loc
unnecessary.javadoc.link.this.method.problem.descriptor=#ref pointing to this method is unnecessary #loc
unnecessary.javadoc.link.this.class.problem.descriptor=#ref pointing to containing class is unnecessary #loc
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/BaseInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/BaseInspection.java
index 25ab70cccdc6..0607fd78b62c 100644
--- a/plugins/InspectionGadgets/src/com/siyeh/ig/BaseInspection.java
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/BaseInspection.java
@@ -70,6 +70,7 @@ public abstract class BaseInspection extends BaseJavaLocalInspectionTool {
packageGroupDisplayNameMap.put("internationalization", GroupNames.INTERNATIONALIZATION_GROUP_NAME);
packageGroupDisplayNameMap.put("j2me", GroupNames.J2ME_GROUP_NAME);
packageGroupDisplayNameMap.put("javabeans", GroupNames.JAVABEANS_GROUP_NAME);
+ packageGroupDisplayNameMap.put("javadoc", GroupNames.JAVADOC_GROUP_NAME);
packageGroupDisplayNameMap.put("jdk", GroupNames.JDK_GROUP_NAME);
packageGroupDisplayNameMap.put("jdk15", GroupNames.LANGUAGE_LEVEL_SPECIFIC_GROUP_NAME);
packageGroupDisplayNameMap.put("junit", GroupNames.JUNIT_GROUP_NAME);
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/InspectionGadgetsPlugin.java b/plugins/InspectionGadgets/src/com/siyeh/ig/InspectionGadgetsPlugin.java
index b94bc9ea4fea..74482e3429b8 100644
--- a/plugins/InspectionGadgets/src/com/siyeh/ig/InspectionGadgetsPlugin.java
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/InspectionGadgetsPlugin.java
@@ -1,5 +1,5 @@
/*
-* Copyright 2003-2010 Dave Griffith, Bas Leijdekkers
+* Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,6 +54,8 @@ import com.siyeh.ig.j2me.*;
import com.siyeh.ig.javabeans.ClassWithoutConstructorInspection;
import com.siyeh.ig.javabeans.ClassWithoutNoArgConstructorInspection;
import com.siyeh.ig.javabeans.FieldHasSetterButNoGetterInspection;
+import com.siyeh.ig.javadoc.UnnecessaryInheritDocInspection;
+import com.siyeh.ig.javadoc.UnnecessaryJavaDocLinkInspection;
import com.siyeh.ig.jdk.*;
import com.siyeh.ig.jdk15.*;
import com.siyeh.ig.junit.*;
@@ -292,6 +294,7 @@ public class InspectionGadgetsPlugin implements ApplicationComponent,
registerInternationalInspections();
registerJ2MEInspections();
registerJavaBeansInspections();
+ registerJavadocInspections();
registerJdk5SpecificInspections();
registerJdkInspections();
registerJUnitInspections();
@@ -687,6 +690,11 @@ public class InspectionGadgetsPlugin implements ApplicationComponent,
m_inspectionClasses.add(FieldHasSetterButNoGetterInspection.class);
}
+ public void registerJavadocInspections() {
+ m_inspectionClasses.add(UnnecessaryJavaDocLinkInspection.class);
+ m_inspectionClasses.add(UnnecessaryInheritDocInspection.class);
+ }
+
private void registerCloneInspections() {
m_inspectionClasses.add(CloneCallsConstructorsInspection.class);
m_inspectionClasses.add(CloneCallsSuperCloneInspection.class);
@@ -778,9 +786,7 @@ public class InspectionGadgetsPlugin implements ApplicationComponent,
m_inspectionClasses.add(UnnecessaryFinalOnLocalVariableInspection.class);
m_inspectionClasses.add(UnnecessaryFinalOnParameterInspection.class);
m_inspectionClasses.add(UnnecessaryFullyQualifiedNameInspection.class);
- m_inspectionClasses.add(UnnecessaryInheritDocInspection.class);
m_inspectionClasses.add(UnnecessaryInterfaceModifierInspection.class);
- m_inspectionClasses.add(UnnecessaryJavaDocLinkInspection.class);
m_inspectionClasses.add(UnnecessaryParenthesesInspection.class);
m_inspectionClasses.add(UnnecessarilyQualifiedStaticallyImportedElementInspection.class);
m_inspectionClasses.add(UnnecessaryQualifierForThisInspection.class);
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/style/UnnecessaryInheritDocInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/javadoc/UnnecessaryInheritDocInspection.java
similarity index 93%
rename from plugins/InspectionGadgets/src/com/siyeh/ig/style/UnnecessaryInheritDocInspection.java
rename to plugins/InspectionGadgets/src/com/siyeh/ig/javadoc/UnnecessaryInheritDocInspection.java
index 30bdf7dccc86..faa00b77feb1 100644
--- a/plugins/InspectionGadgets/src/com/siyeh/ig/style/UnnecessaryInheritDocInspection.java
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/javadoc/UnnecessaryInheritDocInspection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009 Bas Leijdekkers
+ * Copyright 2009-2011 Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.siyeh.ig.style;
+package com.siyeh.ig.javadoc;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.project.Project;
@@ -27,11 +27,12 @@ import com.intellij.psi.javadoc.PsiInlineDocTag;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
+import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
-import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.InspectionGadgetsFix;
import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public class UnnecessaryInheritDocInspection extends BaseInspection {
@@ -53,7 +54,7 @@ public class UnnecessaryInheritDocInspection extends BaseInspection {
return new UnnecessaryInheritDocFix();
}
- private class UnnecessaryInheritDocFix extends InspectionGadgetsFix {
+ private static class UnnecessaryInheritDocFix extends InspectionGadgetsFix {
@NotNull
public String getName() {
@@ -87,7 +88,7 @@ public class UnnecessaryInheritDocInspection extends BaseInspection {
if (!(tag instanceof PsiInlineDocTag)) {
return;
}
- final String name = tag.getName();
+ @NonNls final String name = tag.getName();
if (!"inheritDoc".equals(name)) {
return;
}
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/style/UnnecessaryJavaDocLinkInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/javadoc/UnnecessaryJavaDocLinkInspection.java
similarity index 99%
rename from plugins/InspectionGadgets/src/com/siyeh/ig/style/UnnecessaryJavaDocLinkInspection.java
rename to plugins/InspectionGadgets/src/com/siyeh/ig/javadoc/UnnecessaryJavaDocLinkInspection.java
index 818053c4e1d8..085b418cb03a 100644
--- a/plugins/InspectionGadgets/src/com/siyeh/ig/style/UnnecessaryJavaDocLinkInspection.java
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/javadoc/UnnecessaryJavaDocLinkInspection.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.siyeh.ig.style;
+package com.siyeh.ig.javadoc;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/style/SimplifiableAnnotationInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/style/SimplifiableAnnotationInspection.java
index 15726fdebcb6..8f2f87f9b5af 100644
--- a/plugins/InspectionGadgets/src/com/siyeh/ig/style/SimplifiableAnnotationInspection.java
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/style/SimplifiableAnnotationInspection.java
@@ -57,7 +57,6 @@ public class SimplifiableAnnotationInspection extends BaseInspection {
private final String replacement;
public SimplifiableAnnotationFix(String replacement) {
- super();
this.replacement = replacement;
}
@@ -127,19 +126,46 @@ public class SimplifiableAnnotationInspection extends BaseInspection {
} else if (attributes.length == 1) {
final PsiNameValuePair attribute = attributes[0];
@NonNls final String name = attribute.getName();
- if (!"value".equals(name)) {
- return;
- }
final PsiAnnotationMemberValue attributeValue =
attribute.getValue();
if (attributeValue == null) {
return;
}
+ final String attributeValueText;
+ if (!"value".equals(name)) {
+ if (!(attributeValue instanceof PsiArrayInitializerMemberValue)) {
+ return;
+ }
+ final PsiArrayInitializerMemberValue arrayValue =
+ (PsiArrayInitializerMemberValue) attributeValue;
+ final PsiAnnotationMemberValue[] initializers =
+ arrayValue.getInitializers();
+ if (initializers.length != 1) {
+ return;
+ }
+ attributeValueText = initializers[0].getText();
+ } else {
+ attributeValueText = attributeValue.getText();
+ }
final String annotationName = nameReferenceElement.getText();
final String replacementText = '@' + annotationName +
- '(' + attributeValue.getText() + ')';
+ '(' + getAttributeValueText(attributeValue) + ')';
registerError(annotation, replacementText);
}
}
+
+ private static String getAttributeValueText(
+ PsiAnnotationMemberValue value) {
+ if (value instanceof PsiArrayInitializerMemberValue) {
+ final PsiArrayInitializerMemberValue arrayValue =
+ (PsiArrayInitializerMemberValue) value;
+ final PsiAnnotationMemberValue[] initializers =
+ arrayValue.getInitializers();
+ if (initializers.length == 1) {
+ return initializers[0].getText();
+ }
+ }
+ return value.getText();
+ }
}
}
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryInheritDoc.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryInheritDoc.html
index cc7669a7929f..8b3ae0b1bc88 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryInheritDoc.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryInheritDoc.html
@@ -1,8 +1,8 @@
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryJavaDocLink.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryJavaDocLink.html index 212fc750db0b..46666ac8b795 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryJavaDocLink.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryJavaDocLink.html @@ -1,16 +1,16 @@
-This inspection reports any JavaDoc @see, +This inspection reports any Javadoc @see, {@link} and {@linkplain} tags which reference the method owning the comment, the super method of the method owning the comment or the class containing the comment. Such links are unnecessary and can be safely removed using this inspections quickfix. The -quickfix will remove the entire JavaDoc comment if the link is its only content. +quickfix will remove the entire Javadoc comment if the link is its only content.Use the option below to ignore inline links ({@link} and {@linkplain}) to super methods. While a link to all super methods is automatically added by the -JavaDoc tool, an inline link to the super method can occasionally be needed in -the text of the JavaDoc. +Javadoc tool, an inline link to the super method can occasionally be needed in +the text of the Javadoc. Powered by InspectionGadgets \ No newline at end of file diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessaryJavaDocLinkInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/javadoc/UnnecessaryJavaDocLinkInspectionTest.java similarity index 90% rename from plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessaryJavaDocLinkInspectionTest.java rename to plugins/InspectionGadgets/testsrc/com/siyeh/ig/javadoc/UnnecessaryJavaDocLinkInspectionTest.java index 96ff088defbc..ad9e0144ab97 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessaryJavaDocLinkInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/javadoc/UnnecessaryJavaDocLinkInspectionTest.java @@ -1,4 +1,4 @@ -package com.siyeh.ig.style; +package com.siyeh.ig.javadoc; import com.IGInspectionTestCase;