TypeAnnotationProvider (@NotNull PsiType type1, @NotNull PsiType type2) { if(type1.getAnnotationProvider() == TypeAnnotationProvider.EMPTY && !(type1 instanceof PsiClassReferenceType)) { return type2.getAnnotationProvider(); } if(type2.getAnnotationProvider() == TypeAnnotationProvider.EMPTY && !(type2 instanceof PsiClassReferenceType)) { return type1.getAnnotationProvider(); } return () -> ArrayUtil.mergeArrays(type1.getAnnotations(), type2.getAnnotations()); }