本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.LITERAL_SYNCHRONIZED属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.LITERAL_SYNCHRONIZED属性的具体用法?Java TokenTypes.LITERAL_SYNCHRONIZED怎么用?Java TokenTypes.LITERAL_SYNCHRONIZED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.LITERAL_SYNCHRONIZED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultTokens
@Override
public int[] getDefaultTokens() {
return new int[] {
TokenTypes.LITERAL_WHILE,
TokenTypes.LITERAL_TRY,
TokenTypes.LITERAL_FINALLY,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_ELSE,
TokenTypes.LITERAL_FOR,
TokenTypes.INSTANCE_INIT,
TokenTypes.STATIC_INIT,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_SYNCHRONIZED,
};
}
示例2: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.LITERAL_WHILE,
TokenTypes.LITERAL_TRY,
TokenTypes.LITERAL_CATCH,
TokenTypes.LITERAL_FINALLY,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_ELSE,
TokenTypes.LITERAL_FOR,
TokenTypes.INSTANCE_INIT,
TokenTypes.STATIC_INIT,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.LITERAL_CASE,
TokenTypes.LITERAL_DEFAULT,
TokenTypes.ARRAY_INIT,
};
}
示例3: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.INTERFACE_DEF,
TokenTypes.CLASS_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.ENUM_CONSTANT_DEF,
TokenTypes.LITERAL_WHILE,
TokenTypes.LITERAL_TRY,
TokenTypes.LITERAL_CATCH,
TokenTypes.LITERAL_FINALLY,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_ELSE,
TokenTypes.LITERAL_FOR,
TokenTypes.STATIC_INIT,
TokenTypes.OBJBLOCK,
TokenTypes.LAMBDA,
};
}
示例4: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.ARRAY_INIT,
TokenTypes.AT,
TokenTypes.INC,
TokenTypes.DEC,
TokenTypes.UNARY_MINUS,
TokenTypes.UNARY_PLUS,
TokenTypes.BNOT,
TokenTypes.LNOT,
TokenTypes.DOT,
TokenTypes.TYPECAST,
TokenTypes.ARRAY_DECLARATOR,
TokenTypes.INDEX_OP,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.METHOD_REF,
};
}
示例5: makeAcceptableTokens
/**
* Returns array of acceptable tokens.
* @return acceptableTokens.
*/
private static int[] makeAcceptableTokens() {
return new int[] {TokenTypes.ANNOTATION,
TokenTypes.ANNOTATION_FIELD_DEF,
TokenTypes.CTOR_CALL,
TokenTypes.CTOR_DEF,
TokenTypes.DOT,
TokenTypes.ENUM_CONSTANT_DEF,
TokenTypes.EXPR,
TokenTypes.LITERAL_CATCH,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_FOR,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_NEW,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.LITERAL_WHILE,
TokenTypes.METHOD_CALL,
TokenTypes.METHOD_DEF,
TokenTypes.QUESTION,
TokenTypes.RESOURCE_SPECIFICATION,
TokenTypes.SUPER_CTOR_CALL,
TokenTypes.LAMBDA,
};
}
示例6: getRequiredTokens
@Override
public int[] getRequiredTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.INSTANCE_INIT,
TokenTypes.STATIC_INIT,
TokenTypes.PACKAGE_DEF,
TokenTypes.IMPORT,
TokenTypes.VARIABLE_DEF,
TokenTypes.CTOR_CALL,
TokenTypes.SUPER_CTOR_CALL,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_ELSE,
TokenTypes.LITERAL_WHILE,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_FOR,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_BREAK,
TokenTypes.LITERAL_CONTINUE,
TokenTypes.LITERAL_RETURN,
TokenTypes.LITERAL_THROW,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.LITERAL_CATCH,
TokenTypes.LITERAL_FINALLY,
TokenTypes.EXPR,
TokenTypes.LABELED_STAT,
TokenTypes.LITERAL_CASE,
TokenTypes.LITERAL_DEFAULT,
};
}
示例7: visitToken
@Override
public void visitToken(DetailAST ast) {
switch (ast.getType()) {
case TokenTypes.METHOD_CALL:
processLeft(ast);
processRight(ast.findFirstToken(TokenTypes.RPAREN));
break;
case TokenTypes.DOT:
case TokenTypes.EXPR:
case TokenTypes.QUESTION:
processExpression(ast);
break;
case TokenTypes.LITERAL_FOR:
visitLiteralFor(ast);
break;
case TokenTypes.ANNOTATION:
case TokenTypes.ENUM_CONSTANT_DEF:
case TokenTypes.LITERAL_NEW:
case TokenTypes.LITERAL_SYNCHRONIZED:
case TokenTypes.LAMBDA:
visitTokenWithOptionalParentheses(ast);
break;
case TokenTypes.RESOURCE_SPECIFICATION:
visitResourceSpecification(ast);
break;
default:
processLeft(ast.findFirstToken(TokenTypes.LPAREN));
processRight(ast.findFirstToken(TokenTypes.RPAREN));
}
}
示例8: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final JavaNCSSCheck javaNcssCheckObj = new JavaNCSSCheck();
final int[] actual = javaNcssCheckObj.getAcceptableTokens();
final int[] expected = {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.INSTANCE_INIT,
TokenTypes.STATIC_INIT,
TokenTypes.PACKAGE_DEF,
TokenTypes.IMPORT,
TokenTypes.VARIABLE_DEF,
TokenTypes.CTOR_CALL,
TokenTypes.SUPER_CTOR_CALL,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_ELSE,
TokenTypes.LITERAL_WHILE,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_FOR,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_BREAK,
TokenTypes.LITERAL_CONTINUE,
TokenTypes.LITERAL_RETURN,
TokenTypes.LITERAL_THROW,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.LITERAL_CATCH,
TokenTypes.LITERAL_FINALLY,
TokenTypes.EXPR,
TokenTypes.LABELED_STAT,
TokenTypes.LITERAL_CASE,
TokenTypes.LITERAL_DEFAULT,
};
Assert.assertNotNull("Acceptable tokens should not be null", actual);
Assert.assertArrayEquals("Invalid acceptable tokens", expected, actual);
}
示例9: testGetRequiredTokens
@Test
public void testGetRequiredTokens() {
final JavaNCSSCheck javaNcssCheckObj = new JavaNCSSCheck();
final int[] actual = javaNcssCheckObj.getRequiredTokens();
final int[] expected = {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.INSTANCE_INIT,
TokenTypes.STATIC_INIT,
TokenTypes.PACKAGE_DEF,
TokenTypes.IMPORT,
TokenTypes.VARIABLE_DEF,
TokenTypes.CTOR_CALL,
TokenTypes.SUPER_CTOR_CALL,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_ELSE,
TokenTypes.LITERAL_WHILE,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_FOR,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_BREAK,
TokenTypes.LITERAL_CONTINUE,
TokenTypes.LITERAL_RETURN,
TokenTypes.LITERAL_THROW,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.LITERAL_CATCH,
TokenTypes.LITERAL_FINALLY,
TokenTypes.EXPR,
TokenTypes.LABELED_STAT,
TokenTypes.LITERAL_CASE,
TokenTypes.LITERAL_DEFAULT,
};
Assert.assertNotNull("Required tokens should not be null", actual);
Assert.assertArrayEquals("Invalid required tokens", expected, actual);
}
示例10: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final LeftCurlyCheck check = new LeftCurlyCheck();
final int[] actual = check.getAcceptableTokens();
final int[] expected = {
TokenTypes.INTERFACE_DEF,
TokenTypes.CLASS_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.ENUM_CONSTANT_DEF,
TokenTypes.LITERAL_WHILE,
TokenTypes.LITERAL_TRY,
TokenTypes.LITERAL_CATCH,
TokenTypes.LITERAL_FINALLY,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_ELSE,
TokenTypes.LITERAL_FOR,
TokenTypes.STATIC_INIT,
TokenTypes.OBJBLOCK,
TokenTypes.LAMBDA, };
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例11: handleBlock
/**
* 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());
}
}
}
示例12: isTerminated
/**
* Checks if a given subtree terminated by return, throw or,
* if allowed break, continue.
* @param ast root of given subtree
* @param useBreak should we consider break as terminator.
* @param useContinue should we consider continue as terminator.
* @return true if the subtree is terminated.
*/
private boolean isTerminated(final DetailAST ast, boolean useBreak,
boolean useContinue) {
final boolean terminated;
switch (ast.getType()) {
case TokenTypes.LITERAL_RETURN:
case TokenTypes.LITERAL_THROW:
terminated = true;
break;
case TokenTypes.LITERAL_BREAK:
terminated = useBreak;
break;
case TokenTypes.LITERAL_CONTINUE:
terminated = useContinue;
break;
case TokenTypes.SLIST:
terminated = checkSlist(ast, useBreak, useContinue);
break;
case TokenTypes.LITERAL_IF:
terminated = checkIf(ast, useBreak, useContinue);
break;
case TokenTypes.LITERAL_FOR:
case TokenTypes.LITERAL_WHILE:
case TokenTypes.LITERAL_DO:
terminated = checkLoop(ast);
break;
case TokenTypes.LITERAL_TRY:
terminated = checkTry(ast, useBreak, useContinue);
break;
case TokenTypes.LITERAL_SWITCH:
terminated = checkSwitch(ast, useContinue);
break;
case TokenTypes.LITERAL_SYNCHRONIZED:
terminated = checkSynchronized(ast, useBreak, useContinue);
break;
default:
terminated = false;
}
return terminated;
}
示例13: visitToken
@Override
public void visitToken(DetailAST ast) {
final DetailAST startToken;
DetailAST brace;
switch (ast.getType()) {
case TokenTypes.CTOR_DEF:
case TokenTypes.METHOD_DEF:
startToken = skipAnnotationOnlyLines(ast);
brace = ast.findFirstToken(TokenTypes.SLIST);
break;
case TokenTypes.INTERFACE_DEF:
case TokenTypes.CLASS_DEF:
case TokenTypes.ANNOTATION_DEF:
case TokenTypes.ENUM_DEF:
case TokenTypes.ENUM_CONSTANT_DEF:
startToken = skipAnnotationOnlyLines(ast);
final DetailAST objBlock = ast.findFirstToken(TokenTypes.OBJBLOCK);
brace = objBlock;
if (objBlock != null) {
brace = objBlock.getFirstChild();
}
break;
case TokenTypes.LITERAL_WHILE:
case TokenTypes.LITERAL_CATCH:
case TokenTypes.LITERAL_SYNCHRONIZED:
case TokenTypes.LITERAL_FOR:
case TokenTypes.LITERAL_TRY:
case TokenTypes.LITERAL_FINALLY:
case TokenTypes.LITERAL_DO:
case TokenTypes.LITERAL_IF:
case TokenTypes.STATIC_INIT:
case TokenTypes.LAMBDA:
startToken = ast;
brace = ast.findFirstToken(TokenTypes.SLIST);
break;
case TokenTypes.LITERAL_ELSE:
startToken = ast;
final DetailAST candidate = ast.getFirstChild();
brace = null;
if (candidate.getType() == TokenTypes.SLIST) {
brace = candidate;
}
break;
default:
// ATTENTION! We have default here, but we expect case TokenTypes.METHOD_DEF,
// TokenTypes.LITERAL_FOR, TokenTypes.LITERAL_WHILE, TokenTypes.LITERAL_DO only.
// It has been done to improve coverage to 100%. I couldn't replace it with
// if-else-if block because code was ugly and didn't pass pmd check.
startToken = ast;
brace = ast.findFirstToken(TokenTypes.LCURLY);
break;
}
if (brace != null) {
verifyBrace(brace, startToken);
}
}
示例14: getDefaultTokens
@Override
public int[] getDefaultTokens() {
return new int[] {
TokenTypes.ASSIGN,
TokenTypes.BAND,
TokenTypes.BAND_ASSIGN,
TokenTypes.BOR,
TokenTypes.BOR_ASSIGN,
TokenTypes.BSR,
TokenTypes.BSR_ASSIGN,
TokenTypes.BXOR,
TokenTypes.BXOR_ASSIGN,
TokenTypes.COLON,
TokenTypes.DIV,
TokenTypes.DIV_ASSIGN,
TokenTypes.DO_WHILE,
TokenTypes.EQUAL,
TokenTypes.GE,
TokenTypes.GT,
TokenTypes.LAMBDA,
TokenTypes.LAND,
TokenTypes.LCURLY,
TokenTypes.LE,
TokenTypes.LITERAL_CATCH,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_ELSE,
TokenTypes.LITERAL_FINALLY,
TokenTypes.LITERAL_FOR,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_RETURN,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.LITERAL_TRY,
TokenTypes.LITERAL_WHILE,
TokenTypes.LOR,
TokenTypes.LT,
TokenTypes.MINUS,
TokenTypes.MINUS_ASSIGN,
TokenTypes.MOD,
TokenTypes.MOD_ASSIGN,
TokenTypes.NOT_EQUAL,
TokenTypes.PLUS,
TokenTypes.PLUS_ASSIGN,
TokenTypes.QUESTION,
TokenTypes.RCURLY,
TokenTypes.SL,
TokenTypes.SLIST,
TokenTypes.SL_ASSIGN,
TokenTypes.SR,
TokenTypes.SR_ASSIGN,
TokenTypes.STAR,
TokenTypes.STAR_ASSIGN,
TokenTypes.LITERAL_ASSERT,
TokenTypes.TYPE_EXTENSION_AND,
};
}
示例15: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.ASSIGN,
TokenTypes.ARRAY_INIT,
TokenTypes.BAND,
TokenTypes.BAND_ASSIGN,
TokenTypes.BOR,
TokenTypes.BOR_ASSIGN,
TokenTypes.BSR,
TokenTypes.BSR_ASSIGN,
TokenTypes.BXOR,
TokenTypes.BXOR_ASSIGN,
TokenTypes.COLON,
TokenTypes.DIV,
TokenTypes.DIV_ASSIGN,
TokenTypes.DO_WHILE,
TokenTypes.EQUAL,
TokenTypes.GE,
TokenTypes.GT,
TokenTypes.LAMBDA,
TokenTypes.LAND,
TokenTypes.LCURLY,
TokenTypes.LE,
TokenTypes.LITERAL_CATCH,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_ELSE,
TokenTypes.LITERAL_FINALLY,
TokenTypes.LITERAL_FOR,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_RETURN,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.LITERAL_TRY,
TokenTypes.LITERAL_WHILE,
TokenTypes.LOR,
TokenTypes.LT,
TokenTypes.MINUS,
TokenTypes.MINUS_ASSIGN,
TokenTypes.MOD,
TokenTypes.MOD_ASSIGN,
TokenTypes.NOT_EQUAL,
TokenTypes.PLUS,
TokenTypes.PLUS_ASSIGN,
TokenTypes.QUESTION,
TokenTypes.RCURLY,
TokenTypes.SL,
TokenTypes.SLIST,
TokenTypes.SL_ASSIGN,
TokenTypes.SR,
TokenTypes.SR_ASSIGN,
TokenTypes.STAR,
TokenTypes.STAR_ASSIGN,
TokenTypes.LITERAL_ASSERT,
TokenTypes.TYPE_EXTENSION_AND,
TokenTypes.WILDCARD_TYPE,
TokenTypes.GENERIC_START,
TokenTypes.GENERIC_END,
TokenTypes.ELLIPSIS,
};
}