From 8f940c311ae41b7ca30837dd984db9d2cfe2a27c Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 14 Sep 2023 14:35:41 +0100 Subject: [PATCH] Update expectations and add expected diagnostics --- .../test/library-tests/errortype-with-params/Diags.expected | 2 +- java/ql/test/library-tests/errortype-with-params/Test.java | 2 ++ java/ql/test/library-tests/errortype/Diags.expected | 3 +++ java/ql/test/library-tests/errortype/Diags.ql | 4 ++++ java/ql/test/library-tests/errortype/PrintAst.expected | 3 ++- java/ql/test/library-tests/errortype/Test.java | 4 ++++ .../test/library-tests/module-info-wrong-name/Diags.expected | 2 +- .../module-info-wrong-name/module-info-wrong-name.java | 2 ++ 8 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 java/ql/test/library-tests/errortype/Diags.expected create mode 100644 java/ql/test/library-tests/errortype/Diags.ql diff --git a/java/ql/test/library-tests/errortype-with-params/Diags.expected b/java/ql/test/library-tests/errortype-with-params/Diags.expected index 5bbf0362cfa..7f1b6e729f7 100644 --- a/java/ql/test/library-tests/errortype-with-params/Diags.expected +++ b/java/ql/test/library-tests/errortype-with-params/Diags.expected @@ -1 +1 @@ -| Test.java:0:0:0:0 | 1 | +| file://:0:0:0:0 | 1 errors during annotation processing | diff --git a/java/ql/test/library-tests/errortype-with-params/Test.java b/java/ql/test/library-tests/errortype-with-params/Test.java index 9255d9a1ec3..384d2395a2a 100644 --- a/java/ql/test/library-tests/errortype-with-params/Test.java +++ b/java/ql/test/library-tests/errortype-with-params/Test.java @@ -1 +1,3 @@ public class Test implements Unavailable { } + +// Diagnostic Matches: 1 errors during annotation processing diff --git a/java/ql/test/library-tests/errortype/Diags.expected b/java/ql/test/library-tests/errortype/Diags.expected new file mode 100644 index 00000000000..6dd6f1d91a1 --- /dev/null +++ b/java/ql/test/library-tests/errortype/Diags.expected @@ -0,0 +1,3 @@ +| Test.java:0:0:0:0 | 2 javac errors | +| Test.java:6:23:6:39 | Unexpected symbol for constructor: new NoSuchClass() | +| file://:0:0:0:0 | 2 errors during annotation processing | diff --git a/java/ql/test/library-tests/errortype/Diags.ql b/java/ql/test/library-tests/errortype/Diags.ql new file mode 100644 index 00000000000..1774650beff --- /dev/null +++ b/java/ql/test/library-tests/errortype/Diags.ql @@ -0,0 +1,4 @@ +import java +import semmle.code.java.Diagnostics + +select any(Diagnostic d | not d.toString().matches("Not rewriting trap file for%")) diff --git a/java/ql/test/library-tests/errortype/PrintAst.expected b/java/ql/test/library-tests/errortype/PrintAst.expected index 76609c9cdeb..d0780a453e9 100644 --- a/java/ql/test/library-tests/errortype/PrintAst.expected +++ b/java/ql/test/library-tests/errortype/PrintAst.expected @@ -1,5 +1,4 @@ Test.java: -# 6| [TypeAccess] NoSuchClass # 0| [CompilationUnit] Test #-----| -1: (Imports) # 1| 1: [ImportType] import NoSuchClass @@ -10,5 +9,7 @@ Test.java: # 6| 0: [LocalVariableDeclStmt] var ...; # 6| 0: [TypeAccess] NoSuchClass # 6| 1: [LocalVariableDeclExpr] nsc +# 6| 0: [ClassInstanceExpr] +# 6| -3: [TypeAccess] NoSuchClass # 7| 1: [ReturnStmt] return ... # 7| 0: [VarAccess] nsc diff --git a/java/ql/test/library-tests/errortype/Test.java b/java/ql/test/library-tests/errortype/Test.java index 67f40611c90..25fc6591972 100644 --- a/java/ql/test/library-tests/errortype/Test.java +++ b/java/ql/test/library-tests/errortype/Test.java @@ -8,3 +8,7 @@ public class Test { } } + +// Diagnostic Matches: Unexpected symbol for constructor: new NoSuchClass() +// Diagnostic Matches: 2 javac errors +// Diagnostic Matches: 2 errors during annotation processing diff --git a/java/ql/test/library-tests/module-info-wrong-name/Diags.expected b/java/ql/test/library-tests/module-info-wrong-name/Diags.expected index 03a518c430b..12201a5eaba 100644 --- a/java/ql/test/library-tests/module-info-wrong-name/Diags.expected +++ b/java/ql/test/library-tests/module-info-wrong-name/Diags.expected @@ -1 +1 @@ -| module-info-wrong-name.java:0:0:0:0 | 2 | +| file://:0:0:0:0 | 2 errors during annotation processing | diff --git a/java/ql/test/library-tests/module-info-wrong-name/module-info-wrong-name.java b/java/ql/test/library-tests/module-info-wrong-name/module-info-wrong-name.java index 51d51bce394..3adfbc27708 100644 --- a/java/ql/test/library-tests/module-info-wrong-name/module-info-wrong-name.java +++ b/java/ql/test/library-tests/module-info-wrong-name/module-info-wrong-name.java @@ -1,3 +1,5 @@ module module.with.wrong.name { exports somepkg; } + +// Diagnostic Matches: 2 errors during annotation processing