Repository: checkstyle/checkstyle

Problem statement:
JavadocType ignores param tags in InnerClass
Inner classes are not checked with JavadocType check for missing or extra `@param` tags

The following code is Ok, but `@param` tags are wrong set in the javadoc

``` java
    /**
     * Example inner class.
     * @param <A> documented parameter
     * @param <C> extra parameter
     */

    public static class InnerClass<A,B>
    {
    }
```



Hints:

Patch:
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java
@@ -24,9 +24,9 @@
 import com.puppycrawl.tools.checkstyle.api.FileContents;
 import com.puppycrawl.tools.checkstyle.api.JavadocTagInfo;
 import com.puppycrawl.tools.checkstyle.api.Scope;
-import com.puppycrawl.tools.checkstyle.ScopeUtils;
 import com.puppycrawl.tools.checkstyle.api.TextBlock;
 import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import com.puppycrawl.tools.checkstyle.ScopeUtils;
 import com.puppycrawl.tools.checkstyle.Utils;
 import com.puppycrawl.tools.checkstyle.checks.CheckUtils;
 import java.util.List;
@@ -37,6 +37,9 @@
 /**
  * Checks the Javadoc of a type.
  *
+ * <p>Does not perform checks for author and version tags for inner classes, as
+ * they should be redundant because of outer class.
+ *
  * @author Oliver Burn
  * @author Michael Tamm
  */
@@ -184,13 +187,15 @@ public void visitToken(DetailAST ast) {
             if (cmt == null) {
                 log(lineNo, JAVADOC_MISSING);
             }
-            else if (ScopeUtils.isOuterMostType(ast)) {
-                // don't check author/version for inner classes
+            else {
                 final List<JavadocTag> tags = getJavadocTags(cmt);
-                checkTag(lineNo, tags, JavadocTagInfo.AUTHOR.getName(),
-                         authorFormatPattern, authorFormat);
-                checkTag(lineNo, tags, JavadocTagInfo.VERSION.getName(),
-                         versionFormatPattern, versionFormat);
+                if (ScopeUtils.isOuterMostType(ast)) {
+                    // don't check author/version for inner classes
+                    checkTag(lineNo, tags, JavadocTagInfo.AUTHOR.getName(),
+                            authorFormatPattern, authorFormat);
+                    checkTag(lineNo, tags, JavadocTagInfo.VERSION.getName(),
+                            versionFormatPattern, versionFormat);
+                }
 
                 final List<String> typeParamNames =
                     CheckUtils.getTypeParameterNames(ast);


Test patch:
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java
@@ -319,6 +319,8 @@ public void testTypeParameters() throws Exception {
         final String[] expected = {
             "7:4: " + getCheckMessage(UNUSED_TAG, "@param", "<D123>"),
             "11: " + getCheckMessage(MISSING_TAG, "@param <C456>"),
+            "44:8: " + getCheckMessage(UNUSED_TAG, "@param", "<C>"),
+            "47: " + getCheckMessage(MISSING_TAG, "@param <B>"),
         };
         verify(checkConfig, getPath("InputTypeParamsTags.java"), expected);
     }
@@ -330,6 +332,7 @@ public void testAllowMissingTypeParameters() throws Exception {
         checkConfig.addAttribute("allowMissingParamTags", "true");
         final String[] expected = {
             "7:4: " + getCheckMessage(UNUSED_TAG, "@param", "<D123>"),
+            "44:8: " + getCheckMessage(UNUSED_TAG, "@param", "<C>"),
         };
         verify(checkConfig, getPath("InputTypeParamsTags.java"), expected);
     }
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/InputTypeParamsTags.java b/src/test/resources/com/puppycrawl/tools/checkstyle/InputTypeParamsTags.java
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/InputTypeParamsTags.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/InputTypeParamsTags.java
@@ -37,4 +37,14 @@ public <Z> void doSomethingElse()
     public <L> void doSomethingElse2(L aAnEl)
     {
     }
+
+    /**
+     * Example inner class.
+     * @param <A> documented parameter
+     * @param <C> extra parameter
+     */
+
+    public static class InnerClass<A,B>
+    {
+    }
 }