Default update method for collection attributes

Issue #219 resolved
Jesper Öqvist created an issue

JastAdd2 2.1.11-24-g11c3236

Collection attribute declarations currently need a with add to declare that the add method is used to mutate the collection. Most Java collections use an add method to add elements to the collection, so it would make sense to be able to skip the with add part of the collection declaration and have add be the default update method.

For example:

coll Collection<String> CompilationUnit.ids()
    [new LinkedList<String>]
    root CompilationUnit;

##Tasks

  • Add tests for collection attribute declarations using the default mutation method.
  • Allow the parser to parse coll declarations without the with part.
  • Update the reference manual to mention that with is optional in collection attribute declarations.
  • Add an example of a collection attribute declaration without the with part in the reference manual.

Comments (1)

  1. Jesper Öqvist reporter

    Make the collection update method optional

    Made the 'with x' part of a collection attribute declaration optional. The default update method is 'add'.

    fixes #219 (bitbucket)

    → <<cset 95d66150ab39>>

  2. Log in to comment