Repository navigation
Description
Geometry.isSimple() returns false for MULTIPOINT (EMPTY, EMPTY, (1 2)), a valid MultiPoint with only one occupied X/Y position. Static and instance IsSimpleOp return false too.
Version: JTS 1.21.0-SNAPSHOT at 5a0a73632216e3e9d277150336078ec423fd215f (still upstream master on 2026-10-12), fresh core build with the Maven release profile, OpenJDK 21.0.2+13-58, Maven 3.9.9.
Reproduction
Use a POSIX shell with the Java and Maven versions above on PATH.
JOB_WORK="$(mktemp -d)"
git clone https://github.com/locationtech/jts.git "$JOB_WORK/jts"
git -C "$JOB_WORK/jts" checkout --detach 5a0a73632216e3e9d277150336078ec423fd215f
cd "$JOB_WORK/jts"
MAVEN_OPTS='-Xmx1800m -XX:MaxMetaspaceSize=512m -XX:ActiveProcessorCount=2' mvn -B -T 2 -pl modules/core -am -Drelease -Dmaven.compiler.debug=false -Dmaven.compiler.optimize=true -Dmaven.repo.local="$JOB_WORK/m2" -Dmaven.test.skip=true packageSave this as Repro.java in the checkout. Reproducer code is CC0-1.0.
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.WKTReader;
import org.locationtech.jts.operation.valid.IsSimpleOp;
/** Standalone conformance check; no test framework is required. */
public final class Repro {
public static void main(String[] args) throws Exception {
// The only coordinate is (1,2). Empty components contain no coordinates.
// There are consequently no duplicate X/Y locations: expected simple=true.
String input = "MULTIPOINT (EMPTY, EMPTY, (1 2))";
Geometry geometry = new WKTReader().read(input);
IsSimpleOp operation = new IsSimpleOp(geometry);
System.out.println("input=" + input);
System.out.println("isValid=" + geometry.isValid());
System.out.println("expected isSimple=true");
System.out.println("Geometry.isSimple=" + geometry.isSimple());
System.out.println("IsSimpleOp.isSimple=" + operation.isSimple());
System.out.println("nonSimpleLocation=" + operation.getNonSimpleLocation());
if (!geometry.isValid()) throw new AssertionError("Input must be valid");
if (!geometry.isSimple() || !operation.isSimple()) {
throw new AssertionError("Empty components must not count as duplicate coordinates");
}
}
}Compile and run:
mkdir -p "$JOB_WORK/repro-classes"
javac -J-Xmx256m -J-XX:ActiveProcessorCount=2 -cp "$JOB_WORK/jts/modules/core/target/classes" -d "$JOB_WORK/repro-classes" Repro.java
java -Xmx256m -XX:ActiveProcessorCount=2 -cp "$JOB_WORK/jts/modules/core/target/classes:$JOB_WORK/repro-classes" ReproExpected and observed
We expect true. OGC 06-103r4 1.2.1 defines an empty geometry as the empty point set (6.1.2.2), defines MultiPoint simplicity as no identical X/Y positions (6.1.5), and permits EMPTY point members (7.2.2). The IsSimpleOp Javadoc, line 44 says "MultiPoint geometries are simple if every point is unique", and the MultiPoint constructor docs, line 44 permit empty Point members.
We got this output and exit 1 with AssertionError: Empty components must not count as duplicate coordinates.
input=MULTIPOINT (EMPTY, EMPTY, (1 2))
isValid=true
expected isSimple=true
Geometry.isSimple=false
IsSimpleOp.isSimple=false
nonSimpleLocation=null
| Control input | Expected isSimple | Observed |
|---|---|---|
| MULTIPOINT (EMPTY, (1 2)) | true | true |
| MULTIPOINT (EMPTY, EMPTY) | true | true |
| MULTIPOINT EMPTY | true | true |
| MULTIPOINT ((1 2), (1 2)) | false | false |
| MULTIPOINT ((1 2), (3 4)) | true | true |
Cause
IsSimpleOp.isSimpleMultiPoint, lines 205-222 inserts each Point's coordinate into a uniqueness set, and Point.getCoordinate, lines 112-113 returns null for an empty Point. The second empty member then counts as a duplicate null. The whole-geometry empty shortcut explains the passing all-empty control. Skipping empty Point members before the uniqueness check should fix it, though we haven't tested that.
Scope
An exact integer-pair oracle checked all 3,906 ordered MultiPoints of length 0-5 over EMPTY and (0,0), (0,1), (1,0), (1,1). JTS disagreed on 480 inputs through Geometry.isSimple and both IsSimpleOp forms. Each had at least two empty members, at least one occupied position and no repeated occupied position. Validity, emptiness and component/point counts matched the oracle throughout. The minimal case also reproduces with direct GeometryFactory construction, packed coordinates, fixed integer precision, strict WKT options, copying, reversing, repeated calls, find-all-locations mode and all four supplied boundary node rules. GEOS 3.14.1 (Shapely 2.2.0) and GEOS 3.11.4 (Shapely 2.0.7) match the oracle on all inputs. We skipped the upstream JTS test suite and didn't test other JTS versions or geometry types.
PR 499 covers a historical exception for one empty and one occupied member. Its MultiPoint test does not include two empty members. The one-empty control returns true at this pin. This report concerns the two-empty false duplicate.
Happy to attach the retained verification record.
Found by ChipLab’s AI verification agents and independently reproduced.
— ChipLab · CLAB-2026-1032
Activity