WALA icon indicating copy to clipboard operation
WALA copied to clipboard

Comparison of Strings using == or !=

Open waooog opened this issue 8 years ago • 1 comments

My tool has scanned the whole codebase of WALA and found there are six practice issues of string comparison, in which strings are compared by using ==/!= instead of equals( ).

Path: WALA/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/analysis/Analyzer.java Code: if (t != st[j]) {

Path: WALA/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/analysis/Analyzer.java Code: if (t != ls[lj]) {

Path: WALA/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/analysis/ClassHierarchy.java Code: if (element != element2 && isSubtypeOf(hierarchy, element2, element) == YES) {

Path: WALA/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/AttributeReader.java Code: if (expectedName != n && !expectedName.equals(n)) {

Path: WALA/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/vis/JsPaPanel.java Code: if (node == cgNodesRoot){

Path: WALA/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/vis/JsPaPanel.java Code: else if (node == globalsRoot){

waooog avatar Nov 09 '17 16:11 waooog

yeah we should probably clean this up. Error Prone's ReferenceEquality check catches similar issues.

msridhar avatar Nov 09 '17 18:11 msridhar