Java Code Examples for com.puppycrawl.tools.checkstyle.api.TokenTypes#LITERAL_CATCH
The following examples show how to use
com.puppycrawl.tools.checkstyle.api.TokenTypes#LITERAL_CATCH .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnusedParameterCheck.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
/** @see com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck */ public boolean mustCheckReferenceCount(DetailAST aAST) { boolean result = false; final DetailAST parent = aAST.getParent(); if (parent != null) { if (parent.getType() == TokenTypes.PARAMETERS) { final DetailAST grandparent = parent.getParent(); if (grandparent != null) { result = hasBody(grandparent) && (!mIgnoreNonLocal || isLocal(grandparent)); } } else if (parent.getType() == TokenTypes.LITERAL_CATCH) { result = !mIgnoreCatch; } } return result; }
Example 2
Source File: UnusedParameterCheck.java From contribution with GNU Lesser General Public License v2.1 | 6 votes |
/** @see com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck */ public boolean mustCheckReferenceCount(DetailAST aAST) { boolean result = false; final DetailAST parent = aAST.getParent(); if (parent != null) { if (parent.getType() == TokenTypes.PARAMETERS) { final DetailAST grandparent = parent.getParent(); if (grandparent != null) { result = hasBody(grandparent) && (!mIgnoreNonLocal || isLocal(grandparent)); } } else if (parent.getType() == TokenTypes.LITERAL_CATCH) { result = !mIgnoreCatch; } } return result; }
Example 3
Source File: SpringCatchCheck.java From spring-javaformat with Apache License 2.0 | 4 votes |
@Override public int[] getAcceptableTokens() { return new int[] { TokenTypes.LITERAL_CATCH }; }
Example 4
Source File: SpringCatchCheck.java From spring-javaformat with Apache License 2.0 | 4 votes |
@Override public void visitToken(DetailAST ast) { if (ast.getType() == TokenTypes.LITERAL_CATCH) { visitCatch(ast); } }
Example 5
Source File: Resolver.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
/** * processes a <code>BlockDef</code> and resolves references in it * * @param block the <code>BlockDef</code> to process */ protected void handleBlock(BlockDef block) { SymTabAST node = block.getTreeNode(); switch (node.getType()) { case TokenTypes.LITERAL_FOR : handleFor(block); break; case TokenTypes.LITERAL_IF : handleIf(block); break; case TokenTypes.LITERAL_WHILE : handleWhileAndSynchronized(block); break; case TokenTypes.LITERAL_DO : handleDoWhile(block); break; case TokenTypes.LITERAL_TRY : case TokenTypes.LITERAL_FINALLY : SymTabAST slist = node.findFirstToken(TokenTypes.SLIST); handleSList(slist, block); break; case TokenTypes.LITERAL_CATCH : handleCatch(block); break; case TokenTypes.LITERAL_SWITCH : handleSwitch(block); break; case TokenTypes.SLIST : handleSList(node, block); break; case TokenTypes.EXPR : resolveExpression(node, block, null, true); break; case TokenTypes.INSTANCE_INIT : case TokenTypes.STATIC_INIT : handleSList((SymTabAST) node.getFirstChild(), block); break; case TokenTypes.LITERAL_SYNCHRONIZED : handleWhileAndSynchronized(block); break; case TokenTypes.LITERAL_ASSERT : handleAssert(block); break; default : if (mInitialized) { final Log log = mLogFactory.getInstance(this.getClass()); log.error( "Unhandled block " + block + " of type " + node.getType()); } } }
Example 6
Source File: Resolver.java From contribution with GNU Lesser General Public License v2.1 | 4 votes |
/** * processes a <code>BlockDef</code> and resolves references in it * * @param block the <code>BlockDef</code> to process */ protected void handleBlock(BlockDef block) { SymTabAST node = block.getTreeNode(); switch (node.getType()) { case TokenTypes.LITERAL_FOR : handleFor(block); break; case TokenTypes.LITERAL_IF : handleIf(block); break; case TokenTypes.LITERAL_WHILE : handleWhileAndSynchronized(block); break; case TokenTypes.LITERAL_DO : handleDoWhile(block); break; case TokenTypes.LITERAL_TRY : case TokenTypes.LITERAL_FINALLY : SymTabAST slist = node.findFirstToken(TokenTypes.SLIST); handleSList(slist, block); break; case TokenTypes.LITERAL_CATCH : handleCatch(block); break; case TokenTypes.LITERAL_SWITCH : handleSwitch(block); break; case TokenTypes.SLIST : handleSList(node, block); break; case TokenTypes.EXPR : resolveExpression(node, block, null, true); break; case TokenTypes.INSTANCE_INIT : case TokenTypes.STATIC_INIT : handleSList((SymTabAST) node.getFirstChild(), block); break; case TokenTypes.LITERAL_SYNCHRONIZED : handleWhileAndSynchronized(block); break; case TokenTypes.LITERAL_ASSERT : handleAssert(block); break; default : if (mInitialized) { final Log log = mLogFactory.getInstance(this.getClass()); log.error( "Unhandled block " + block + " of type " + node.getType()); } } }