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-cor114_and_jt-bug-cor117 [2014/03/10 12:19]
Günter Kniesel
teaching:labs:mdse:2013:bug_descriptions:jt-bug-cor114_and_jt-bug-cor117 [2018/05/09 01:59] (current)
Line 1: Line 1:
 +====== Cor 114 and Cor 117 (SA_SELF_COMPARISON) ======
  
 +SA: Self comparison
 +
 +===== Inspired by =====
 +
 +  * [[http://​findbugs.sourceforge.net/​bugDescriptions.html#​SA_FIELD_SELF_COMPARISON | SA_FIELD_SELF_COMPARISON]]
 +  * [[http://​findbugs.sourceforge.net/​bugDescriptions.html#​SA_LOCAL_SELF_COMPARISON | SA_LOCAL_SELF_COMPARISON]]
 +
 +===== Original Description =====
 +
 +**SA_LOCAL_SELF_COMPARISON**:​“This method compares a **local variable** with itself, and may indicate a typo or a logic error. Make sure that you are comparing the right things.” – 2013-12-09
 +
 +**SA_FIELD_SELF_COMPARISON**:​ “This method compares a **field** with itself, and may indicate a typo or a logic error. Make sure that you are comparing the right things.” – 2013-12-09
 +
 +===== Detailed Description =====
 +
 +It will happen when we have a condition which compares a 
 +  * field
 +  * local variable or
 +  * parameter
 +with itself. This will always be true or false. So most likely the programmer will have intended to compare with the another element.
 +
 +===== Sample Problem Scenario =====
 +
 +Here we have one example for this problem (it can occur in while or for condition as well):
 +
 +<code Java>
 +public class test {
 +     ​static int y=0;
 +     ​public void selfCompareOfField(Integer x) {
 +        if (y>=y){ x=0; }
 +     }
 +     
 +     ​public void selfCompareOfParameter(int x) {
 +        if (x>=x){ x=0; }
 +     }
 +     
 +     ​public void selfCompareOfLocalVar() {
 +        int x = 0;
 +        if (x>=x){ x=0; }
 +     }
 +
 +}
 +
 +</​Code>​
 +
 +
 +===== Evaluation Results =====
 +
 +^  Benchmark project ​ ^  Precision ​             ^^^  Recall ​               ^^^
 +|                     ​| ​ FB    |  JT    |  Delta  |  FB    |  JT    |  Delta |
 +|  Project ...        |  ...%  |  ...%  |  ...%   ​| ​ ...%  |  ...%  |  ...%  |  ​
 +|  Project ...        |  ...%  |  ...%  |  ...%   ​| ​ ...%  |  ...%  |  ...%  |   
 +FB = FindBugs, JT = JTransformer,​ Delta = JTransformer - FindBugs
 + 
teaching/labs/mdse/2013/bug_descriptions/jt-bug-cor114_and_jt-bug-cor117.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019