Skip to content

Unchecked cleanup notes

Jody Garnett edited this page Oct 16, 2020 · 4 revisions

This page contains notes about the unchecked cleanup work, a mix of observations and potential issues. Jira was not used to avoid creating yet another cemetery of unresolvable issues in it (as it has happened, pretty much regularly, for each large endeavour that tried to use Jira to track progress and TODOs).

gt-main

  • Converter implementations are rife of unchecked cast warnings. So far solved them by using targetClass.cast(object), which solves the issue, but I'm worried it might present a visible runtime overhead down the road (in theory, it's really just a different way of doing a cast, but the JVM might not be specifically optimizing for it)
  • There is a WKTReader able to read ISO geometries, that has a bunch of unchecked casts I cannot solve in the "multi" geometry parsing. I have a feeling the API behind ISO geometries is badly designed... For the moment I've just suppressed the warnings, also considering the class is probably not in active use.
  • An issue about DataAccessFactory/DataStoreFactorySpi asking parameter values to be Serializable is being discussed on the list.
  • DiffFeatureReader is designed to work against generic Feature, but Diff, used by the reader, is coded specifically against SimpleFeature. Looks like a broken design case. In fact, only simple feature stores can do transactions, so probably the easiest approach is to accept reality and make DiffFeatureReader also work against SimpleFeature. Generifying Diff is another possibility, made less simple than it seems by Diff.NULL, a null object constant, that cannot be generic itself. For the time being, suppressed warnings in DiffFeatureReader.

mb-style

The use of json simple library ends up with JSONArray (extends ArrayList) and JSONObject (extends HashMap) without the use of generics:

@SupressWarning("unchecked")
ArrayList<Object> array = (ArrayList<Object>) jsonArray;
array.put(1L);
Clone this wiki locally