mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Merge pull request #13751 from igfoo/igfoo/getCompilationInfo
Java: Improve the diagnostics consistency query
This commit is contained in:
@@ -28,7 +28,8 @@ string diagnosticMessage(Diagnostic d) {
|
||||
// something is fixed.
|
||||
query predicate unusedDiagnosticException(DiagnosticException de) { not exists(de.getException()) }
|
||||
|
||||
query predicate unexpectedDiagnostic(Diagnostic d, string s) {
|
||||
query predicate unexpectedDiagnostic(Compilation c, int f, int i, Diagnostic d, string s) {
|
||||
d.getCompilationInfo(c, f, i) and
|
||||
s = diagnosticMessage(d) and
|
||||
not d = any(DiagnosticException de).getException()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: feature
|
||||
---
|
||||
* A `Diagnostic.getCompilationInfo()` predicate has been added.
|
||||
@@ -9,6 +9,11 @@ class Diagnostic extends @diagnostic {
|
||||
/** Gets the compilation that generated this diagnostic. */
|
||||
Compilation getCompilation() { diagnostic_for(this, result, _, _) }
|
||||
|
||||
/** Gets the compilation information for this diagnostic. */
|
||||
predicate getCompilationInfo(Compilation c, int fileNumber, int diagnosticNumber) {
|
||||
diagnostic_for(this, c, fileNumber, diagnosticNumber)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the program that generated this diagnostic.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user