locationtech / locationtech/spatial4j

Convert Shape impl interfaces to abstract classes

Open
#29 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API
Dominant language
Java
Stars
961
Forks
172
PR merge metrics
No merged PRs in 30d

Description

There is common behaviour, particularly around identity (equals and hashcode) that needs to be shared amongst Shape implementations. All Rectangles, no matter how they are implemented, should be considered equal for example. Currently this is solved by having static equals and hashcode methods which impls can share. A cleaner way is to use abstract classes to control the common behaviour.

There is some concern from David that using abstract classes prevents a Shape impl extending a JTS Geometry for example, and implementing a Shape interface. I believe in these instances it is best to wrap the JTS Geometry rather than extend it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Shape implementations and the shared static equals and hashcode methods. Review how common identity behavior is currently shared, then evaluate the abstract-class approach against the concern about extending JTS Geometry; done means the implementations share the behavior while preserving the intended Shape integration.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.