Collection attribute contributions on ASTNode yield broken Java code

Create issue
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. Log in to comment