Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V6136. Values of bit flags are...
menu mobile close menu
Additional information
toggle menu Contents

V6136. Values of bit flags are duplicated.

Aug 07 2026

The analyzer has detected a group of constants that looks like a set of bit flags: consecutive static final fields, variables, or enum fields initialized with integer values which are powers of two. One of the values in this group is repeated. It's likely a typo caused by adding a new flag or copying from the line next to it.

The example:

public class FilePermission {
  public static final int READ    = 0x01;
  public static final int WRITE   = 0x02;
  public static final int EXECUTE = 0x04;
  public static final int DELETE  = 0x04;  // <=
}

The EXECUTE and DELETE constants share the same value. The (mask & DELETE) != 0 check evaluates to true when the mask contains only the execute permission, and clearing one flag also clears the other.

The fixed code:

public class FilePermission {
  public static final int READ    = 0x01;
  public static final int WRITE   = 0x02;
  public static final int EXECUTE = 0x04;
  public static final int DELETE  = 0x08;
}