1 package com.puppycrawl.tools.checkstyle.checks.indentation; 20 21 import com.puppycrawl.tools.checkstyle.api.DetailAST; 22 import com.puppycrawl.tools.checkstyle.api.TokenTypes; 23 24 29 public class MemberDefHandler extends ExpressionHandler 30 { 31 39 public MemberDefHandler(IndentationCheck aIndentCheck, 40 DetailAST aAST, ExpressionHandler aParent) 41 { 42 super(aIndentCheck, "member def", aAST, aParent); 43 } 44 45 48 private void checkIdent() 49 { 50 final DetailAST ident = getMainAst().findFirstToken(TokenTypes.IDENT); 51 final int columnNo = expandedTabsColumnNo(ident); 52 if (startsLine(ident) && !getLevel().accept(columnNo)) { 53 logError(ident, "", columnNo); 54 } 55 } 56 57 60 private void checkType() 61 { 62 final DetailAST type = getMainAst().findFirstToken(TokenTypes.TYPE); 63 final DetailAST ident = ExpressionHandler.getFirstToken(type); 64 final int columnNo = expandedTabsColumnNo(ident); 65 if (startsLine(ident) && !getLevel().accept(columnNo)) { 66 logError(ident, "type", columnNo); 67 } 68 } 69 70 73 public void checkIndentation() 74 { 75 checkModifiers(); 76 checkType(); 77 checkIdent(); 78 } 79 80 81 public IndentLevel suggestedChildLevel(ExpressionHandler aChild) 82 { 83 return getLevel(); 84 } 85 } 86 | Popular Tags |