new "Javadoc issues" group name

This commit is contained in:
Bas Leijdekkers
2011-02-09 11:54:33 +01:00
parent dee85fb10c
commit 00dbba3de7
13 changed files with 71 additions and 35 deletions
@@ -1120,7 +1120,7 @@ public class JavaDocLocalInspection extends BaseLocalInspectionTool {
@NotNull
public String getGroupDisplayName() {
return "";
return InspectionsBundle.message("group.names.javadoc.issues");
}
@NotNull
@@ -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
@@ -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");
}
@@ -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
@@ -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 <code>#ref</code> #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 <code>#ref</code> is unnecessary #loc
unnecessary.inherit.doc.display.name=Unnecessary {@inheritDoc} Javadoc Comment
unnecessary.inherit.doc.problem.descriptor=Javadoc comment containing only <code>#ref</code> 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=<code>#ref</code> 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=<code>#ref</code> pointing to super method is unnecessary #loc
unnecessary.javadoc.link.this.method.problem.descriptor=<code>#ref</code> pointing to this method is unnecessary #loc
unnecessary.javadoc.link.this.class.problem.descriptor=<code>#ref</code> pointing to containing class is unnecessary #loc
@@ -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);
@@ -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);
@@ -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;
}
@@ -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;
@@ -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();
}
}
}
@@ -1,8 +1,8 @@
<html>
<body>
This inspection reports any JavaDoc comments which contain only the
This inspection reports any Javadoc comments which contain only the
<b>{@inheritDoc}</b>
tag. Since JavaDoc copies the super class' comment if no comment is present, a
tag. Since Javadoc copies the super class' comment if no comment is present, a
comment containing only an <b>{@inheritDoc}</b>
adds nothing.
<p>
@@ -1,16 +1,16 @@
<html>
<body>
This inspection reports any JavaDoc <b>@see</b>,
This inspection reports any Javadoc <b>@see</b>,
<b>{@link}</b> and <b>{@linkplain}</b>
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.
<p>
Use the option below to ignore inline links (<b>{@link}</b> and <b>{@linkplain}</b>)
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.
<small>Powered by InspectionGadgets</small>
</body>
</html>
@@ -1,4 +1,4 @@
package com.siyeh.ig.style;
package com.siyeh.ig.javadoc;
import com.IGInspectionTestCase;