Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b4ecfae

Browse files
aschackmullhvitved
authored andcommitted
Dataflow: Remove inconsistent AccessPath.getType().
1 parent d88c551 commit b4ecfae

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,9 +2138,6 @@ private newtype TPathNode =
21382138
* tracked object. The final type indicates the type of the tracked object.
21392139
*/
21402140
abstract private class AccessPath extends TAccessPath {
2141-
/** Gets the type of this access path. */
2142-
abstract DataFlowType getType();
2143-
21442141
/** Gets the head of this access path, if any. */
21452142
abstract TypedContent getHead();
21462143

@@ -2174,7 +2171,7 @@ private class AccessPathNil extends AccessPath, TAccessPathNil {
21742171

21752172
AccessPathNil() { this = TAccessPathNil(t) }
21762173

2177-
override DataFlowType getType() { result = t }
2174+
DataFlowType getType() { result = t }
21782175

21792176
override TypedContent getHead() { none() }
21802177

@@ -2195,8 +2192,6 @@ private class AccessPathCons extends AccessPath, TAccessPathCons {
21952192

21962193
AccessPathCons() { this = TAccessPathCons(head, tail) }
21972194

2198-
override DataFlowType getType() { result = tail.getType() }
2199-
22002195
override TypedContent getHead() { result = head }
22012196

22022197
override AccessPath getTail() { result = tail }
@@ -2212,14 +2207,16 @@ private class AccessPathCons extends AccessPath, TAccessPathCons {
22122207
override int length() { result = 1 + tail.length() }
22132208

22142209
private string toStringImpl() {
2215-
tail = TAccessPathNil(_) and
2216-
result = head.toString()
2210+
exists(DataFlowType t |
2211+
tail = TAccessPathNil(t) and
2212+
result = head.toString() + "]" + concat(" : " + ppReprType(t))
2213+
)
22172214
or
22182215
result = head + ", " + tail.(AccessPathCons).toStringImpl()
22192216
}
22202217

22212218
override string toString() {
2222-
result = "[" + this.toStringImpl() + "]" + concat(" : " + ppReprType(this.getType()))
2219+
result = "[" + this.toStringImpl()
22232220
}
22242221
}
22252222

0 commit comments

Comments
 (0)