1212 *
1313 */
1414public class AccessPathPropagator {
15-
15+
1616 private final Taint taint ;
1717 private final GapDefinition gap ;
1818 private final AccessPathPropagator parent ;
1919 private final boolean inversePropagator ;
20-
20+
2121 private final Stmt stmt ;
2222 private final Abstraction d1 ;
2323 private final Abstraction d2 ;
24-
24+
2525 public AccessPathPropagator (Taint taint ) {
2626 this (taint , null , null );
2727 }
28-
29- public AccessPathPropagator (Taint taint ,
30- GapDefinition gap ,
31- AccessPathPropagator parent ) {
28+
29+ public AccessPathPropagator (Taint taint , Stmt stmt ) {
30+ this (taint , null , null , stmt , null , null );
31+ }
32+
33+ public AccessPathPropagator (Taint taint , GapDefinition gap , AccessPathPropagator parent ) {
3234 this (taint , gap , parent , null , null , null );
33- }
34-
35- public AccessPathPropagator (Taint taint ,
36- GapDefinition gap ,
37- AccessPathPropagator parent ,
38- Stmt stmt ,
39- Abstraction d1 ,
35+ }
36+
37+ public AccessPathPropagator (Taint taint , GapDefinition gap , AccessPathPropagator parent , Stmt stmt , Abstraction d1 ,
4038 Abstraction d2 ) {
4139 this (taint , gap , parent , stmt , d1 , d2 , false );
4240 }
43-
44- public AccessPathPropagator (Taint taint ,
45- GapDefinition gap ,
46- AccessPathPropagator parent ,
47- Stmt stmt ,
48- Abstraction d1 ,
49- Abstraction d2 ,
50- boolean inversePropagator ) {
41+
42+ public AccessPathPropagator (Taint taint , GapDefinition gap , AccessPathPropagator parent , Stmt stmt , Abstraction d1 ,
43+ Abstraction d2 , boolean inversePropagator ) {
5144 this .taint = taint ;
5245 this .gap = gap ;
5346 this .parent = parent ;
@@ -60,86 +53,92 @@ public AccessPathPropagator(Taint taint,
6053 public Taint getTaint () {
6154 return this .taint ;
6255 }
63-
56+
6457 /**
65- * Gets the gap in which the taint is being propagated. This gap
66- * refers to the call stack / current method
67- * @return The gap in which this taint is being propagated
58+ * Gets the gap in which the taint is being propagated. This gap refers to the
59+ * call stack / current method
60+ *
61+ * @return The gap in which this taint is being propagated
6862 */
6963 public GapDefinition getGap () {
7064 return this .gap ;
7165 }
72-
66+
7367 /**
7468 * Gets the parent of this AccessPathPropagator. This is the link to the
75- * previous method in the call stack before we descended into the current
76- * gap. If the gap is null, the parent must be null as well.
69+ * previous method in the call stack before we descended into the current gap.
70+ * If the gap is null, the parent must be null as well.
71+ *
7772 * @return The parent of this AccessPathPropagator
7873 */
7974 public AccessPathPropagator getParent () {
8075 return this .parent ;
8176 }
82-
77+
8378 /**
84- * Gets the statement with which this propagator is associated. A statement
85- * only exists for root-level propagators and indicates the original call
86- * for which the summary application was started.
79+ * Gets the statement with which this propagator is associated. A statement only
80+ * exists for root-level propagators and indicates the original call for which
81+ * the summary application was started.
82+ *
8783 * @return The statement associated with this propagator
8884 */
8985 public Stmt getStmt () {
9086 return this .stmt ;
9187 }
92-
88+
9389 /**
94- * Gets the context abstraction with which this propagator is associated.
95- * This value only exists for root-level propagators.
90+ * Gets the context abstraction with which this propagator is associated. This
91+ * value only exists for root-level propagators.
92+ *
9693 * @return The context abstraction associated with this propagator
9794 */
9895 public Abstraction getD1 () {
9996 return this .d1 ;
10097 }
101-
98+
10299 /**
103- * Gets the abstraction for which the taint wrapper was originally called.
104- * This value only exists for root-level propagators.
100+ * Gets the abstraction for which the taint wrapper was originally called. This
101+ * value only exists for root-level propagators.
102+ *
105103 * @return The abstraction for which the taint wrapper was originally called
106104 */
107105 public Abstraction getD2 () {
108106 return this .d2 ;
109107 }
110-
108+
111109 /**
112110 * Creates a copy of this AccessPathPropagator with a new taint
113- * @param newTaint The taint that the copied AccessPathPropagator shall
114- * have
115- * @return An AccessPathPropagator that is identical to the current one,
116- * except for the taint which is replaced by the given value
111+ *
112+ * @param newTaint The taint that the copied AccessPathPropagator shall have
113+ * @return An AccessPathPropagator that is identical to the current one, except
114+ * for the taint which is replaced by the given value
117115 */
118116 public AccessPathPropagator copyWithNewTaint (Taint newTaint ) {
119- return new AccessPathPropagator (newTaint , gap , parent , stmt , d1 , d2 ,
120- inversePropagator );
117+ return new AccessPathPropagator (newTaint , gap , parent , stmt , d1 , d2 , inversePropagator );
121118 }
122-
119+
123120 /**
124121 * Gets whether this is an inverse propagator used for identifying aliasing
125122 * relationships
126- * @return True if this is an inverse propagator for which summary flows
127- * need to reversed, otherwise false
123+ *
124+ * @return True if this is an inverse propagator for which summary flows need to
125+ * reversed, otherwise false
128126 */
129127 public boolean isInversePropagator () {
130128 return this .inversePropagator ;
131129 }
132-
130+
133131 /**
134132 * Creates a new access path propagator that is the inverse of this one.
135133 * Invariant a.deriveInversePropagator().deriveInversePropagator().equals(a)
134+ *
136135 * @return The inverse propagator of this one
137136 */
138137 public AccessPathPropagator deriveInversePropagator () {
139- return new AccessPathPropagator (this .taint , this .gap , this .parent ,
140- this . stmt , this . d1 , this . d2 , !this .inversePropagator );
138+ return new AccessPathPropagator (this .taint , this .gap , this .parent , this . stmt , this . d1 , this . d2 ,
139+ !this .inversePropagator );
141140 }
142-
141+
143142 @ Override
144143 public String toString () {
145144 return (inversePropagator ? "_" : "" ) + this .taint .toString ();
@@ -149,20 +148,14 @@ public String toString() {
149148 public int hashCode () {
150149 final int prime = 31 ;
151150 int result = 1 ;
152- result = prime * result
153- + ((taint == null ) ? 0 : taint .hashCode ());
154- result = prime * result
155- + ((gap == null ) ? 0 : gap .hashCode ());
151+ result = prime * result + ((taint == null ) ? 0 : taint .hashCode ());
152+ result = prime * result + ((gap == null ) ? 0 : gap .hashCode ());
156153// result = prime * result
157154// + ((parent == null) ? 0 : parent.hashCode());
158- result = prime * result
159- + ((stmt == null ) ? 0 : stmt .hashCode ());
160- result = prime * result
161- + ((d1 == null ) ? 0 : d1 .hashCode ());
162- result = prime * result
163- + ((d2 == null ) ? 0 : d2 .hashCode ());
164- result = prime * result
165- + (inversePropagator ? 1 : 0 );
155+ result = prime * result + ((stmt == null ) ? 0 : stmt .hashCode ());
156+ result = prime * result + ((d1 == null ) ? 0 : d1 .hashCode ());
157+ result = prime * result + ((d2 == null ) ? 0 : d2 .hashCode ());
158+ result = prime * result + (inversePropagator ? 1 : 0 );
166159 return result ;
167160 }
168161
@@ -209,5 +202,5 @@ public boolean equals(Object obj) {
209202 return false ;
210203 return true ;
211204 }
212-
205+
213206}
0 commit comments