Overview

Although we have @Contract declarations for various methods in some of our core utilities (such as Assert and StringUtils), we have not yet consistently declared nullability contracts via @Contract for all applicable utility methods.

To provide better nullability support, we should therefore consistently declare method-level nullability contracts for the following core utilities.

  • SupplierUtils
  • ClassUtils
  • CollectionUtils
  • FileSystemUtils
  • ObjectUtils
  • PatternMatchUtils
  • ReflectionUtils
  • ResourceUtils
  • SerializationUtils
  • StringUtils
  • TypeUtils

Related Issues

  • 34896

  • 34911

Comment From: christophstrobl

When adding @Contract annotations please also consider switching CollectionUtils.contains(@Nullable Iterator<?> iterator, Object element) to CollectionUtils.contains(@Nullable Iterator<?> iterator, @Nullable Object element).

Comment From: sbrannen

Sure, we'll take that into consideration, @christophstrobl.