@Test public void testDefaultBugTypeAndPriority() { BugInstance bug = check.createBugInstance(); assertEquals(FindNonShortCircuit.NS_NON_SHORT_CIRCUIT, bug.getType()); assertEquals(Priorities.LOW_PRIORITY, bug.getPriority()); }
BugInstance createBugInstance() { int priority = LOW_PRIORITY; String pattern = NS_NON_SHORT_CIRCUIT; if (sawDangerOld) { if (sawNullTestVeryOld) { priority = HIGH_PRIORITY; } else if (sawMethodCallOld || sawNumericTestVeryOld && sawArrayDangerOld) { priority = HIGH_PRIORITY; pattern = NS_DANGEROUS_NON_SHORT_CIRCUIT; } else { priority = NORMAL_PRIORITY; } } return new BugInstance(this, pattern, priority); }
FindNonShortCircuit extends OpcodeStackDetector implements StatelessDetector { BugInstance createBugInstance() { int priority = LOW_PRIORITY; String pattern = NS_NON_SHORT_CIRCUIT; if (sawDangerOld) { if (sawNullTestVeryOld) { priority = HIGH_PRIORITY; } else if (sawMethodCallOld || sawNumericTestVeryOld && sawArrayDangerOld) { priority = HIGH_PRIORITY; pattern = NS_DANGEROUS_NON_SHORT_CIRCUIT; } else { priority = NORMAL_PRIORITY; } } return new BugInstance(this, pattern, priority); } }
FindNonShortCircuit extends OpcodeStackDetector implements StatelessDetector { BugInstance createBugInstance() { int priority = LOW_PRIORITY; String pattern = NS_NON_SHORT_CIRCUIT; if (sawDangerOld) { if (sawNullTestVeryOld) { priority = HIGH_PRIORITY; } else if (sawMethodCallOld || sawNumericTestVeryOld && sawArrayDangerOld) { priority = HIGH_PRIORITY; pattern = NS_DANGEROUS_NON_SHORT_CIRCUIT; } else { priority = NORMAL_PRIORITY; } } return new BugInstance(this, pattern, priority); } FindNonShortCircuit(BugReporter bugReporter); }
FindNonShortCircuit extends OpcodeStackDetector implements StatelessDetector { BugInstance createBugInstance() { int priority = LOW_PRIORITY; String pattern = NS_NON_SHORT_CIRCUIT; if (sawDangerOld) { if (sawNullTestVeryOld) { priority = HIGH_PRIORITY; } else if (sawMethodCallOld || sawNumericTestVeryOld && sawArrayDangerOld) { priority = HIGH_PRIORITY; pattern = NS_DANGEROUS_NON_SHORT_CIRCUIT; } else { priority = NORMAL_PRIORITY; } } return new BugInstance(this, pattern, priority); } FindNonShortCircuit(BugReporter bugReporter); @Override void visit(Method obj); @Override void visit(Code code); @Override void sawOpcode(int seen); }
FindNonShortCircuit extends OpcodeStackDetector implements StatelessDetector { BugInstance createBugInstance() { int priority = LOW_PRIORITY; String pattern = NS_NON_SHORT_CIRCUIT; if (sawDangerOld) { if (sawNullTestVeryOld) { priority = HIGH_PRIORITY; } else if (sawMethodCallOld || sawNumericTestVeryOld && sawArrayDangerOld) { priority = HIGH_PRIORITY; pattern = NS_DANGEROUS_NON_SHORT_CIRCUIT; } else { priority = NORMAL_PRIORITY; } } return new BugInstance(this, pattern, priority); } FindNonShortCircuit(BugReporter bugReporter); @Override void visit(Method obj); @Override void visit(Code code); @Override void sawOpcode(int seen);  }