# SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

# Differences

This shows you the differences between two versions of the page.

 teaching:labs:mdse:2013:bug_descriptions:jt-bug-cor7 [2014/02/13 17:13]malte.mauelshagen teaching:labs:mdse:2013:bug_descriptions:jt-bug-cor7 [2018/05/09 01:59] (current) Both sides previous revision Previous revision 2014/03/05 10:52 Günter Kniesel 2014/02/13 17:13 malte.mauelshagen 2014/02/09 06:57 external edit2014/01/28 19:03 malte.mauelshagen 2013/11/14 23:37 external edit2013/10/28 16:44 malte.mauelshagen created Next revision Previous revision 2014/03/05 10:52 Günter Kniesel 2014/02/13 17:13 malte.mauelshagen 2014/02/09 06:57 external edit2014/01/28 19:03 malte.mauelshagen 2013/11/14 23:37 external edit2013/10/28 16:44 malte.mauelshagen created Line 1: Line 1: + ====== Bug Cor 07 ====== + ===== Inspired by ===== + + * [[http://​findbugs.sourceforge.net/​bugDescriptions.html#​BIT_AND_ZZ| BIT: Check to see if ((...) & 0) == 0 (BIT_AND_ZZ)]] + + ===== Original Description ===== + + "This method compares an expression of the form (e & 0) to 0, which will always compare equal. This may indicate a logic error or typo." -- 2013-10-28 ​ + + + ===== Detailed Description ===== + + When ever a value is bitwise conjoined with zero (x & 0 ) the result is **ALWAYS** zero. That means there is no need to compare the result afterwards if it really is zero. + + ===== Sample Problem Scenario ===== + + + int x = 131; + if((x & 0) == 0){ + System.out.println("​This will always happen"​);​ + } + ​ + + ===== Sample Counter Scenario ===== + + + int x = 131; + if((x | 0) == 0){ + System.out.println("​This might happen"​);​ + } + ​ + + + ===== Sample Fix ===== + + There is no meaningful fix that we can offer. The programmer has to understand herself the logic error or typo and correct it manually. + + ===== Evaluation Results ===== + + + ^  Benchmark project ​ ^  Precision ​             ^^^  Recall ​               ^^^ + |                     ​| ​ FB    |  JT    |  Delta  |  FB    |  JT    |  Delta | + |  Apache Tomcat ​       | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  Argo UML         | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  AWT        | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  Jakarta ​       | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  Java IO         | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  JHotDraw ​       | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  jrefactory ​      | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  JServlet ​       | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  JUnit        | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  Lexi       | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  Mapper XML       | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  nutch        | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  PMD        | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + |  quickuml ​       | 100%  | 100%  |  0  |  100%  |  100%  |  0  |  ​ + FB = FindBugs, JT = JTransformer,​ Delta = JTransformer - FindBug +