/** * Gets a copy of this access path, but drops the last field. If this access * path has no fields, the identity is returned. * * @return A copy of this access path with the last field being dropped. */ public AccessPath dropLastField() { if (fields == null || fields.length == 0) return this; final SootField[] newFields; final Type[] newTypes; if (fields.length > 1) { newFields = new SootField[fields.length - 1]; System.arraycopy(fields, 0, newFields, 0, fields.length - 1); newTypes = new Type[fields.length - 1]; System.arraycopy(fieldTypes, 0, newTypes, 0, fields.length - 1); } else { newFields = null; newTypes = null; } return new AccessPath(value, newFields, baseType, newTypes, taintSubFields, cutOffApproximation, arrayTaintType, canHaveImmutableAliases); }
@Override public AccessPath clone() { // The empty access path is a singleton if (this == emptyAccessPath) return this; AccessPath a = new AccessPath(value, fields, baseType, fieldTypes, taintSubFields, cutOffApproximation, arrayTaintType, canHaveImmutableAliases); assert a.equals(this); return a; }
/** * Creates the access path that is used in the zero abstraction * * @return The access path that is used in the zero abstraction */ static AccessPath getZeroAccessPath() { if (zeroAccessPath == null) zeroAccessPath = new AccessPath(Jimple.v().newLocal("zero", NullType.v()), null, NullType.v(), null, false, false, ArrayTaintType.ContentsAndLength, false); return zeroAccessPath; }
return new AccessPath(value, fields, baseType, fieldTypes, taintSubFields, cutOffApproximation, arrayTaintType, canHaveImmutableAliases);