本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.METHOD_REF属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.METHOD_REF属性的具体用法?Java TokenTypes.METHOD_REF怎么用?Java TokenTypes.METHOD_REF使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.METHOD_REF属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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,
};
}
示例2: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.COMMA,
TokenTypes.SEMI,
TokenTypes.POST_INC,
TokenTypes.POST_DEC,
TokenTypes.DOT,
TokenTypes.GENERIC_START,
TokenTypes.GENERIC_END,
TokenTypes.ELLIPSIS,
TokenTypes.METHOD_REF,
};
}
示例3: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.DOT,
TokenTypes.COMMA,
TokenTypes.SEMI,
TokenTypes.ELLIPSIS,
TokenTypes.AT,
TokenTypes.LPAREN,
TokenTypes.RPAREN,
TokenTypes.ARRAY_DECLARATOR,
TokenTypes.RBRACK,
TokenTypes.METHOD_REF,
};
}
示例4: processLiteralNew
/**
* Collects a "new" token.
* @param ast the "new" token
*/
private void processLiteralNew(DetailAST ast) {
if (ast.getParent().getType() != TokenTypes.METHOD_REF) {
instantiations.add(ast);
}
}
示例5: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.QUESTION, // '?'
TokenTypes.COLON, // ':' (not reported for a case)
TokenTypes.EQUAL, // "=="
TokenTypes.NOT_EQUAL, // "!="
TokenTypes.DIV, // '/'
TokenTypes.PLUS, //' +' (unary plus is UNARY_PLUS)
TokenTypes.MINUS, // '-' (unary minus is UNARY_MINUS)
TokenTypes.STAR, // '*'
TokenTypes.MOD, // '%'
TokenTypes.SR, // ">>"
TokenTypes.BSR, // ">>>"
TokenTypes.GE, // ">="
TokenTypes.GT, // ">"
TokenTypes.SL, // "<<"
TokenTypes.LE, // "<="
TokenTypes.LT, // '<'
TokenTypes.BXOR, // '^'
TokenTypes.BOR, // '|'
TokenTypes.LOR, // "||"
TokenTypes.BAND, // '&'
TokenTypes.LAND, // "&&"
TokenTypes.LITERAL_INSTANCEOF,
TokenTypes.TYPE_EXTENSION_AND,
TokenTypes.ASSIGN, // '='
TokenTypes.DIV_ASSIGN, // "/="
TokenTypes.PLUS_ASSIGN, // "+="
TokenTypes.MINUS_ASSIGN, //"-="
TokenTypes.STAR_ASSIGN, // "*="
TokenTypes.MOD_ASSIGN, // "%="
TokenTypes.SR_ASSIGN, // ">>="
TokenTypes.BSR_ASSIGN, // ">>>="
TokenTypes.SL_ASSIGN, // "<<="
TokenTypes.BXOR_ASSIGN, // "^="
TokenTypes.BOR_ASSIGN, // "|="
TokenTypes.BAND_ASSIGN, // "&="
TokenTypes.METHOD_REF, // "::"
};
}
示例6: getArrayDeclaratorPreviousElement
/**
* Returns proper argument for getPositionAfter method, it is a token after
* {@link TokenTypes#ARRAY_DECLARATOR ARRAY_DECLARATOR}, in can be {@link TokenTypes#RBRACK
* RBRACK}, {@link TokenTypes#IDENT IDENT} or an array type definition (literal).
* @param ast
* , {@link TokenTypes#ARRAY_DECLARATOR ARRAY_DECLARATOR} node.
* @return previous node by text order.
*/
private static DetailAST getArrayDeclaratorPreviousElement(DetailAST ast) {
final DetailAST previousElement;
final DetailAST firstChild = ast.getFirstChild();
if (firstChild.getType() == TokenTypes.ARRAY_DECLARATOR) {
// second or higher array index
previousElement = firstChild.findFirstToken(TokenTypes.RBRACK);
}
else {
// first array index, is preceded with identifier or type
final DetailAST parent = getFirstNonArrayDeclaratorParent(ast);
switch (parent.getType()) {
// generics
case TokenTypes.TYPE_ARGUMENT:
final DetailAST wildcard = parent.findFirstToken(TokenTypes.WILDCARD_TYPE);
if (wildcard == null) {
// usual generic type argument like <char[]>
previousElement = getTypeLastNode(ast);
}
else {
// constructions with wildcard like <? extends String[]>
previousElement = getTypeLastNode(ast.getFirstChild());
}
break;
// 'new' is a special case with its own subtree structure
case TokenTypes.LITERAL_NEW:
previousElement = getTypeLastNode(parent);
break;
// mundane array declaration, can be either java style or C style
case TokenTypes.TYPE:
previousElement = getPreviousNodeWithParentOfTypeAst(ast, parent);
break;
// i.e. boolean[].class
case TokenTypes.DOT:
previousElement = getTypeLastNode(ast);
break;
// java 8 method reference
case TokenTypes.METHOD_REF:
final DetailAST ident = getIdentLastToken(ast);
if (ident == null) {
//i.e. int[]::new
previousElement = ast.getFirstChild();
}
else {
previousElement = ident;
}
break;
default:
throw new IllegalStateException("unexpected ast syntax " + parent);
}
}
return previousElement;
}
示例7: isAfterMethodReference
/**
* Checks if current generic end ('>') is located after
* {@link TokenTypes#METHOD_REF method reference operator}.
* @param genericEnd {@link TokenTypes#GENERIC_END}
* @return true if '>' follows after method reference.
*/
private static boolean isAfterMethodReference(DetailAST genericEnd) {
return genericEnd.getParent().getParent().getType() == TokenTypes.METHOD_REF;
}