Skip to content

Commit b6507e7

Browse files
committed
Add test for a buildless project that doesn't compile cleanly
1 parent 5d55265 commit b6507e7

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import abc.Def;
2+
3+
public class Test {
4+
5+
public static void test() {
6+
7+
Def.someMethod();
8+
(new Def()).member().chained();
9+
10+
}
11+
12+
}
13+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"markdownMessage": "Because no usable build tool (Gradle, Maven, etc) was found, build scripts could not be queried for guidance about the appropriate JDK version for the code being extracted, or precise dependency information. The default JDK will be used, and external dependencies will be inferred from the Java package names used.",
3+
"severity": "unknown",
4+
"source": {
5+
"extractorName": "java",
6+
"id": "java/autobuilder/buildless/no-build-tool-advice",
7+
"name": "Java buildless mode found no usable build tool"
8+
},
9+
"visibility": {
10+
"cliSummaryTable": true,
11+
"statusPage": false,
12+
"telemetry": true
13+
}
14+
}
15+
{
16+
"markdownMessage": "Java buildless mode used the system default JDK.",
17+
"severity": "unknown",
18+
"source": {
19+
"extractorName": "java",
20+
"id": "java/autobuilder/buildless/jdk-system-default",
21+
"name": "Java buildless mode used the system default JDK"
22+
},
23+
"visibility": {
24+
"cliSummaryTable": true,
25+
"statusPage": false,
26+
"telemetry": true
27+
}
28+
}
29+
{
30+
"markdownMessage": "Java was extracted in buildless mode. This means that all Java source in the working directory will be scanned, with build tools such as Maven and Gradle only contributing information about external dependencies.",
31+
"severity": "note",
32+
"source": {
33+
"extractorName": "java",
34+
"id": "java/autobuilder/buildless/mode-active",
35+
"name": "Java was extracted in buildless mode"
36+
},
37+
"visibility": {
38+
"cliSummaryTable": true,
39+
"statusPage": true,
40+
"telemetry": true
41+
}
42+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
callTargets
2+
#select
3+
| Test.java:5:17:5:20 | void | file://:0:0:0:0 | void |
4+
| Test.java:7:5:7:7 | <TypeAccess of ErrorType> | file://:0:0:0:0 | <CodeQL error type> |
5+
| Test.java:7:5:7:20 | <Call to unknown method> | file://:0:0:0:0 | <CodeQL error type> |
6+
| Test.java:8:5:8:24 | <Call to unknown method> | file://:0:0:0:0 | <CodeQL error type> |
7+
| Test.java:8:5:8:34 | <Call to unknown method> | file://:0:0:0:0 | <CodeQL error type> |
8+
| Test.java:8:6:8:14 | <ClassInstanceExpr that calls a missing constructor> | file://:0:0:0:0 | <CodeQL error type> |
9+
| Test.java:8:10:8:12 | <TypeAccess of ErrorType> | file://:0:0:0:0 | <CodeQL error type> |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import sys
2+
3+
from create_database_utils import *
4+
from diagnostics_test_utils import *
5+
6+
run_codeql_database_create([], lang="java", extra_env={"CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS": "true"})
7+
8+
check_diagnostics()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import java
2+
3+
query Callable callTargets(MethodCall mc) {
4+
result = mc.getCallee()
5+
}
6+
7+
from Expr e
8+
where e.getFile().getBaseName() = "Test.java"
9+
select e, e.getType()
10+

0 commit comments

Comments
 (0)