Getting error "Missing statement for annotation" by passing the array of annotation into another annotation in java. Code looks like this :
public @interface Big {
String abc() default "";
}
public @interface B {
String name() default "";
Big[] big() default {};
}
The following class in scala
@B(name = "Reema",big = {@Big(abc = "a"), @Big(abc = "b")})
class MainTest() {
...
}
I tried the above code and it is giving me the error : "Missing statement for annotation" in the scala class. I want to resolve the compiler issue.
CodePudding user response:
In order to make nested annotations work in Scala you have to use them like this:
@B(
name = "Reema",
big = Array(new Big(abc = "a"), new Big(abc = "b"))
)
class MainTest() {...}