GeoLatte / geolatte-geom

A geometry model that conforms to the OGC Simple Features for SQL specification.
Other
134 stars 63 forks source link

PackedPositionSequence is not immutable but clone returns this #48

Closed downloaddee closed 7 years ago

downloaddee commented 7 years ago

PackedPositionSequence is not fully immutable as e.g. the setOrdinate method changes the object state in place. However, the clonemethod returns this which means calling clone and setOrdinate on the cloned instance changes the state of the original sequence as well. One case where this is actually a problem is when calling reverse on a JTS LineString backed by a PackedPositionSequence. Normally the expectation of that call is is creates a new LineString and leaves the original unchanged but as the PackedPositionSequence is not immutable but clone returns this, you end up having two LineStrings reversed, not just one.

maesenka commented 7 years ago

Thanks for pointing this out. Should now be resolved.