Skip to content

Commit 0c1994e

Browse files
committed
added a convenience method and some javadoc
1 parent 0921d20 commit 0c1994e

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

soot-infoflow/src/soot/jimple/infoflow/data/AccessPath.java

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,22 +344,57 @@ public boolean equalsWithoutContext(Object obj) {
344344
return true;
345345
}
346346

347+
/**
348+
* Checks whether this access path references a static field
349+
*
350+
* @return True if this access path references a static field, false otherwise
351+
*/
347352
public boolean isStaticFieldRef() {
348353
return value == null && fragments != null && fragments.length > 0;
349354
}
350355

356+
/**
357+
* Checks whether this access path references an instance field
358+
*
359+
* @return True if this access path references an instance field, false
360+
* otherwise
361+
*/
351362
public boolean isInstanceFieldRef() {
352363
return value != null && fragments != null && fragments.length > 0;
353364
}
354365

366+
/**
367+
* Checks whether this access path references a field, regardless of whether it
368+
* is a static or instance field
369+
*
370+
* @return True if this access path references a field, false otherwise
371+
*/
355372
public boolean isFieldRef() {
356373
return fragments != null && fragments.length > 0;
357374
}
358375

376+
/**
377+
* Checks whether this access path only references the base local and no fields
378+
*
379+
* @return True if this access path only references the base local and no
380+
* fields, false otherwise
381+
*/
359382
public boolean isLocal() {
360383
return value != null && value instanceof Local && (fragments == null || fragments.length == 0);
361384
}
362385

386+
/**
387+
* Checks whether this access path references an instance of an object,
388+
* regardless of whether the object as such or an instance field on the object
389+
* is referenced
390+
*
391+
* @return True if this access path references an instance of an object, false
392+
* otherwise
393+
*/
394+
public boolean isInstanceRef() {
395+
return value != null && value instanceof Local;
396+
}
397+
363398
@Override
364399
public String toString() {
365400
String str = "";
@@ -433,7 +468,8 @@ public boolean entails(AccessPath a2) {
433468
if (this.value != null && !this.value.equals(a2.value))
434469
return false;
435470

436-
// If other taints all subfields but this one does not, this does not entail other
471+
// If other taints all subfields but this one does not, this does not entail
472+
// other
437473
if (!this.taintSubFields && a2.taintSubFields)
438474
return false;
439475

@@ -587,7 +623,9 @@ public static AccessPath getZeroAccessPath() {
587623
}
588624

589625
/**
590-
* Creates a new access path that is effectively the same, but based on another local as plain value
626+
* Creates a new access path that is effectively the same, but based on another
627+
* local as plain value
628+
*
591629
* @param newValue the new value
592630
* @return the rebased access path
593631
*/

0 commit comments

Comments
 (0)