MCPcopy Create free account
hub / github.com/spotbugs/spotbugs / NonShortCircuit

Class NonShortCircuit

spotbugsTestCases/src/java/NonShortCircuit.java:1–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class NonShortCircuit {
2 boolean b;
3
4 boolean arrayDanger(int[] a, int i, int x) {
5 return i < a.length & a[i] == x;
6 }
7
8 boolean bothBitsFalsePositive(int i) {
9 return and((i & 0x1) != 0, (i & 0x2) != 0);
10 }
11
12 boolean bothBitsFalsePositive2(int i) {
13 return combine((i & 0x1) != 0, (i & 0x2) != 0, (i & 0x4) != 0) != 0;
14 }
15
16 boolean and(boolean x, boolean y) {
17 return x & y;
18 }
19
20 int combine(boolean x, boolean y, boolean z) {
21 int result = 0;
22 if (x)
23 result += 1;
24 if (y)
25 result += 10;
26 if (z)
27 result += 100;
28 return result;
29 }
30
31 void orIt(boolean x, boolean y) {
32 x |= y;
33 b |= x;
34 }
35
36 void andIt(boolean x, boolean y) {
37 x &= y;
38 b &= x;
39 }
40
41 void hardWay(Object x, Object y) {
42 boolean r = x != null;
43 r &= y != null;
44 }
45
46 boolean ordered(int x, int y, int z) {
47 if (x >= y | y >= z)
48 System.out.println("Not ordered");
49 return x < y & y < z;
50 }
51
52 boolean nonEmpty(Object o[]) {
53 return o != null & o.length > 0;
54 }
55
56 public static final int BIT0 = 1; // 1st bit
57
58 protected int m_iType;
59
60 public NonShortCircuit(boolean available) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…