JD.BITCMPJD.BITCMP happens when an if check contains binary such as & or | instead of short-circuit, such as && or ||. It is better to use short-circuit operation for performance. Also, if you use binary, both sides of the expression are evaluated, and this can cause other unexpected problems, such as a null pointer exception being thrown. as in the example below. Vulnerability and riskA JD.BITCMP defect can cause a performance impact or unexpected behavior, such as a RuntimeException being thrown. Mitigation and preventionReplace bit operation with short-circuit operation. Example 110 static void check(int arr[]) { 11 if (arr!=null & arr.length!=0) { 12 foo(); 13 } 14 return; 15 } JD.BITCMP is reported for line 11: Questionable use of bit operation '&' in expression. Did you mean '&&'? Related checkers |