@Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
if (!methodSelect(
instanceMethod(Matchers.<ExpressionTree>isSubtypeOf("java.lang.Class"), "getAnnotation"))
.matches(tree, state)) {
return Description.NO_MATCH;
}
MemberSelectTree memTree = (MemberSelectTree) tree.getArguments().get(0);
TypeSymbol annotation = ASTHelpers.getSymbol(memTree.getExpression()).type.tsym;
Retention retention = ASTHelpers.getAnnotation(annotation, Retention.class);
if (retention != null && retention.value().equals(RUNTIME)) {
return Description.NO_MATCH;
}
return describeMatch(tree, new SuggestedFix().replace(tree, "null"));
}
NonRuntimeAnnotation.java 文件源码
java
阅读 37
收藏 0
点赞 0
评论 0
项目:error-prone-aspirator
作者:
评论列表
文章目录