jts icon indicating copy to clipboard operation
jts copied to clipboard

Use generics for index classes?

Open dbaston opened this issue 8 years ago • 6 comments

What do people think about updating some of the index classes to use generics? It would be nice to not cast the return values from spatial index queries, etc.

dbaston avatar Sep 01 '17 01:09 dbaston

Possible reasons to NOT do this are:

  • in the past there were requests to keep JTS at 1.4 compatibility, for use on mobile
  • may prevent use of JSTS transpiler? @bjornharrtell, can you comment?

dr-jts avatar Sep 01 '17 01:09 dr-jts

May require some work on the transpilation but should not be too hard to fix.

bjornharrtell avatar Sep 01 '17 05:09 bjornharrtell

Generally, I'm interested in seeing JTS attract folks who work on optimizing spatial indices. As an option for JTS 1.x, could we experiment with this in a JTS-indexing-labs package?

jnh5y avatar Oct 28 '17 19:10 jnh5y

This would break current API, wouldn't it? I.e. would require classes to be instantiated specifying the contained type?

Or is it possible to make the generic type optional (but seems unlikely...)?

dr-jts avatar Nov 01 '19 17:11 dr-jts

I thought it just defaulted to Object if you omitted it.

dbaston avatar Nov 01 '19 19:11 dbaston

I thought it just defaulted to Object if you omitted it.

If so, that would be awesomely awesome! And indeed it appears you may be right: http://www.angelikalanger.com/GenericsFAQ/FAQSections/ParameterizedTypes.html#FAQ201

dr-jts avatar Nov 01 '19 20:11 dr-jts