Java: add alert-suppression query for @SuppressWarnings("lgtm[...]")

This commit is contained in:
yh-semmle
2019-10-12 18:02:37 -04:00
parent 176d7672a1
commit b2bc8382b0
5 changed files with 103 additions and 0 deletions

View File

@@ -18,6 +18,12 @@ class OverrideAnnotation extends Annotation {
class SuppressWarningsAnnotation extends Annotation {
SuppressWarningsAnnotation() { this.getType().hasQualifiedName("java.lang", "SuppressWarnings") }
/** Gets the `StringLiteral` of a warning suppressed by this annotation. */
StringLiteral getASuppressedWarningLiteral() {
result = this.getAValue() or
result = this.getAValue().(ArrayInit).getAnInit()
}
/** Gets the name of a warning suppressed by this annotation. */
string getASuppressedWarning() {
result = this.getAValue().(StringLiteral).getLiteral() or