View Javadoc
1   /*
2   JavadocVariable
3   accessModifiers = (default)public,protected,package,private
4   ignoreNamePattern = (default)null
5   tokens = (default)ENUM_CONSTANT_DEF
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.javadoc.javadocvariable;
10  
11  public class InputJavadocVariablePublicOnly // ignore - need javadoc
12  {
13      private interface InnerInterface // ignore - when not relaxed about Javadoc
14      {
15          String CONST = "InnerInterface"; // violation, 'Missing a Javadoc comment'
16          void method(); // ignore - when not relaxed about Javadoc
17  
18          class InnerInnerClass // ignore - when not relaxed about Javadoc
19          {
20              private int mData; // violation, 'Missing a Javadoc comment'
21  
22              private InnerInnerClass()
23              {
24                  final Runnable r = new Runnable() {
25                          public void run() {};
26                      };
27              }
28  
29              void method2() // ignore - when not relaxed about Javadoc
30              {
31                  final Runnable r = new Runnable() {
32                          public void run() {};
33                      };
34              }
35          }
36      }
37  
38      private class InnerClass // ignore
39      {
40          private int mDiff; // violation, 'Missing a Javadoc comment'
41  
42          void method() // ignore - when not relaxed about Javadoc
43          {
44          }
45      }
46  
47      private int mSize; // violation, 'Missing a Javadoc comment'
48      int mLen; // violation, 'Missing a Javadoc comment'
49      protected int mDeer; // violation, 'Missing a Javadoc comment'
50      public int aFreddo; // violation, 'Missing a Javadoc comment'
51  
52      // ignore - need Javadoc
53      private InputJavadocVariablePublicOnly(int aA)
54      {
55      }
56  
57      // ignore - need Javadoc when not relaxed
58      InputJavadocVariablePublicOnly(String aA)
59      {
60      }
61  
62      // ignore - always need javadoc
63      protected InputJavadocVariablePublicOnly(Object aA)
64      {
65      }
66  
67      // ignore - always need javadoc
68      public InputJavadocVariablePublicOnly(Class<Object> aA)
69      {
70      }
71  
72      // ignore - when not relaxed about Javadoc
73      private void method(int aA)
74      {
75      }
76  
77      // ignore - when not relaxed about Javadoc
78      void method(Long aA)
79      {
80      }
81  
82      // ignore - need javadoc
83      protected void method(Class<Object> aA)
84      {
85      }
86  
87      // ignore - need javadoc
88      public void method(StringBuffer aA)
89      {
90      }
91  
92  
93      /**
94         A param tag should not be required here when relaxed about Javadoc.
95         Writing a little documentation should not be worse than not
96         writing any documentation at all.
97       */
98      private void method(String aA)
99      {
100     }
101 
102     /**
103        This inner class has no author tag, which is OK.
104      */
105     public class InnerWithoutAuthor
106     {
107 
108     }
109 
110     /** {@inheritDoc} */
111     public String toString()
112     {
113         return super.toString();
114     }
115 
116     @Deprecated @Override
117     public int hashCode()
118     {
119         return super.hashCode();
120     }
121 }