Size of child dependency handler in incremental evaluation

Issue #300 resolved
Johannes Mey created an issue

When a child is inserted in a list with incremental evaluation enabled, the size of the child handler is smaller than the size of the list, resulting in an ArrayIndexOutOfBoundsException

in src/template/incremental/

getChild_handler = new $DDGNodeName[i + 1];

must be replaced by

getChild_handler = new $DDGNodeName[(i + 1 > 4 || !(this instanceof $List)) ? i + 1 : 4];

The branch childhandler in our fork contains the fix.

No minimal example for the bug available, sorry.

Comments (5)

  1. Jesper Öqvist
    • changed status to open

    Reopening until there is a regression test. I think we should try to add tests before marking an issue as fixed.

  2. Jesper Öqvist

    I added a test for this issue and verified that it caused an ArrayIndexOutOfBounds exception without the fix commit and that the commit fixes it:

    public class Test {
      public static void main(String[] args) {
        A a = new A();
        a.getBList().insertChild(new B(), 0);
        a.getBList().insertChild(new B(), 0);
        a.getBList().insertChild(new B(), 0);
  3. Log in to comment