-
Notifications
You must be signed in to change notification settings - Fork 448
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
Missing Collection Type Parameter Declarations for method return values? #1113
Comments
This has come up before - see #492. @jodygarnett do you have any concerns with this? (since GeoTools is a good proxy to determine what effect this will have on client code). Not directly related to this proposal: discussions and work on adding type parameters to JTS containers: #146, #777, #797 and #799. |
Yes, it would be a good idea to add types to the lists, while type eraser is "weak" in Java ... it is still something and can help catch mistakes before runtime. @micycle1 if you are in position to work on this is would be a welcome addition to the library. We would issue a new dot release (due to API change). |
@micycle1 How about you start with a PR to add generics to a small number of classes (perhaps just one?) so we can assess how this will work? |
The issue I’m referring to isn’t about adding generics to classes (like initialising STRTree with a type, as suggested in the other linked issues). Instead, it’s about ensuring that methods return properly typed values wherever it makes sense. For example, take the method That said, adding generics is a good idea too. I can do that, but it's probably best to use #797 (as you've pointed out) as a starting point. |
Good clarification. I'll update the comment above about related issues to make that clear. I've updated the issue title to clarify as well - feel to improve if needed. |
Small feedback on issue title:
Turns it into a "positive improvement" rather than a mistake being fixed. |
Many areas of the codebase return collections without a type parameter declaration (examples below), which introduces the need for superfluous casting in user's code.
Happy to do this myself (at least on the more commonly used areas) -- would you accept a PR for this?
The text was updated successfully, but these errors were encountered: