Java: try simplification of paramsString and paramsStringPart

This commit is contained in:
Jami Cogswell
2023-01-10 13:35:52 -05:00
parent 65aa064838
commit faae811be7

View File

@@ -336,18 +336,6 @@ private predicate elementSpec(
neutralModel(package, type, name, signature, _) and ext = "" and subtypes = false
}
private string paramsStringPart(Callable c, int i) {
i = -1 and result = "("
or
exists(int n, string p | c.getParameterType(n).getErasure().toString() = p |
i = 2 * n and result = p
or
i = 2 * n - 1 and result = "," and n != 0
)
or
i = 2 * c.getNumberOfParameters() and result = ")"
}
/**
* Gets a parenthesized string containing all parameter types of this callable, separated by a comma.
*
@@ -355,7 +343,10 @@ private string paramsStringPart(Callable c, int i) {
* Parameter types are represented by their type erasure.
*/
cached
string paramsString(Callable c) { result = concat(int i | | paramsStringPart(c, i) order by i) }
string paramsString(Callable c) {
result =
"(" + concat(int i | | c.getParameterType(i).getErasure().toString(), "," order by i) + ")"
}
private Element interpretElement0(
string package, string type, boolean subtypes, string name, string signature