Repeated code in Polygon [LUCENE-9757]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
In the Polygon constructor the following inequality check is repeated:
```java
if (polyLats.length != polyLons.length) {
throw new IllegalArgumentException("polyLats and polyLons must be equal length");
}
```
Not sure if if's worth reporting such a trivial "bug" but perhaps the nanosecond saving is worth it for someone.
---
Migrated from [LUCENE-9757](https://issues.apache.org/jira/browse/LUCENE-9757) by Neil Ireson (@neilireson), updated Feb 21 2021
Environment:
```
```
Contributor guide
Research direction
Locate the Java Polygon constructor referenced in the issue and inspect where the polyLats/polyLons length check is repeated. Remove the redundant check while preserving the IllegalArgumentException behavior, then verify that Polygon construction and mismatched lengths still behave as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100