SDA SE Wiki

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

User Tools

Site Tools


Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
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)
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 =====
 +
 +<code Java>
 + int x = 131;
 + if((x & 0) == 0){
 + System.out.println("​This will always happen"​);​
 + }
 +</​Code>​
 +
 +===== Sample Counter Scenario =====
 +
 +<code Java>
 + int x = 131;
 + if((x | 0) == 0){
 + System.out.println("​This might happen"​);​
 + }
 +</​Code>​
 +
 +
 +===== 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
 + 
teaching/labs/mdse/2013/bug_descriptions/jt-bug-cor7.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019