Detecting circular dependencies among accumulators
The logic for detecting circularities among accumulators appears to be flawed.
Test accumulator-080 tests this condition, and we pass the test by catching a StackOverflowError in AccumulatorData.visit(). But it's not possible to catch a StackOverflow in C#, and this reveals that the other mechanisms which should catch the circularity earlier (long before the StackOverflow occurs) are failing to do so.
Specifically, there are two mechanisms
(a) AccumulatorData.buildIndex() keeps a local flag "building" which should catch any recursive entry into buildIndex() for the same AccumulatorData object. But this achieves nothing because we're creating a new AccumulatorData object on each recursive entry.
(b) AccumulatorManager.getAccumulatorData() keeps (for each document) a map from accumulator declarations to accumulator data objects, and the logic is designed to place a MARKER in this map while the accumulator data is under construction. But the code to place this MARKER in the map doesn't get executed on the path where the map exists, but doesn't hold an entry for the relevant accumulator: that is, the MARKER is only set up for the first accumulator that's built for each document.
Please register to edit this issue