/** * Register a check for a specified token name. * @param token the name of the token * @param check the check to register * @throws CheckstyleException if Check is misconfigured */ private void registerCheck(String token, AbstractCheck check) throws CheckstyleException { if (check.isCommentNodesRequired()) { tokenToCommentChecks.computeIfAbsent(token, empty -> new HashSet<>()).add(check); } else if (TokenUtil.isCommentType(token)) { final String message = String.format(Locale.ROOT, "Check '%s' waits for comment type " + "token ('%s') and should override 'isCommentNodesRequired()' " + "method to return 'true'", check.getClass().getName(), token); throw new CheckstyleException(message); } else { tokenToOrdinaryChecks.computeIfAbsent(token, empty -> new HashSet<>()).add(check); } }
registerCheck(element, check); if (check.isCommentNodesRequired()) { commentChecks.add(check);
@Override public boolean isCommentNodesRequired() { return this.check.isCommentNodesRequired(); }
/** * Register a check for a specified token name. * @param token the name of the token * @param check the check to register * @throws CheckstyleException if Check is misconfigured */ private void registerCheck(String token, AbstractCheck check) throws CheckstyleException { if (check.isCommentNodesRequired()) { tokenToCommentChecks.computeIfAbsent(token, empty -> new HashSet<>()).add(check); } else if (TokenUtil.isCommentType(token)) { final String message = String.format(Locale.ROOT, "Check '%s' waits for comment type " + "token ('%s') and should override 'isCommentNodesRequired()' " + "method to return 'true'", check.getClass().getName(), token); throw new CheckstyleException(message); } else { tokenToOrdinaryChecks.computeIfAbsent(token, empty -> new HashSet<>()).add(check); } }
registerCheck(element, check); if (check.isCommentNodesRequired()) { commentChecks.add(check);