List<TypeAnnotation> (List<TypeAnnotation> typeAnnotations, int typeParameterIndex) { return typeAnnotations.stream() .filter(typeAnnotation -> { TargetInfo targetInfo = typeAnnotation.getTargetInfo(); return targetInfo instanceof TypeParameterTarget && ((TypeParameterTarget)targetInfo).getTypeParameterIndex() == typeParameterIndex; }).collect(Collectors.toList()); }