Summary
jts-core 1.20.0 fails Android ART verification during dex2oatd compilation for RelatePointLocator.init(Geometry).
The failure appears to be caused by assigning arrays of concrete locator implementations to a field whose declared type is PointOnGeometryLocator[], without using the declared array type directly.
Environment
- JTS version: 1.20.0
- Platform: Android
- Compiler/runtime component: ART /
dex2oatd
- Affected class:
org.locationtech.jts.operation.relateng.RelatePointLocator
- Affected method:
init(Geometry)
Actual Behavior
During Android compilation, dex2oatd aborts with the following verifier error:
dex2oatd F 04-17 06:43:05 90246 90246 method_verifier.cc:5126]
Verification error in void org.locationtech.jts.operation.relateng.RelatePointLocator.init(org.locationtech.jts.geom.Geometry)
void org.locationtech.jts.operation.relateng.RelatePointLocator.init(org.locationtech.jts.geom.Geometry) failed to verify:
[0x2D] register v3 has type Reference: java.lang.Object[] but expected Reference:
org.locationtech.jts.algorithm.locate.PointOnGeometryLocator[]
dex2oatd F 04-17 06:43:10 90246 90246 compiler_driver.cc:866]
Had a hard failure verifying all classes, and was asked to abort in such situations.
Expected Behavior
jts-core should pass Android ART verification and compile successfully with dex2oatd.
Suspected Cause
The issue seems to come from this code in:
modules/core/src/main/java/org/locationtech/jts/operation/relateng/RelatePointLocator.java
private void init(Geometry geom) {
//-- cache empty status, since may be checked many times
isEmpty = geom.isEmpty();
extractElements(geom);
if (lines != null) {
lineBoundary = new LinearBoundary(lines, boundaryRule);
}
if (polygons != null) {
polyLocator = isPrepared
? new IndexedPointInAreaLocator[polygons.size()]
: new SimplePointInAreaLocator[polygons.size()];
}
}
polyLocator appears to be declared as:
PointOnGeometryLocator[] polyLocator;
The ternary expression creates either an IndexedPointInAreaLocator[] or a SimplePointInAreaLocator[].
Although both element types implement PointOnGeometryLocator, Android ART appears to infer or verify the ternary expression as Object[], which then fails when assigning it to PointOnGeometryLocator[].
Impact
This prevents use of JTS 1.20.0 in affected Android builds because ART verification fails during dex2oatd compilation.
Additional Notes
This may not appear on standard JVMs because the bytecode is accepted there, but Android ART verification is stricter in this case.
Summary
jts-core1.20.0 fails Android ART verification duringdex2oatdcompilation forRelatePointLocator.init(Geometry).The failure appears to be caused by assigning arrays of concrete locator implementations to a field whose declared type is
PointOnGeometryLocator[], without using the declared array type directly.Environment
dex2oatdorg.locationtech.jts.operation.relateng.RelatePointLocatorinit(Geometry)Actual Behavior
During Android compilation,
dex2oatdaborts with the following verifier error:Expected Behavior
jts-coreshould pass Android ART verification and compile successfully withdex2oatd.Suspected Cause
The issue seems to come from this code in:
polyLocatorappears to be declared as:The ternary expression creates either an
IndexedPointInAreaLocator[]or aSimplePointInAreaLocator[].Although both element types implement
PointOnGeometryLocator, Android ART appears to infer or verify the ternary expression asObject[], which then fails when assigning it toPointOnGeometryLocator[].Impact
This prevents use of JTS 1.20.0 in affected Android builds because ART verification fails during
dex2oatdcompilation.Additional Notes
This may not appear on standard JVMs because the bytecode is accepted there, but Android ART verification is stricter in this case.