Comparison of Strings using == or !=
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){
yeah we should probably clean this up. Error Prone's ReferenceEquality check catches similar issues.