1 package com.puppycrawl.tools.checkstyle.checks.j2ee; 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 33 public class ThisParameterCheck 34 extends Check 35 { 36 39 public int[] getDefaultTokens() 40 { 41 return new int[] {TokenTypes.LITERAL_THIS}; 42 } 43 44 47 public int[] getRequiredTokens() 48 { 49 return getDefaultTokens(); 50 } 51 52 55 public void visitToken(DetailAST aAST) 56 { 57 if (Utils.isInEJB(aAST)) { 58 DetailAST parent = aAST.getParent(); 59 60 while ((parent != null) 62 && (parent.getType() == TokenTypes.LPAREN)) 63 { 64 parent = parent.getParent(); 65 } 66 67 if ((parent != null) 68 && (parent.getType() == TokenTypes.EXPR)) 69 { 70 parent = parent.getParent(); 71 if ((parent != null) 72 && (parent.getType() == TokenTypes.ELIST)) 73 { 74 log( 75 aAST.getLineNo(), 76 aAST.getColumnNo(), 77 "thisparameter.bean"); 78 } 79 } 80 } 81 } 82 } 83 | Popular Tags |