From cc50f3ba0a3f2adf4fce291372b20263f5f30f16 Mon Sep 17 00:00:00 2001 From: Oliver Burn Date: Sun, 20 Mar 2005 10:36:35 +0000 Subject: [PATCH] Tidy up implementation loose ends. --- .../checks/javadoc/JavadocMethodCheck.java | 41 +------ src/xdocs/config_javadoc.xml | 101 ++++++++++++------ src/xdocs/releasenotes.xml | 5 + 3 files changed, 73 insertions(+), 74 deletions(-) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java index 60c7ca13b..1fe4e9f9b 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java @@ -40,46 +40,7 @@ import com.puppycrawl.tools.checkstyle.api.Utils; import com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck; /** - *

- * Checks the Javadoc of a method or constructor. By default, does not check for - * unused throws. To allow documented java.lang.RuntimeException - * s that are not declared, set property allowUndeclaredRTE to true. The scope - * to verify is specified using the {@link Scope}class and defaults to - * {@link Scope#PRIVATE}. To verify another scope, set property scope to one of - * the {@link Scope}constants. - *

- *

- * Error messages about parameters for which no param tags are present can be - * suppressed by defining property allowMissingParamTags. Error - * messages about exceptions which are declared to be thrown, but for which no - * throws tag is present can be suppressed by defining property - * allowMissingThrowsTags. Error messages about methods which - * return non-void but for which no return tag is present can be suppressed by - * defining property allowMissingReturnTag. - *

- *

- * An example of how to configure the check is: - *

- * - *
- *   <module name="JavadocMethod"/>
- * 
- * - *

- * An example of how to configure the check to check to allow documentation of - * undeclared RuntimeExceptions and for the {@link Scope#PUBLIC}scope, while - * ignoring any missing param tags is: - *

- * - *
- * <module name="JavadocMethod">
- *   <property name="scope" value="public"/>
- *   <property name="allowUndeclaredRTE"
- value="true"/>
- *   <property name="allowMissingParamTags"
- value="true"/>
- * </module>
- * 
+ * Checks the Javadoc of a method or constructor. * * @author Oliver Burn * @author Rick Giles diff --git a/src/xdocs/config_javadoc.xml b/src/xdocs/config_javadoc.xml index 55e35df28..57071e03d 100755 --- a/src/xdocs/config_javadoc.xml +++ b/src/xdocs/config_javadoc.xml @@ -182,47 +182,50 @@

- Checks to ensure that the following tags exist (if required): + Checks the Javadoc of a method or constructor. By default, + does not check for unused throws. To allow documented + java.lang.RuntimeExceptions that are not + declared, set property allowUndeclaredRTE to true. The scope + to verify is specified using the Scope class and + defaults to Scope.PRIVATE. To verify another + scope, set property scope to one of the Scope + constants.

-
    -
  • - @return -
  • -
  • - @param -
  • -
  • - @throws or @exception -
  • -
  • - @see or {@inheritDoc} -
  • -
-

- For example, the following is valid: + Error messages about parameters for which no param tags are + present can be suppressed by defining property + allowMissingParamTags. Error messages about + exceptions which are declared to be thrown, but for which no + throws tag is present can be suppressed by defining property + allowMissingThrowsTags. Error messages about + methods which return non-void but for which no return tag is + present can be suppressed by defining property + allowMissingReturnTag.

- -/** - * Checks for a return tag. - * @return the index of the next unchecked tag - * @param aTagIndex the index to start in the tags - * @param aTags the tags to check - * @param aLineNo the line number of the expected tag - **/ -public int checkReturnTag(final int aTagIndex, - JavadocTag[] aTags, - int aLineNo) -

- This supports the convention in the Sun - Javadoc Guidelines and the "Effective Java" book. + An example of how to configure the check is:

+ +
+<module name="JavadocMethod"/>
+        
+ +

+ An example of how to configure the check to check to allow + documentation of undeclared RuntimeExceptions and for the + Scope.PUBLIC scope, while ignoring any missing + param tags is: +

+ +
+<module name="JavadocMethod">
+  <property name="scope" value="public"/>
+  <property name="allowUndeclaredRTE" value="true"/>
+   <property name="allowMissingParamTags" value="true"/>
+</module>
+        
@@ -282,12 +285,42 @@ public int checkReturnTag(final int aTagIndex, boolean false + allowMissingJavadoc whether to ignore errors when a method javadoc is missed. boolean false + + + allowMissingPropertyJavadoc + + Whether to allow missing Javadoc on accessor methods for + properties (setters and getters). The setter and getter + methods must match exactly the structures below. + +
+public void setNumber(final int number)
+{
+    mNumber = number;
+}
+
+public int getNumber()
+{
+    return mNumber;
+}
+
+public boolean isSomething()
+{
+    return false;
+}
+              
+ + boolean + false + + tokens definitions to check diff --git a/src/xdocs/releasenotes.xml b/src/xdocs/releasenotes.xml index 44c6d6bbc..6af9045dd 100755 --- a/src/xdocs/releasenotes.xml +++ b/src/xdocs/releasenotes.xml @@ -31,6 +31,11 @@ serializaition-related methods (readObject(), writeObject(), readResolve() and writeReplace()) (rfe 1036387) +
  • Added support for the property + allowMissingPropertyJavadoc on the JavadocMethod + check.
  • +