File tree Expand file tree Collapse file tree 2 files changed +15
-14
lines changed
java/ql/test/ext/TopJdkApis Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ private import semmle.code.java.dataflow.FlowSummary
55private import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
66private import semmle.code.java.dataflow.ExternalFlow
77
8+ /** Holds if the given API name is a top JDK API. */
89predicate topJdkApiName ( string apiName ) {
910 apiName in [
1011 // top 100 JDK APIs
@@ -60,21 +61,24 @@ predicate topJdkApiName(string apiName) {
6061 ]
6162}
6263
63- predicate hasCallable ( string apiName ) {
64- exists ( Callable c |
65- apiName =
66- c .getDeclaringType ( ) .getPackage ( ) + "." + c .getDeclaringType ( ) .getSourceDeclaration ( ) + "#" +
67- c .getName ( ) + paramsString ( c )
68- )
64+ /**
65+ * Gets information about the given API in the form expected by the
66+ * MaD modeling framework.
67+ */
68+ string getApiName ( Callable api ) {
69+ result =
70+ api .getDeclaringType ( ) .getPackage ( ) + "." + api .getDeclaringType ( ) .getSourceDeclaration ( ) + "#" +
71+ api .getName ( ) + paramsString ( api )
6972}
7073
74+ /** Holds if the given API has a `Callable`. */
75+ predicate hasCallable ( string apiName ) { exists ( Callable callable | apiName = getApiName ( callable ) ) }
76+
77+ /** A top JDK API. */
7178class TopJdkApi extends SummarizedCallableBase {
7279 TopJdkApi ( ) {
7380 exists ( string apiName |
74- apiName =
75- this .asCallable ( ) .getDeclaringType ( ) .getPackage ( ) + "." +
76- this .asCallable ( ) .getDeclaringType ( ) .getSourceDeclaration ( ) + "#" +
77- this .asCallable ( ) .getName ( ) + paramsString ( this .asCallable ( ) ) and
81+ apiName = getApiName ( this .asCallable ( ) ) and
7882 topJdkApiName ( apiName )
7983 )
8084 }
Original file line number Diff line number Diff line change 1212 // top jdk api names for which there isn't a manual model
1313 exists ( TopJdkApi topApi |
1414 not topApi .hasManualMadModel ( ) and
15- apiName =
16- topApi .asCallable ( ) .getDeclaringType ( ) .getPackage ( ) + "." +
17- topApi .asCallable ( ) .getDeclaringType ( ) .getSourceDeclaration ( ) + "#" +
18- topApi .asCallable ( ) .getName ( ) + paramsString ( topApi .asCallable ( ) ) and
15+ apiName = getApiName ( topApi .asCallable ( ) ) and
1916 message = "no manual model"
2017 )
2118select apiName , message order by apiName
You can’t perform that action at this time.
0 commit comments