Syntax error when declaring generic methods in aspects?
I have a simple grammar in hello.ast
:
Program;
And this aspect in hello.jadd
:
aspect Generics {
public <T> void Program.print(T t) {
System.out.println(t);
}
}
With jastadd 2.1.6, this gives me
Error at hello.jadd:2:3: syntax error
I wanted to use a (static) generic method in a project and I ended up declaring it in a regular Java class and calling it from the aspect. Is there some way to declare generic methods in an aspect, or are they not supported?
Comments (3)
-
-
This is an error in the JastAdd2 parser. The parser originally only supported Java 1.4, and support for Java 1.5 features have been gradually added but is lacking in some areas still such as in this case. The best fix would be to make the parser an extension of our JastAddJ parser which is much better maintained. In the meantime I will try to fix this in the current parser.
-
- changed status to resolved
Add support for generic method inter-type decls
The parser now handles type argument lists for method inter-type declarations.
fixes issue
#183(bitbucket)→ <<cset 70ec22bcc082>>
- Log in to comment
There is a workaround, but it is somewhat cumbersome: