I use Spring Security 3.1.0.RC3 because the method security feature with enum privileges was introduced in 3.1.
Here is my annotation:
public @interface SecuredEnum { public PrivilegeEnum[] value(); }
And here is how I use it:
import static somepath1.PrivilegeEnum.SOME_PRIV1; public interface MyService extends BaseService { @SecuredEnum(SOME_PRIV1) void insertOrUpdateMyObject(MyObject myObject); }
javac correctly compiles this code every time, but the eclipse compiler (Indigo SR1) gives an error after Project -> Clean:
The attribute value is undefined for the annotation type SecuredEnum
and offers a quick fix:
Create attribute 'value()'
So here is my workaround: I apply this fix and comment out the array field in the annotation:
public @interface SecuredEnum {
After that, eclipse compiles all classes correctly (except those where @SecuredEnum accepts two or more privileges). The next step is to uncomment the old field of the array and delete the new field created by the quick fix. As a result, everything is perfectly composed. So it is very unpleasant to do it every time the project is cleaned. Another problem is that I can not reproduce this problem with the help of a sample project, so maybe there is some important information that is not in this question text. Whose mistake, and how can this be fixed?
UPDATE: neither using an explicit array in the annotation argument (that is, adding {} brackets), nor defining the argument name ('value') explicitly or using a fully qualified enumeration value instead of static import helps
source share