Parameterized NTA on ASTNode do not work with concurrent.

Issue #287 resolved
Alfred Åkesson created an issue

This does not work with concurrent :

syn nta A ASTNode.b(int n) = (n == 0) ? new B(): new A();

See test in PR:

Comments (4)

  1. Jesper Öqvist

    This is caused by the non-lazy initialization of a cache object in ASTNode that uses a List object for the cache. This causes an initialization loop.

  2. Jesper Öqvist

    A workaround for this issue is to add a new subtype of ASTNode, and move the attribute to the new subtype. Then make verything else that extends ASTNode extend the new type instead. This has the added advantage of removing the attributes from Opt and List.

  3. Jesper Öqvist

    The List proxy object does not need to be a list, and it can be lazily initialized if wrapped in an AtomicReference in the concurrent mode.

    See issue #112 for more discussion about the NTA proxy objects.

  4. Jesper Öqvist

    Fix NTA initialization recursion in concurrent mode

    NTA proxy object initialization would crash in recursion in concurrent mode for parameterized NTAs declared on ASTNode because the proxy object initialization was not lazy.

    This changes NTA proxy object initialization to be lazy, as in the non-concurrent mode. This is done with AtomicReference to avoid initialization data race.

    fixes #287 (bitbucket)

    → <<cset 7f1507530247>>

  5. Log in to comment