Skip to content

Commit 4348241

Browse files
committed
Java: simplify java/alert-suppression-annotations
1 parent 1d415b3 commit 4348241

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

java/ql/src/AlertSuppressionAnnotations.ql

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,10 @@ class SuppressionAnnotation extends SuppressWarningsAnnotation {
3838
}
3939

4040
private Annotation firstAnnotation() {
41-
exists(Annotation m, int i |
42-
result = m and
43-
m = getASiblingAnnotation() and
44-
i = rankOfAnnotation(m) and
45-
not exists(Annotation other | other = getASiblingAnnotation() | rankOfAnnotation(other) < i)
46-
)
47-
}
48-
49-
private int rankOfAnnotation(Annotation m) {
50-
this.getASiblingAnnotation() = m and
51-
exists(Location mLoc, File f, int maxCol | mLoc = m.getLocation() |
52-
f = mLoc.getFile() and
53-
maxCol = max(Location loc | loc.getFile() = f | loc.getStartColumn()) and
54-
result = mLoc.getStartLine() * maxCol + mLoc.getStartColumn()
55-
)
41+
result = min(this.getASiblingAnnotation() as m
42+
order by
43+
m.getLocation().getStartLine(), m.getLocation().getStartColumn()
44+
)
5645
}
5746

5847
/**

0 commit comments

Comments
 (0)