Skip to content

Commit 3fa1f17

Browse files
authored
Java: really return a unique location for non-source entities
This was always supposed to pick one of several candidate non-source locations (usually for a generic type instantiation), but since `getFile().toString()` just produces the basename of the class file actually the results would almost always tie and all of the candidate locations would be returned. Use the full class file path as a tiebreaker instead.
1 parent 3165bab commit 3fa1f17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private predicate fixedHasLocation(Top l, Location loc, File f) {
216216
min(Location candidateLoc |
217217
hasLocation(l, candidateLoc)
218218
|
219-
candidateLoc order by candidateLoc.getFile().toString()
219+
candidateLoc order by candidateLoc.getFile().getAbsolutePath()
220220
) and
221221
not hasSourceLocation(l, _, _) and
222222
locations_default(loc, f, _, _, _, _)

0 commit comments

Comments
 (0)