Collection attribute contributions on ASTNode yield broken Java code

Issue #245 resolved
Christoff Bürger created an issue

If an equation for a collection attribute is given for ASTNode, malformed Java code is generated.

Example: Generic error handling support

coll java.util.List<ASTNode> ErrorBuilder.ErrorNodes()
     [new java.util.LinkedList<ASTNode>()] with add;

ASTNode contributes this when IsErrorNode() to ErrorBuilder.ErrorNodes()
     for ErrorBuilder();

IsErrorNode() decides for each node if it has errors and ErrorBuilder() is an inherited attribute distributing an unique ErrorBuilder node.

JastAdd generates the following code in ASTNode:

protected void contributeTo_ErrorBuilder_ErrorBuilder_ErrorNodes(java.util.List<ASTNode> collection) {
     if (IsErrorNode())

Obviously, the super call is invalid. ASTNode has no super class with a super.contributeTo_ErrorBuilder_ErrorBuilder_ErrorNodes method.

Comments (7)

  1. Jesper Öqvist

    Thank you for reporting the issue! The JastAdd regression tests did not have anything covering this yet!

    I probably caused this error because I was changing collection code generation recently.

  2. Christoff Bürger reporter

    Hi Jesper,

    thanks a lot!

    Is there a way to get the most recent jar without building on my own?

    Best Regards, Christoff

  3. Jesper Öqvist

    If you have an account on our Jenkins instance you can get the latest build here:

  4. Log in to comment