opengeospatial / geoapi

GeoAPI provides a set of interfaces in programming languages (currently Java and Python) for geospatial applications. The GeoAPI interfaces closely follow OGC specifications, adaptated to match the expectations of programmers.
http://www.geoapi.org
Apache License 2.0
118 stars 37 forks source link

Reduce the use of wildcards in return values #90

Open desruisseaux opened 1 year ago

desruisseaux commented 1 year ago

All Java interfaces in org.opengis.metadata packages currently use wildcard when a method returns a collection. For example:

interface Citation {
    // Wildcards are the "? extends" part.
    Collection<? extends Identifier> getIdentifiers();
}

The use of wildcards in return values is a deprecated practice. It has been reported as a problem by a GeoAPI user on StackOverflow. Historically, the reason for wildcards was because it was said to be necessary for JAXB and Hibernate implementations 15 years ago. But at least in JAXB case, wildcards are actually not necessary because the problem raised in that discussion can be resolved with adapters (which is what Apache SIS does).

Proposal

GeoAPI aims for semantic versioning, which forbid compatibility break between GeoAPI 3.0 and 3.1. So the proposal is: