Skip to content

Commit ec95cba

Browse files
committed
PrintAst: Tie-break multiple class members created at the same source location
Otherwise Kotlin introducing a getter, setter and field declaration based on the same property tied in the sort order, and so could be output in different orders on different machines.
1 parent 0d0d240 commit ec95cba

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,12 @@ final class ClassInterfaceNode extends ElementNode {
534534
or
535535
childIndex >= 0 and
536536
result.(ElementNode).getElement() =
537-
rank[childIndex](Element e, string file, int line, int column |
538-
e = this.getADeclaration() and locationSortKeys(e, file, line, column)
537+
rank[childIndex](Element e, string file, int line, int column, string childStr |
538+
e = this.getADeclaration() and
539+
locationSortKeys(e, file, line, column) and
540+
childStr = result.toString()
539541
|
540-
e order by file, line, column
542+
e order by file, line, column, childStr
541543
)
542544
}
543545
}

0 commit comments

Comments
 (0)