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/ASTChange.tt#lines-225

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

    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: https://bitbucket.org/jastadd/jastadd-test/commits/b386028eb5ab6b63aaabf797322895cd4e807d27

    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);
      }
    }
    
  2. Log in to comment