In my Result class, I annotated @IntDef the first integer parameter in the newInstance() method, for example:
public class Result { public static final int SUCCESS = 0; public static final int FAIL = 1; public static final int UNKNOWN = 2;
Next, in my Utils class, I call this method and pass the correct constant as a parameter. I guarantee that I use a specific set of constants, for example:
public static Result foo() {
But lint cannot build with security error
"WrongConstant: Invalid constant"
../../src/main/java/my/package/Utils.java: 45: Must be one of: 0, 1, 2
I know that this error can simply be suppressed. But I would like to know what happened to my code? Or maybe this is another problem?
source share