Clover Coverage Report - Checkstyle
Coverage timestamp: Fri May 9 2008 10:48:13 EST
../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
54   264   35   3.18
4   142   0.65   2.43
17     2.06  
7    
 
  DeclarationCollector       Line # 35 95.1% 0.9512195
21.05 36 21 21 0.58
  LexicalFrame       Line # 123 100% 1.0
3 3 3 3 1
  GlobalFrame       Line # 156 100% 1.0
1 1 1 1 1
  MethodFrame       Line # 169 100% 1.0
1 1 1 1 1
  ClassFrame       Line # 184 100% 1.0
1 1 1 1 1
  BlockFrame       Line # 199 100% 1.0
1 1 1 1 1
  FrameStack       Line # 212 100% 1.0
7 11 7 7 0.64
 
  (6)
 
1    ////////////////////////////////////////////////////////////////////////////////
2    // checkstyle: Checks Java source code for adherence to a set of rules.
3    // Copyright (C) 2001-2005 Oliver Burn
4    //
5    // This library is free software; you can redistribute it and/or
6    // modify it under the terms of the GNU Lesser General Public
7    // License as published by the Free Software Foundation; either
8    // version 2.1 of the License, or (at your option) any later version.
9    //
10    // This library is distributed in the hope that it will be useful,
11    // but WITHOUT ANY WARRANTY; without even the implied warranty of
12    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    // Lesser General Public License for more details.
14    //
15    // You should have received a copy of the GNU Lesser General Public
16    // License along with this library; if not, write to the Free Software
17    // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18    ////////////////////////////////////////////////////////////////////////////////
19    package com.puppycrawl.tools.checkstyle.checks;
20   
21    import com.puppycrawl.tools.checkstyle.api.Check;
22    import com.puppycrawl.tools.checkstyle.api.DetailAST;
23    import com.puppycrawl.tools.checkstyle.api.TokenTypes;
24   
25    import java.util.HashSet;
26    import java.util.Iterator;
27    import java.util.LinkedList;
28   
29    /**
30    * Abstract class for chekcs which need to collect information about
31    * declared members/parameters/variables.
32    *
33    * @author o_sukhodolsky
34    */
 
35    public abstract class DeclarationCollector extends Check
36    {
37    /** Stack of variable declaration frames. */
38    private FrameStack mFrames;
39   
40    /** {@inheritDoc} */
 
41  6 toggle public void beginTree(DetailAST aRootAST)
42    {
43  6 mFrames = new FrameStack();
44    }
45   
46    /** {@inheritDoc} */
 
47  392 toggle public void visitToken(DetailAST aAST)
48    {
49  392 switch (aAST.getType()) {
50  6 case TokenTypes.PARAMETER_DEF :
51  21 case TokenTypes.VARIABLE_DEF : {
52  27 final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT);
53  27 this.mFrames.current().addName(nameAST.getText());
54  27 break;
55    }
56  8 case TokenTypes.CLASS_DEF :
57  1 case TokenTypes.INTERFACE_DEF :
58  5 case TokenTypes.ENUM_DEF :
59  0 case TokenTypes.ANNOTATION_DEF : {
60  14 final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT);
61  14 this.mFrames.current().addName(nameAST.getText());
62  14 this.mFrames.enter(new ClassFrame());
63  14 break;
64    }
65  28 case TokenTypes.SLIST :
66  28 this.mFrames.enter(new BlockFrame());
67  28 break;
68  17 case TokenTypes.METHOD_DEF :
69  4 case TokenTypes.CTOR_DEF :
70  21 this.mFrames.enter(new MethodFrame());
71  21 break;
72  302 default:
73    // do nothing
74    }
75    }
76   
77   
78    /** {@inheritDoc} */
 
79  392 toggle public void leaveToken(DetailAST aAST)
80    {
81  392 switch (aAST.getType()) {
82  8 case TokenTypes.CLASS_DEF :
83  1 case TokenTypes.INTERFACE_DEF :
84  5 case TokenTypes.ENUM_DEF :
85  0