Skip to content

Commit 13c2ef8

Browse files
committed
Java: PrintAst: Improve the ranking or callables
We now look not only at how many parameters each callable has, but what its full signature is. This allows us to give a consistent order to Test(Throwable) { ... } Test(String) { ... }
1 parent a9e5b34 commit 13c2ef8

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

java/ql/lib/semmle/code/java/PrintAst.qll

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -537,17 +537,13 @@ final class ClassInterfaceNode extends ElementNode {
537537
or
538538
childIndex >= 0 and
539539
result.(ElementNode).getElement() =
540-
rank[childIndex](Element e, string file, int line, int column, string childStr, int argCount |
540+
rank[childIndex](Element e, string file, int line, int column, string childStr, string sig |
541541
e = this.getADeclaration() and
542542
locationSortKeys(e, file, line, column) and
543543
childStr = e.toString() and
544-
(
545-
if e instanceof Callable
546-
then argCount = e.(Callable).getNumberOfParameters()
547-
else argCount = 0
548-
)
544+
(if e instanceof Callable then sig = e.(Callable).getStringSignature() else sig = "")
549545
|
550-
e order by file, line, column, childStr, argCount
546+
e order by file, line, column, childStr, sig
551547
)
552548
}
553549
}

0 commit comments

Comments
 (0)