Why am I getting this annotations error message

Viewed 26

I am working on annotations, and I keep getting this message "Cannot instantiate the type AnnotationConfiguration". Can you clarify what this means and how I can resolve this?

1 Answers

When creating an instance of an Annotation you have to specify all "attributes" as methods and add an annotationType method.

AnnotationConfiguration annotation = new AnnotationConfiguration()
    {
        @Override
        public String value()
        {
            return "example";
        }

        @Override
        public Class<? extends Annotation> annotationType()
        {
            return AnnotationConfiguration.class;
        }
    };
Related