Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the use of wildcards in return values #90

Open
desruisseaux opened this issue Aug 28, 2023 · 0 comments
Open

Reduce the use of wildcards in return values #90

desruisseaux opened this issue Aug 28, 2023 · 0 comments
Labels
Java Specific to the Java language.
Milestone

Comments

@desruisseaux
Copy link
Contributor

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:

  • Remove most or all wildcards in org.opengis.metadata packages on the GeoAPI 4.0 branch.
  • On the GeoAPI 3.1 branch, keep wildcards on methods that were already present in GeoAPI 3.0.
@desruisseaux desruisseaux added the Java Specific to the Java language. label Aug 28, 2023
@desruisseaux desruisseaux added this to the 3.1 milestone Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java Specific to the Java language.
Projects
None yet
Development

No branches or pull requests

1 participant