Skip to content

Commit b6805c6

Browse files
authored
Merge pull request github#11863 from jcogs33/jcogs33/update-paramsString
Java: update paramsString
2 parents c666f9c + c725c44 commit b6805c6

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -336,26 +336,17 @@ private predicate elementSpec(
336336
neutralModel(package, type, name, signature, _) and ext = "" and subtypes = false
337337
}
338338

339-
private string paramsStringPart(Callable c, int i) {
340-
i = -1 and result = "("
341-
or
342-
exists(int n, string p | c.getParameterType(n).getErasure().toString() = p |
343-
i = 2 * n and result = p
344-
or
345-
i = 2 * n - 1 and result = "," and n != 0
346-
)
347-
or
348-
i = 2 * c.getNumberOfParameters() and result = ")"
349-
}
350-
351339
/**
352340
* Gets a parenthesized string containing all parameter types of this callable, separated by a comma.
353341
*
354-
* Returns the empty string if the callable has no parameters.
342+
* Returns an empty parenthesized string if the callable has no parameters.
355343
* Parameter types are represented by their type erasure.
356344
*/
357345
cached
358-
string paramsString(Callable c) { result = concat(int i | | paramsStringPart(c, i) order by i) }
346+
string paramsString(Callable c) {
347+
result =
348+
"(" + concat(int i | | c.getParameterType(i).getErasure().toString(), "," order by i) + ")"
349+
}
359350

360351
private Element interpretElement0(
361352
string package, string type, boolean subtypes, string name, string signature

0 commit comments

Comments
 (0)