-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FASTJava importer fails on Annotated methods #115
Comments
The FASTJavaAnnotation class should be redesign. |
I don't see this method failing when I try it, even with multiple annotations, when executing something like: JavaSmaCCProgramNodeImporterVisitor parseCodeMethodString: '@MyAnnotation int f() { }'.
FASTJavaAnnotation new
expression: (FASTJavaVariableExpression new name: 'MyAnnotation') However, I think it should be similar to a class-type expression: JavaSmaCCProgramNodeImporterVisitor parseCodeMethodString: 'Class f() { return MyClass.class; }'. Where the FASTJavaClassTypeExpression new
typeName: (FASTJavaTypeName new name: 'MyClass') This is even necessary to correctly represent the annotation name being fully qualified. FASTJavaAnnotation new
expression: (FASTJavaClassProperty new
type: (FASTJavaVariableExpression new name: 'com');
fieldName: 'MyAnnotation') While parsing FASTJavaClassTypeExpression new
typeName: (FASTJavaQualifiedTypeName new
namespace: (FASTJavaTypeName new name: 'com');
name: 'MyClass') |
Now parsing FASTJavaAnnotation new name: 'MyAnnotation' |
Also the parser fails when the argument is an array literal: @Tags({"Java", "Annotations", "Testing"}) // slot 'argumentOwner' not found
public class AnnotatedClass { } Also failing when an interface is annotated: @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MyMethodAnnotation { } And the annotation is ignored when it is on a parameter: int f(@Tag int foo) { } Ideally, even this extreme case should be parsable: @interface MyAnnotations {
I[] value();
}
@java.lang.annotation.Repeatable(MyAnnotations.class)
@interface I {
}
@I
public @I class WeirdStuff<@I T extends @I Number & @I Comparable<@I ? super @I T> & java.io.@I Serializable> {
@I
java.util.@I @I ArrayList<@I ? extends @I T> mylist;
@I
public @I int @I [] myMethod(fr.WeirdStuff<@I T> this, @I java.util.@I ArrayList<java.lang.@I String> mylist) @I [] {
@I int i @I [] = new @I int @I ['a'];
return new @I int @I [] @I [] { { 1, 2, 3 }, i, };
}
} |
visit method calls #expression
but
anAnnotation name
is not an expressionThe text was updated successfully, but these errors were encountered: