1 package com.puppycrawl.tools.checkstyle.checks.coding; 20 21 import com.puppycrawl.tools.checkstyle.api.TokenTypes; 22 import com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheck; 23 24 45 public class MissingSwitchDefaultCheck extends DescendantTokenCheck 46 { 47 48 public MissingSwitchDefaultCheck() 49 { 50 setLimitedTokens(new String [] { 51 TokenTypes.getTokenName(TokenTypes.LITERAL_DEFAULT), 52 }); 53 setMinimumNumber(1); 54 setMaximumDepth(2); 55 setMinimumMessage("missing.switch.default"); 56 } 57 58 59 public int[] getDefaultTokens() 60 { 61 return new int[]{TokenTypes.LITERAL_SWITCH}; 62 } 63 64 65 public int[] getAcceptableTokens() 66 { 67 return getDefaultTokens(); 68 } 69 } 70 | Popular Tags |