diff --git a/java/ql/src/utils/modeleditor/ApplicationModeEndpoints.ql b/java/ql/src/utils/modeleditor/ApplicationModeEndpoints.ql index 8b3d034bb3e..653fdc0c824 100644 --- a/java/ql/src/utils/modeleditor/ApplicationModeEndpoints.ql +++ b/java/ql/src/utils/modeleditor/ApplicationModeEndpoints.ql @@ -14,14 +14,12 @@ private Call aUsage(ExternalEndpoint endpoint) { result.getCallee().getSourceDeclaration() = endpoint } -from - ExternalEndpoint endpoint, string apiName, boolean supported, Call usage, string type, - string classification +from ExternalEndpoint endpoint, boolean supported, Call usage, string type, string classification where - apiName = endpoint.getApiName() and supported = isSupported(endpoint) and usage = aUsage(endpoint) and type = supportedType(endpoint) and classification = usageClassification(usage) -select usage, apiName, supported, endpoint.jarContainer(), endpoint.jarVersion(), type, +select usage, endpoint.getPackageName(), endpoint.getTypeName(), endpoint.getName(), + endpoint.getParameterTypes(), supported, endpoint.jarContainer(), endpoint.jarVersion(), type, classification diff --git a/java/ql/src/utils/modeleditor/FrameworkModeEndpoints.ql b/java/ql/src/utils/modeleditor/FrameworkModeEndpoints.ql index 3350d55e9e6..9dfe57c53a9 100644 --- a/java/ql/src/utils/modeleditor/FrameworkModeEndpoints.ql +++ b/java/ql/src/utils/modeleditor/FrameworkModeEndpoints.ql @@ -10,10 +10,10 @@ private import java private import FrameworkModeEndpointsQuery private import ModelEditor -from PublicEndpointFromSource endpoint, string apiName, boolean supported, string type +from PublicEndpointFromSource endpoint, boolean supported, string type where - apiName = endpoint.getApiName() and supported = isSupported(endpoint) and type = supportedType(endpoint) -select endpoint, apiName, supported, +select endpoint, endpoint.getPackageName(), endpoint.getTypeName(), endpoint.getName(), + endpoint.getParameterTypes(), supported, endpoint.getCompilationUnit().getParentContainer().getBaseName(), type diff --git a/java/ql/src/utils/modeleditor/ModelEditor.qll b/java/ql/src/utils/modeleditor/ModelEditor.qll index 85ac8b3fc74..2c1a56823f1 100644 --- a/java/ql/src/utils/modeleditor/ModelEditor.qll +++ b/java/ql/src/utils/modeleditor/ModelEditor.qll @@ -20,13 +20,19 @@ class Endpoint extends Callable { Endpoint() { not isUninteresting(this) } /** - * Gets information about the external API in the form expected by the MaD modeling framework. + * Gets the package name of this endpoint. */ - string getApiName() { - result = - this.getDeclaringType().getPackage() + "." + this.getDeclaringType().nestedName() + "#" + - this.getName() + paramsString(this) - } + string getPackageName() { result = this.getDeclaringType().getPackage().getName() } + + /** + * Gets the type name of this endpoint. + */ + string getTypeName() { result = this.getDeclaringType().nestedName() } + + /** + * Gets the parameter types of this endpoint. + */ + string getParameterTypes() { result = paramsString(this) } private string getJarName() { result = this.getCompilationUnit().getParentContainer*().(JarFile).getBaseName() diff --git a/java/ql/test/utils/modeleditor/ApplicationModeEndpoints.expected b/java/ql/test/utils/modeleditor/ApplicationModeEndpoints.expected index f6d6cb58608..919fc09b261 100644 --- a/java/ql/test/utils/modeleditor/ApplicationModeEndpoints.expected +++ b/java/ql/test/utils/modeleditor/ApplicationModeEndpoints.expected @@ -1,15 +1,15 @@ -| com/github/codeql/test/NonPublicClass.java:5:5:5:28 | println(...) | java.io.PrintStream#println(String) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicClass.java:8:5:8:27 | println(...) | java.io.PrintStream#println(String) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicClass.java:12:5:12:27 | println(...) | java.io.PrintStream#println(String) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicClass.java:16:5:16:45 | println(...) | java.io.PrintStream#println(Object) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicClass.java:16:24:16:44 | get(...) | java.nio.file.Paths#get(String,String[]) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicClass.java:16:24:16:44 | get(...) | java.nio.file.Paths#get(String,String[]) | true | rt.jar | | summary | source | -| com/github/codeql/test/PublicClass.java:20:5:20:68 | println(...) | java.io.PrintStream#println(Object) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicClass.java:20:24:20:47 | getDefault(...) | java.nio.file.FileSystems#getDefault() | false | rt.jar | | | source | -| com/github/codeql/test/PublicClass.java:20:24:20:67 | getPath(...) | java.nio.file.FileSystem#getPath(String,String[]) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicClass.java:20:24:20:67 | getPath(...) | java.nio.file.FileSystem#getPath(String,String[]) | true | rt.jar | | summary | source | -| com/github/codeql/test/PublicClass.java:24:5:24:27 | println(...) | java.io.PrintStream#println(String) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicGenericClass.java:7:5:7:27 | println(...) | java.io.PrintStream#println(Object) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicGenericClass.java:11:5:11:27 | println(...) | java.io.PrintStream#println(Object) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicGenericInterface.java:8:7:8:29 | println(...) | java.io.PrintStream#println(String) | true | rt.jar | | sink | source | -| com/github/codeql/test/PublicInterface.java:7:7:7:29 | println(...) | java.io.PrintStream#println(String) | true | rt.jar | | sink | source | +| com/github/codeql/test/NonPublicClass.java:5:5:5:28 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicClass.java:8:5:8:27 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicClass.java:12:5:12:27 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicClass.java:16:5:16:45 | println(...) | java.io | PrintStream | println | (Object) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicClass.java:16:24:16:44 | get(...) | java.nio.file | Paths | get | (String,String[]) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicClass.java:16:24:16:44 | get(...) | java.nio.file | Paths | get | (String,String[]) | true | rt.jar | | summary | source | +| com/github/codeql/test/PublicClass.java:20:5:20:68 | println(...) | java.io | PrintStream | println | (Object) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicClass.java:20:24:20:47 | getDefault(...) | java.nio.file | FileSystems | getDefault | () | false | rt.jar | | | source | +| com/github/codeql/test/PublicClass.java:20:24:20:67 | getPath(...) | java.nio.file | FileSystem | getPath | (String,String[]) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicClass.java:20:24:20:67 | getPath(...) | java.nio.file | FileSystem | getPath | (String,String[]) | true | rt.jar | | summary | source | +| com/github/codeql/test/PublicClass.java:24:5:24:27 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicGenericClass.java:7:5:7:27 | println(...) | java.io | PrintStream | println | (Object) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicGenericClass.java:11:5:11:27 | println(...) | java.io | PrintStream | println | (Object) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicGenericInterface.java:8:7:8:29 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source | +| com/github/codeql/test/PublicInterface.java:7:7:7:29 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source | diff --git a/java/ql/test/utils/modeleditor/FrameworkModeEndpoints.expected b/java/ql/test/utils/modeleditor/FrameworkModeEndpoints.expected index ed2522fb977..444165791ca 100644 --- a/java/ql/test/utils/modeleditor/FrameworkModeEndpoints.expected +++ b/java/ql/test/utils/modeleditor/FrameworkModeEndpoints.expected @@ -1,14 +1,14 @@ -| com/github/codeql/test/PublicClass.java:7:15:7:19 | stuff | com.github.codeql.test.PublicClass#stuff(String) | false | test | | -| com/github/codeql/test/PublicClass.java:11:22:11:32 | staticStuff | com.github.codeql.test.PublicClass#staticStuff(String) | false | test | | -| com/github/codeql/test/PublicClass.java:15:18:15:31 | protectedStuff | com.github.codeql.test.PublicClass#protectedStuff(String) | false | test | | -| com/github/codeql/test/PublicClass.java:27:17:27:28 | summaryStuff | com.github.codeql.test.PublicClass#summaryStuff(String) | true | test | summary | -| com/github/codeql/test/PublicClass.java:31:17:31:27 | sourceStuff | com.github.codeql.test.PublicClass#sourceStuff() | true | test | source | -| com/github/codeql/test/PublicClass.java:35:15:35:23 | sinkStuff | com.github.codeql.test.PublicClass#sinkStuff(String) | true | test | sink | -| com/github/codeql/test/PublicClass.java:39:15:39:26 | neutralStuff | com.github.codeql.test.PublicClass#neutralStuff(String) | true | test | neutral | -| com/github/codeql/test/PublicGenericClass.java:6:15:6:19 | stuff | com.github.codeql.test.PublicGenericClass#stuff(Object) | false | test | | -| com/github/codeql/test/PublicGenericClass.java:10:20:10:25 | stuff2 | com.github.codeql.test.PublicGenericClass#stuff2(Object) | false | test | | -| com/github/codeql/test/PublicGenericInterface.java:4:17:4:21 | stuff | com.github.codeql.test.PublicGenericInterface#stuff(Object) | false | test | | -| com/github/codeql/test/PublicGenericInterface.java:5:22:5:27 | stuff2 | com.github.codeql.test.PublicGenericInterface#stuff2(Object) | false | test | | -| com/github/codeql/test/PublicGenericInterface.java:7:24:7:34 | staticStuff | com.github.codeql.test.PublicGenericInterface#staticStuff(String) | false | test | | -| com/github/codeql/test/PublicInterface.java:4:17:4:21 | stuff | com.github.codeql.test.PublicInterface#stuff(String) | false | test | | -| com/github/codeql/test/PublicInterface.java:6:24:6:34 | staticStuff | com.github.codeql.test.PublicInterface#staticStuff(String) | false | test | | +| com/github/codeql/test/PublicClass.java:7:15:7:19 | stuff | com.github.codeql.test | PublicClass | stuff | (String) | false | test | | +| com/github/codeql/test/PublicClass.java:11:22:11:32 | staticStuff | com.github.codeql.test | PublicClass | staticStuff | (String) | false | test | | +| com/github/codeql/test/PublicClass.java:15:18:15:31 | protectedStuff | com.github.codeql.test | PublicClass | protectedStuff | (String) | false | test | | +| com/github/codeql/test/PublicClass.java:27:17:27:28 | summaryStuff | com.github.codeql.test | PublicClass | summaryStuff | (String) | true | test | summary | +| com/github/codeql/test/PublicClass.java:31:17:31:27 | sourceStuff | com.github.codeql.test | PublicClass | sourceStuff | () | true | test | source | +| com/github/codeql/test/PublicClass.java:35:15:35:23 | sinkStuff | com.github.codeql.test | PublicClass | sinkStuff | (String) | true | test | sink | +| com/github/codeql/test/PublicClass.java:39:15:39:26 | neutralStuff | com.github.codeql.test | PublicClass | neutralStuff | (String) | true | test | neutral | +| com/github/codeql/test/PublicGenericClass.java:6:15:6:19 | stuff | com.github.codeql.test | PublicGenericClass | stuff | (Object) | false | test | | +| com/github/codeql/test/PublicGenericClass.java:10:20:10:25 | stuff2 | com.github.codeql.test | PublicGenericClass | stuff2 | (Object) | false | test | | +| com/github/codeql/test/PublicGenericInterface.java:4:17:4:21 | stuff | com.github.codeql.test | PublicGenericInterface | stuff | (Object) | false | test | | +| com/github/codeql/test/PublicGenericInterface.java:5:22:5:27 | stuff2 | com.github.codeql.test | PublicGenericInterface | stuff2 | (Object) | false | test | | +| com/github/codeql/test/PublicGenericInterface.java:7:24:7:34 | staticStuff | com.github.codeql.test | PublicGenericInterface | staticStuff | (String) | false | test | | +| com/github/codeql/test/PublicInterface.java:4:17:4:21 | stuff | com.github.codeql.test | PublicInterface | stuff | (String) | false | test | | +| com/github/codeql/test/PublicInterface.java:6:24:6:34 | staticStuff | com.github.codeql.test | PublicInterface | staticStuff | (String) | false | test | |