# 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-cor115_and_jt-bug-cor118 [2014/03/10 12:22]behnam_ghavimi teaching:labs:mdse:2013:bug_descriptions:jt-bug-cor115_and_jt-bug-cor118 [2018/05/09 01:59] (current) Both sides previous revision Previous revision 2014/03/10 12:29 Günter Kniesel 2014/03/10 12:22 behnam_ghavimi 2014/03/10 12:22 behnam_ghavimi 2014/03/10 12:21 behnam_ghavimi 2014/03/10 12:21 behnam_ghavimi 2014/03/09 21:36 behnam_ghavimi 2014/03/02 01:15 external edit2014/01/05 01:49 behnam_ghavimi created Next revision Previous revision 2014/03/10 12:29 Günter Kniesel 2014/03/10 12:22 behnam_ghavimi 2014/03/10 12:22 behnam_ghavimi 2014/03/10 12:21 behnam_ghavimi 2014/03/10 12:21 behnam_ghavimi 2014/03/09 21:36 behnam_ghavimi 2014/03/02 01:15 external edit2014/01/05 01:49 behnam_ghavimi created Line 1: Line 1: + ====== Cor 115 and Cor 118 -(SA_SELF_COMPUTATION) ====== + Nonsensical self computation(e.g.,​ x & x) + + ===== Inspired by ===== + + * [[http://​findbugs.sourceforge.net/​bugDescriptions.html#​SA_FIELD_SELF_COMPUTATION | SA_FIELD_SELF_COMPUTATION]] + * [[http://​findbugs.sourceforge.net/​bugDescriptions.html#​SA_LOCAL_SELF_COMPUTATION | SA_LOCAL_SELF_COMPUTATION]] + + ===== Original Description ===== + + **SA_FIELD_SELF_COMPUTATION**:​“This method performs a nonsensical computation of a **field** with another reference to the same field (e.g., x&x or x-x). Because of the nature of the computation,​ this operation doesn'​t seem to make sense, and may indicate a typo or a logic error. Double check the computation.” – 2013-12-09 + + **SA_LOCAL_SELF_COMPUTATION**:​“This method performs a nonsensical computation of a **local variable** with another reference to the same variable (e.g., x&x or x-x). Because of the nature of the computation,​ this operation doesn'​t seem to make sense, and may indicate a typo or a logic error. Double check the computation.” – 2013-12-09 + + ===== Detailed Description ===== + + It makes no sense if we use the same variable (field, local variable or parameter) in both side of the following binary operators: ​ + * -, /, % + * &&, ||, &, |, ^ + + + ===== Sample Problem Scenario ===== + + In following part we have an example: + + public class test { + static int y=0; + public static void findThis(int x) { + y=x-x; ​ //cor118 + x=y-y; ​ //cor115 + } + } + ​ + + ===== Sample Counter Scenario ===== + + + + public static void dontFindThis(int x) { + int y=0; + ​y=x+x;​ + } + ​ + + + ===== 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-cor115_and_jt-bug-cor118.txt · Last modified: 2018/05/09 01:59 (external edit)