2

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.

1 Answer 1

2

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() {...}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.