Hi developers.
Today I tried, out of interest, to create a simple implementation of some
feature-related GeoAPI classes, among them "FeatureCollection". I got stuck
with FeatureCollection however, getting several name clashes, some of which
I could not resolve.
I wondered if it is me being too stupid or the API being poorly designed or
Eclipse Java tools being buggy. So I did a test.
A) Original API.
----------------
I created a new Java project, added the original "geoapi-tiger.jar",
downloaded from GeoAPI as depencency and tried to create an implementation
with method stubs.
Result:
Follwing four methods occurred twice with different type signatures:
(The signatures being <Feature> and <?>.
- public boolean containsAll(Collection c)
- public boolean addAll(Collection c)
- public boolean removeAll(Collection c)
- public boolean retainAll(Collection c)
After removing the generics (as shown above) all name clashes were resolved.
The result is, not type safe any more, but at least it works.
Comment 1:
FeatureCollection should respect the method signatures implied by
Collection<Feature>, such as
public boolean removeAll(Collection<?> c)
instead of overriding them with something incompatible such as
public boolean removeAll(Collection<Feature> c)
which results in implementations that cannot be type safe.
But the real problem comes now:
B Modified API
--------------
Now I repeated the above with the "geoapi-2.0-tiger.jar" downloaded from
lists.refractions.net/geotools/geoapi/jars/. This is the one I use in
projects that contain Geotools code.
Result:
- The above four methods needed their generics to be removed in order to
resolve the name clashes.
- public boolean add(Object arg0)
throws UnsupportedOperationException, BackingStoreException {
also produced a name clash.
The implementation contains both methods:
public boolean add(Object arg0)
public boolean add(Feature o)
Both are needed (removing one, produces error). However the method with the
object argument produces the name clash, saying it is incompatible to
Collection<E>.
I have NO IDEA what I could do ...
... except declare the modified geoapi-2.0-tiger.jar as unimplementable
... or use the geoapi jar without the tiger, which I would not like.
Any help is appreciated.
--
Matthias Basler
[EMAIL PROTECTED]
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel