projectlombok/lombok
View on GitHub[BUG] AnnotationValues cannot instantiate Compound Annotation
Open
#1,987 opened on Dec 17, 2018
help wantedlow-priority
Description
I have written an Annotation for Lombok to process, which has an array of sub-annotations as one of its parameters. The code runs fine with javac, but it fails to work in Eclipse (v2018-09).
The error I get when subs() is invoked on MainAnnotation instance is:
I can't make sense of this annotation value. Try using a fully qualified literal.
eclipse marks the first occurence of SubAnnotation as the source of the error.
- Lombok version 1.18.4
- eclipse 2018-09, java 9.0.4, eclipse project using jdk 1.8.0_191
Here is the code
@Retention( SOURCE )
@Target( TYPE )
public @interface MainAnnotation {
String name();
SubAnnotation[] subs() default {};
}
@Retention( SOURCE )
@Target( TYPE )
public @interface SubAnnotation {
String name();
String value();
}
@ProviderFor( EclipseAnnotationHandler.class )
public class HandleLombokMain extends EclipseAnnotationHandler<MainAnnotation> {
@Override
public void handle( AnnotationValues<MainAnnotation> annotation, Annotation ast, EclipseNode annotationNode ) {
MainAnnotation mainAnnotation = annotation.getInstance();
mainAnnotation.subs(); // <<< error
}
}
@MainAnnotation(name="main",subs={@SubAnnotation(name="sub1",value="1"),@SubAnnotation(name="sub2",value="2")})
public class TestClass {
}