whats the difference between these two declarations?
public static final int a = 0;
public static final int b = 1;
public static final int c = 2;
@IntDef({a, b, c})
@Retention(RetentionPolicy.SOURCE)
public @interface SomeIntDef {
}
and
@IntDef({a, b, c})
@Retention(RetentionPolicy.SOURCE)
public @interface SomeIntDef {
int a = 0;
int b = 1;
int c = 2;
}
I mean what is best practice or there any technical differences between these two declarations.
int
; the latter is defining no possible values, but adding 3 fields (with no semantic meaning) with default values to the annotation.