getodk/javarosa

Remove redundant check of cycles in the DAG

Closed this issue · 0 comments

XFormParser.addMainInstanceToFormDef does two DAG cycle checks:

  • There's an explicit check by calling checkDependencyCycles, which ultimately calls TriggerableDag.reportDependencyCycles.
  • There's an implicit check by calling FormDef.finalizeTriggerables, which calls the same method in TriggerableDag that has its own cycle detection code.

Both methods have similar side-effects (throw an unchecked exception when cycles are detected).

Currently, the code in both check has an important difference in that the first will exclude self-reference and the second won't, but the high-level goal is the same, and being one so close to the other, and being an intensive operation as it is, we would like to leave just the one that happens in the TriggerableDag.finalizeTriggerables method.

For that to happen, we should first add regression tests to ensure self-references are excluded.