JastAdd currently supports Java 6 syntax, and parts of Java 7 syntax, in attribute equations and aspect methods. It would be great if full Java 8 support could be added.
Java 8's lambda expressions and method/constructor references are very useful for making Java code concise. These features could benefit JastAdd code too, by making attribute equations shorter. For example, here is a reachability attribute declared using lambdas:
syn Set<FuncDecl> FuncDecl.reachable() circular [Collections.emptySet()] = calls().stream().flatMap(func -> Stream.concat(func.reachable().stream(), Stream.of(func))).collect(Collectors.toSet()); coll Set<FuncDecl> FuncDecl.calls() [new HashSet<>()] root FuncDecl; Call contributes decl() to FuncDecl.calls();
If the same code were written in Java 6, it would require a loop to iterate over the
calls set and build a new
reachable estimate, requiring many more lines of code.