/**
* Moves type annotations in {@code annotations} to {@code type}, and adds any declaration
* annotations on {@code type} to {@code declarationAnnotations}.
*/
private static Type disambiguate(
Env<ClassSymbol, TypeBoundClass> env,
ElementType declarationTarget,
Type type,
ImmutableList<AnnoInfo> annotations,
Builder<AnnoInfo> declarationAnnotations) {
// desugar @Repeatable annotations before disambiguating: annotation containers may target
// a subset of the types targeted by their element annotation
annotations = groupRepeated(env, annotations);
ImmutableList.Builder<AnnoInfo> typeAnnotations = ImmutableList.builder();
for (AnnoInfo anno : annotations) {
Set<ElementType> target = env.get(anno.sym()).annotationMetadata().target();
if (target.contains(ElementType.TYPE_USE)) {
typeAnnotations.add(anno);
}
if (target.contains(declarationTarget)) {
declarationAnnotations.add(anno);
}
}
return addAnnotationsToType(type, typeAnnotations.build());
}
DisambiguateTypeAnnotations.java 文件源码
java
阅读 39
收藏 0
点赞 0
评论 0
项目:turbine
作者:
评论列表
文章目录