Arunav
Arunav

Reputation: 33

Compilation error when trying to build a maven project with JAVA custom annotation which has ENUM variables defined in it

I have few custom java Annotations present in the parent project which successfully builds. When trying to build the test project which has the class "TestClass" using maven 3.x.x, it throws compilation error: [ERROR] /C:/Users/.../TestClass.java:[31,1] annotation com.xxx.annotation.CustomAnnotation is missing value for the attribute < clinit >

Points to Note:

Annotation Example: (I have changed the names for confidentiality)

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@ABCD(abcd = "value")       
public @interface CustomAnnotation {
   String value();  
   final String xxx = "xxxyyyzzz";
   final EnumA enumA = EnumA.XXX;
   final EnumB enumB = EnumB.YYY;
}

Class Example (I have changed the names for confidentiality):

@CustomAnnotation("testclass")
public class TestClass {
   ...
   ...
   ...
 }

Did anybody come across such scenarios? Any suggestions?

Upvotes: 2

Views: 4815

Answers (1)

Sheikh Abdul Wahid
Sheikh Abdul Wahid

Reputation: 2773

upgrade jdk version to 1.7.80. I observed same issue in version 1.7.79.

Upvotes: 4

Related Questions