mirror of
https://github.com/github/codeql.git
synced 2026-04-21 06:55:31 +02:00
Add test for a buildless project that doesn't compile cleanly
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import abc.Def;
|
||||
|
||||
public class Test {
|
||||
|
||||
public static void test() {
|
||||
|
||||
Def.someMethod();
|
||||
(new Def()).member().chained();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"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.",
|
||||
"severity": "unknown",
|
||||
"source": {
|
||||
"extractorName": "java",
|
||||
"id": "java/autobuilder/buildless/no-build-tool-advice",
|
||||
"name": "Java buildless mode found no usable build tool"
|
||||
},
|
||||
"visibility": {
|
||||
"cliSummaryTable": true,
|
||||
"statusPage": false,
|
||||
"telemetry": true
|
||||
}
|
||||
}
|
||||
{
|
||||
"markdownMessage": "Java buildless mode used the system default JDK.",
|
||||
"severity": "unknown",
|
||||
"source": {
|
||||
"extractorName": "java",
|
||||
"id": "java/autobuilder/buildless/jdk-system-default",
|
||||
"name": "Java buildless mode used the system default JDK"
|
||||
},
|
||||
"visibility": {
|
||||
"cliSummaryTable": true,
|
||||
"statusPage": false,
|
||||
"telemetry": true
|
||||
}
|
||||
}
|
||||
{
|
||||
"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.",
|
||||
"severity": "note",
|
||||
"source": {
|
||||
"extractorName": "java",
|
||||
"id": "java/autobuilder/buildless/mode-active",
|
||||
"name": "Java was extracted in buildless mode"
|
||||
},
|
||||
"visibility": {
|
||||
"cliSummaryTable": true,
|
||||
"statusPage": true,
|
||||
"telemetry": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
callTargets
|
||||
#select
|
||||
| Test.java:5:17:5:20 | void | file://:0:0:0:0 | void |
|
||||
| Test.java:7:5:7:7 | <TypeAccess of ErrorType> | file://:0:0:0:0 | <CodeQL error type> |
|
||||
| Test.java:7:5:7:20 | <Call to unknown method> | file://:0:0:0:0 | <CodeQL error type> |
|
||||
| Test.java:8:5:8:24 | <Call to unknown method> | file://:0:0:0:0 | <CodeQL error type> |
|
||||
| Test.java:8:5:8:34 | <Call to unknown method> | file://:0:0:0:0 | <CodeQL error type> |
|
||||
| Test.java:8:6:8:14 | <ClassInstanceExpr that calls a missing constructor> | file://:0:0:0:0 | <CodeQL error type> |
|
||||
| Test.java:8:10:8:12 | <TypeAccess of ErrorType> | file://:0:0:0:0 | <CodeQL error type> |
|
||||
@@ -0,0 +1,8 @@
|
||||
import sys
|
||||
|
||||
from create_database_utils import *
|
||||
from diagnostics_test_utils import *
|
||||
|
||||
run_codeql_database_create([], lang="java", extra_env={"CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS": "true"})
|
||||
|
||||
check_diagnostics()
|
||||
@@ -0,0 +1,10 @@
|
||||
import java
|
||||
|
||||
query Callable callTargets(MethodCall mc) {
|
||||
result = mc.getCallee()
|
||||
}
|
||||
|
||||
from Expr e
|
||||
where e.getFile().getBaseName() = "Test.java"
|
||||
select e, e.getType()
|
||||
|
||||
Reference in New Issue
Block a user