Java: simplify `java/alert-suppression-annotations`

This commit is contained in:
yh-semmle 2019-10-18 09:45:49 -04:00
Родитель 1d415b3680
Коммит 4348241f72
1 изменённых файлов: 4 добавлений и 15 удалений

Просмотреть файл

@ -38,21 +38,10 @@ class SuppressionAnnotation extends SuppressWarningsAnnotation {
}
private Annotation firstAnnotation() {
exists(Annotation m, int i |
result = m and
m = getASiblingAnnotation() and
i = rankOfAnnotation(m) and
not exists(Annotation other | other = getASiblingAnnotation() | rankOfAnnotation(other) < i)
)
}
private int rankOfAnnotation(Annotation m) {
this.getASiblingAnnotation() = m and
exists(Location mLoc, File f, int maxCol | mLoc = m.getLocation() |
f = mLoc.getFile() and
maxCol = max(Location loc | loc.getFile() = f | loc.getStartColumn()) and
result = mLoc.getStartLine() * maxCol + mLoc.getStartColumn()
)
result = min(this.getASiblingAnnotation() as m
order by
m.getLocation().getStartLine(), m.getLocation().getStartColumn()
)
}
/**