Add test for Java extracting ErrorType

This commit is contained in:
Chris Smowton
2023-08-16 16:51:24 +01:00
parent c0f8973749
commit 4b5651bde9
6 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1 @@
| Test.java:7:12:7:14 | nsc |

View File

@@ -0,0 +1,3 @@
import java
select any(Expr e | e.getType() instanceof ErrorType)

View File

@@ -0,0 +1,14 @@
Test.java:
# 6| [TypeAccess] NoSuchClass
# 0| [CompilationUnit] Test
#-----| -1: (Imports)
# 1| 1: [ImportType] import NoSuchClass
# 3| 1: [Class] Test
# 5| 2: [Method] test
# 5| 3: [TypeAccess] NoSuchClass
# 5| 5: [BlockStmt] { ... }
# 6| 0: [LocalVariableDeclStmt] var ...;
# 6| 0: [TypeAccess] NoSuchClass
# 6| 1: [LocalVariableDeclExpr] nsc
# 7| 1: [ReturnStmt] return ...
# 7| 0: [VarAccess] nsc

View File

@@ -0,0 +1 @@
semmle/code/java/PrintAst.ql

View File

@@ -0,0 +1,10 @@
import nosuchpackage.NoSuchClass;
public class Test {
public NoSuchClass test() {
NoSuchClass nsc = new NoSuchClass();
return nsc;
}
}

View File

@@ -0,0 +1 @@
//semmle-extractor-options: --no-strict-javac-errors --javac-args -source 17 -target 17