CUBA Idea plugin: Ошибка анализа аннотации @WindowParam при использовании Enum

При использовании Enum’ов аннотация считает себя ошибочной. Пример возникновения.


final static public String PARAM_CURRENT_CARD = WindowParams.ITEM.name();

@WindowParam(name = PARAM_CURRENT_CARD)
private Card card;

Проблема не в ‘CUBA Idea plugin’.
Данную инспекцию показывает сама ‘Idea’ и говорит о том, что - ‘Значение атрибута должно быть константой’. В вашем случае это не так.

Вот несколько обсуждение на stackoverflow касательно этой проблемы.
http://stackoverflow.com/questions/3271659/use-enum-type-as-a-value-parameter-for-rolesallowed-annotation

http://stackoverflow.com/questions/13253624/how-to-supply-enum-value-to-an-annotation-from-a-constant-in-java

To see why your code wasn’t compiling, I had a look into the Java Language Specification (JLS). The JLS for annotations states that for an annotation with a parameter of type T and value V,

if T is a primitive type or String, V is a constant expression.
A constant expression includes, amongst other things,

Qualified names of the form TypeName . Identifier that refer to constant variables
and a constant variable is defined as

a variable, of primitive type or type String, that is final and initialized with a compile-time constant expression