-1
我正在尋找一種方法來將註釋中的變量的默認值設置爲相同註釋中的另一個變量,這裏是我想要的要做到:如何將變量的默認值設置爲相同註釋中的另一個
public @interface Command {
String commandName();
String triggerName() default commandName();
String description() default "";
}
通過這樣做,我得到與Eclipse的錯誤,那就是:
The value for annotation attribute Command.triggerName must be a constant expression
所以我不能完全肯定不懂,也許它要求我改變「commandName」給一個常量變量(帶final),但是我只能把public和abstract。
有沒有辦法做我在解釋什麼?