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
5
5
private import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
6
6
private import semmle.code.java.dataflow.ExternalFlow
7
7
8
+ /** Holds if the given API name is a top JDK API. */
8
9
predicate topJdkApiName ( string apiName ) {
9
10
apiName in [
10
11
// top 100 JDK APIs
@@ -60,21 +61,24 @@ predicate topJdkApiName(string apiName) {
60
61
]
61
62
}
62
63
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 )
69
72
}
70
73
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. */
71
78
class TopJdkApi extends SummarizedCallableBase {
72
79
TopJdkApi ( ) {
73
80
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
78
82
topJdkApiName ( apiName )
79
83
)
80
84
}
Original file line number Diff line number Diff line change 12
12
// top jdk api names for which there isn't a manual model
13
13
exists ( TopJdkApi topApi |
14
14
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
19
16
message = "no manual model"
20
17
)
21
18
select apiName , message order by apiName
You can’t perform that action at this time.
0 commit comments