You're right that the interface (DataDictionary) allows for returning lists with more than one element, so the callers still need to account for that possibility, even though the specific implementation (DataDictionaryImpl) says in its javadoc that it always returns 0 or 1.
As to the possibility of masking errors, you're right that the patch would mask duplicates in the SYSFUN_FUNCTIONS array, but it would not change anything for routines looked up in the catalogs, as the signature of getAliasDescriptor() guarantees that no more than one descriptor is returned. I'm not sure if we'll ever want to add duplicate names in SYSFUN_FUNCTIONS, but it might make sense to preserve the current code's readiness for it.
What about this alternative patch (1b)? It makes the following changes:
- remove the early termination of the loop that the 1a patch introduced
- still collect results into an ArrayList, but only for SYSFUN_FUNCTIONS
- use Collections.EMPTY_LIST and Collection.singletonList(), but only for the descriptors fetched from the catalog, which are known at compile-time to be exactly 0 or 1