[JSR308] Simple question regarding jsr308 compiler for localvariable annotation processing

Mahmood Ali mahmood at MIT.EDU
Wed Dec 17 09:24:52 EST 2008


Greetings Chester,

>     if (!testCondition(myTest))  {
>         @ErrorMessage(messageFormat="this is annoation on local  
> variable, value = {0} ";
>         String errorCode = "EC_101";
>         throw new MyException(errorCode, myValue);
>     }

I don't quite understand what the goal of processing the local  
variable annotations and if this is the right way of doing it.  In the  
provided example, at run-time the MyException handler does not have  
access to the error message.

So that the annotation becomes visible at Element level, the  
annotation needs to be meta-annotated with @Retention(CLASS) or  
@Retention(RUNTIME).

Regards,
Mahmood




More information about the JSR308 mailing list