private static void sortTypeAnnotations(List<TypeAnnotationNode> annos) { if (annos == null) { return; } annos.sort( Comparator.comparing((TypeAnnotationNode a) -> a.desc) .thenComparing(a -> String.valueOf(a.typeRef)) .thenComparing(a -> String.valueOf(a.typePath)) .thenComparing(a -> String.valueOf(a.values))); }
protected static List<TypeAnnotationNode> copyTypeAnnotations(List<TypeAnnotationNode> originalAnnotations) { if (null == originalAnnotations || originalAnnotations.isEmpty()) { return null; } return originalAnnotations .stream() .map(t -> new TypeAnnotationNode(t.typeRef, t.typePath, t.desc)) .collect(Collectors.toCollection(ArrayList::new)); }
private static void addTypesInTypeAnnotations(Set<String> types, List<TypeAnnotationNode> annos) { if (annos == null) { return; } annos.stream().forEach(a -> collectTypesFromAnnotation(types, a)); }
static List<TypeAnnotationNode> visibleTypeAnnotationsOf(MethodNode methodNode) { return safeAnnotationsList(methodNode.visibleTypeAnnotations); }
static List<TypeAnnotationNode> visibleTypeAnnotationsOf(TryCatchBlockNode tryCatchBlockNode) { return safeAnnotationsList(tryCatchBlockNode.visibleTypeAnnotations); }
static List<TypeAnnotationNode> invisibleTypeAnnotationsOf(MethodNode methodNode) { return safeAnnotationsList(methodNode.invisibleTypeAnnotations); }
static List<TypeAnnotationNode> invisibleTypeAnnotationsOf(TryCatchBlockNode tryCatchBlockNode) { return safeAnnotationsList(tryCatchBlockNode.invisibleTypeAnnotations); }