private static void findUnannotatedTypeVarRefs( TypeVariableSymbol typeVar, Tree sourceNode, Type type, ArrayDeque<Integer> partialSelector, ImmutableSet.Builder<InferenceVariable> resultBuilder) { List<Type> typeArguments = type.getTypeArguments(); for (int i = 0; i < typeArguments.size(); i++) { partialSelector.push(i); findUnannotatedTypeVarRefs( typeVar, sourceNode, typeArguments.get(i), partialSelector, resultBuilder); partialSelector.pop(); } if (type.tsym.equals(typeVar) && !toNullness(type.getAnnotationMirrors()).isPresent()) { resultBuilder.add( TypeArgInferenceVar.create(ImmutableList.copyOf(partialSelector), sourceNode)); } }
Type tyarg = type.getTypeArguments().get(i); if (suppressAnnotation != null && tyarg.getAnnotationMirrors().stream() .anyMatch( a ->
static Optional<InferenceVariable> fromTypeIfAnnotated(Type type) { return Nullness.fromAnnotations( type.getAnnotationMirrors().stream().map(Object::toString).collect(Collectors.toList())) .map(ProperInferenceVar::create); }
void printBrackets(Type t, StringBuilder sb, Locale locale) { Type arrel = t; while (arrel.hasTag(TypeTag.ARRAY)) { if (arrel.isAnnotated()) { sb.append(' '); sb.append(arrel.getAnnotationMirrors()); sb.append(' '); } sb.append("[]"); arrel = arrel.unannotatedType(); arrel = ((ArrayType) arrel).elemtype; } }
void printBrackets(Type t, StringBuilder sb, Locale locale) { Type arrel = t; while (arrel.hasTag(TypeTag.ARRAY)) { if (arrel.isAnnotated()) { sb.append(' '); sb.append(arrel.getAnnotationMirrors()); sb.append(' '); } sb.append("[]"); arrel = arrel.unannotatedType(); arrel = ((ArrayType) arrel).elemtype; } }
public String argtypes(boolean varargs) { List<Type> args = getParameterTypes(); if (!varargs) return args.toString(); StringBuilder buf = new StringBuilder(); while (args.tail.nonEmpty()) { buf.append(args.head); args = args.tail; buf.append(','); } if (args.head.unannotatedType().hasTag(ARRAY)) { buf.append(((ArrayType)args.head.unannotatedType()).elemtype); if (args.head.getAnnotationMirrors().nonEmpty()) { buf.append(args.head.getAnnotationMirrors()); } buf.append("..."); } else { buf.append(args.head); } return buf.toString(); }
public String argtypes(boolean varargs) { List<Type> args = getParameterTypes(); if (!varargs) return args.toString(); StringBuilder buf = new StringBuilder(); while (args.tail.nonEmpty()) { buf.append(args.head); args = args.tail; buf.append(','); } if (args.head.unannotatedType().hasTag(ARRAY)) { buf.append(((ArrayType)args.head.unannotatedType()).elemtype); if (args.head.getAnnotationMirrors().nonEmpty()) { buf.append(args.head.getAnnotationMirrors()); } buf.append("..."); } else { buf.append(args.head); } return buf.toString(); }
@Override public Boolean visitAnnotatedType(AnnotatedType t, Type s) { if (!s.isAnnotated()) return false; if (!t.getAnnotationMirrors().containsAll(s.getAnnotationMirrors())) return false; if (!s.getAnnotationMirrors().containsAll(t.getAnnotationMirrors())) return false; return visit(t.unannotatedType(), s); } };
if (args.head.getAnnotationMirrors().nonEmpty()) { buf.append(' '); buf.append(args.head.getAnnotationMirrors()); buf.append(' ');
@Override public Boolean visitAnnotatedType(AnnotatedType t, Type s) { if (!s.isAnnotated()) return false; if (!t.getAnnotationMirrors().containsAll(s.getAnnotationMirrors())) return false; if (!s.getAnnotationMirrors().containsAll(t.getAnnotationMirrors())) return false; return visit(t.unannotatedType(), s); } };
if (args.head.getAnnotationMirrors().nonEmpty()) { buf.append(' '); buf.append(args.head.getAnnotationMirrors()); buf.append(' ');
/** * Get the annotations of this program element. * Return an empty array if there are none. */ public AnnotationDesc[] annotations() { if (!type.isAnnotated()) { return new AnnotationDesc[0]; } List<? extends TypeCompound> tas = type.getAnnotationMirrors(); AnnotationDesc res[] = new AnnotationDesc[tas.length()]; int i = 0; for (Attribute.Compound a : tas) { res[i++] = new AnnotationDescImpl(env, a); } return res; } }
/** * Get the annotations of this program element. * Return an empty array if there are none. */ @Override public AnnotationDesc[] annotations() { List<? extends TypeCompound> tas = type.getAnnotationMirrors(); if (tas == null || tas.isEmpty()) { return new AnnotationDesc[0]; } AnnotationDesc res[] = new AnnotationDesc[tas.length()]; int i = 0; for (Attribute.Compound a : tas) { res[i++] = new AnnotationDescImpl(env, a); } return res; }
public void visitAnnotatedType(JCAnnotatedType tree) { // No need to retain type annotations in the tree // tree.annotations = translate(tree.annotations); tree.annotations = List.nil(); tree.underlyingType = translate(tree.underlyingType); // but maintain type annotations in the type. if (tree.type.isAnnotated()) { tree.type = tree.underlyingType.type.unannotatedType().annotatedType(tree.type.getAnnotationMirrors()); } else if (tree.underlyingType.type.isAnnotated()) { tree.type = tree.underlyingType.type; } result = tree; }
public void visitAnnotatedType(JCAnnotatedType tree) { // No need to retain type annotations in the tree // tree.annotations = translate(tree.annotations); tree.annotations = List.nil(); tree.underlyingType = translate(tree.underlyingType); // but maintain type annotations in the type. if (tree.type.isAnnotated()) { tree.type = tree.underlyingType.type.unannotatedType().annotatedType(tree.type.getAnnotationMirrors()); } else if (tree.underlyingType.type.isAnnotated()) { tree.type = tree.underlyingType.type; } result = tree; }
for( Attribute.TypeCompound anno: type.getAnnotationMirrors() )
private SrcType makeSrcType( Type type, Symbol symbol, TargetType targetType, int index ) List<Attribute.TypeCompound> annotationMirrors = type.getAnnotationMirrors(); if( annotationMirrors != null && !annotationMirrors.isEmpty() )
Type tyarg = type.getTypeArguments().get(i); if (suppressAnnotation != null && tyarg.getAnnotationMirrors().stream() .anyMatch( a ->
if (subCatch.type.isAnnotated()) { for (Attribute.TypeCompound tc : subCatch.type.getAnnotationMirrors()) { tc.position.type_index = catchType; if (subCatch.type.isAnnotated()) { for (Attribute.TypeCompound tc : subCatch.type.getAnnotationMirrors()) { tc.position.type_index = catchType;
if (subCatch.type.isAnnotated()) { for (Attribute.TypeCompound tc : subCatch.type.getAnnotationMirrors()) { tc.position.type_index = catchType; if (subCatch.type.isAnnotated()) { for (Attribute.TypeCompound tc : subCatch.type.getAnnotationMirrors()) { tc.position.type_index = catchType;