mirror of
https://github.com/github/codeql.git
synced 2026-04-22 07:15:15 +02:00
Add test for Java extracting ErrorType
This commit is contained in:
1
java/ql/test/library-tests/errortype/ErrorTypes.expected
Normal file
1
java/ql/test/library-tests/errortype/ErrorTypes.expected
Normal file
@@ -0,0 +1 @@
|
||||
| Test.java:7:12:7:14 | nsc |
|
||||
3
java/ql/test/library-tests/errortype/ErrorTypes.ql
Normal file
3
java/ql/test/library-tests/errortype/ErrorTypes.ql
Normal file
@@ -0,0 +1,3 @@
|
||||
import java
|
||||
|
||||
select any(Expr e | e.getType() instanceof ErrorType)
|
||||
14
java/ql/test/library-tests/errortype/PrintAst.expected
Normal file
14
java/ql/test/library-tests/errortype/PrintAst.expected
Normal 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
|
||||
1
java/ql/test/library-tests/errortype/PrintAst.qlref
Normal file
1
java/ql/test/library-tests/errortype/PrintAst.qlref
Normal file
@@ -0,0 +1 @@
|
||||
semmle/code/java/PrintAst.ql
|
||||
10
java/ql/test/library-tests/errortype/Test.java
Normal file
10
java/ql/test/library-tests/errortype/Test.java
Normal file
@@ -0,0 +1,10 @@
|
||||
import nosuchpackage.NoSuchClass;
|
||||
|
||||
public class Test {
|
||||
|
||||
public NoSuchClass test() {
|
||||
NoSuchClass nsc = new NoSuchClass();
|
||||
return nsc;
|
||||
}
|
||||
|
||||
}
|
||||
1
java/ql/test/library-tests/errortype/options
Normal file
1
java/ql/test/library-tests/errortype/options
Normal file
@@ -0,0 +1 @@
|
||||
//semmle-extractor-options: --no-strict-javac-errors --javac-args -source 17 -target 17
|
||||
Reference in New Issue
Block a user