@@ -37,6 +37,20 @@ abstract class FrameworkModeEndpoint extends TFrameworkModeEndpoint {
37
37
*/
38
38
abstract int getIndex ( ) ;
39
39
40
+ /**
41
+ * Gets the input (if any) for this endpoint, eg.: `Argument[0]`.
42
+ *
43
+ * For endpoints that are source candidates, this will be `none()`.
44
+ */
45
+ abstract string getMaDInput ( ) ;
46
+
47
+ /**
48
+ * Gets the output (if any) for this endpoint, eg.: `ReturnValue`.
49
+ *
50
+ * For endpoints that are sink candidates, this will be `none()`.
51
+ */
52
+ abstract string getMaDOutput ( ) ;
53
+
40
54
/**
41
55
* Returns the name of the parameter of the endpoint.
42
56
*/
@@ -63,6 +77,10 @@ class ExplicitParameterEndpoint extends FrameworkModeEndpoint, TExplicitParamete
63
77
64
78
override int getIndex ( ) { result = param .getPosition ( ) }
65
79
80
+ override string getMaDInput ( ) { result = "Argument[" + param .getPosition ( ) + "]" }
81
+
82
+ override string getMaDOutput ( ) { none ( ) }
83
+
66
84
override string getParamName ( ) { result = param .getName ( ) }
67
85
68
86
override Callable getEnclosingCallable ( ) { result = param .getCallable ( ) }
@@ -81,6 +99,10 @@ class QualifierEndpoint extends FrameworkModeEndpoint, TQualifier {
81
99
82
100
override int getIndex ( ) { result = - 1 }
83
101
102
+ override string getMaDInput ( ) { result = "Argument[this]" }
103
+
104
+ override string getMaDOutput ( ) { none ( ) }
105
+
84
106
override string getParamName ( ) { result = "this" }
85
107
86
108
override Callable getEnclosingCallable ( ) { result = callable }
@@ -100,10 +122,11 @@ class ReturnValue extends FrameworkModeEndpoint, TReturnValue {
100
122
result = - 1
101
123
}
102
124
103
- override string getParamName ( ) {
104
- // FIXME bogus value
105
- result = "return value"
106
- }
125
+ override string getMaDInput ( ) { none ( ) }
126
+
127
+ override string getMaDOutput ( ) { result = "ReturnValue" }
128
+
129
+ override string getParamName ( ) { none ( ) }
107
130
108
131
override Callable getEnclosingCallable ( ) { result = callable }
109
132
@@ -163,7 +186,7 @@ module FrameworkCandidatesImpl implements SharedCharacteristics::CandidateSig {
163
186
FrameworkModeGetCallable:: getCallable ( e ) .hasQualifiedName ( package , type , name ) and
164
187
signature = ExternalFlow:: paramsString ( FrameworkModeGetCallable:: getCallable ( e ) ) and
165
188
ext = "" and
166
- input = AutomodelJavaUtil :: getArgumentForIndex ( e . getIndex ( ) )
189
+ input = e . getMaDInput ( )
167
190
}
168
191
169
192
/**
@@ -213,11 +236,12 @@ class FrameworkModeMetadataExtractor extends string {
213
236
214
237
predicate hasMetadata (
215
238
Endpoint e , string package , string type , string subtypes , string name , string signature ,
216
- string input , string parameterName
239
+ string input , string output , string parameterName
217
240
) {
218
- parameterName = e .getParamName ( ) and
241
+ ( if exists ( e . getParamName ( ) ) then parameterName = e .getParamName ( ) else parameterName = "" ) and
219
242
name = e .getEnclosingCallable ( ) .getName ( ) and
220
- input = AutomodelJavaUtil:: getArgumentForIndex ( e .getIndex ( ) ) and
243
+ ( if exists ( e .getMaDInput ( ) ) then input = e .getMaDInput ( ) else input = "" ) and
244
+ ( if exists ( e .getMaDOutput ( ) ) then output = e .getMaDOutput ( ) else output = "" ) and
221
245
package = e .getEnclosingCallable ( ) .getDeclaringType ( ) .getPackage ( ) .getName ( ) and
222
246
type = e .getEnclosingCallable ( ) .getDeclaringType ( ) .getErasure ( ) .( RefType ) .nestedName ( ) and
223
247
subtypes = AutomodelJavaUtil:: considerSubtypes ( e .getEnclosingCallable ( ) ) .toString ( ) and
@@ -285,8 +309,8 @@ private class ExceptionCharacteristic extends CharacteristicsImpl::NotASinkChara
285
309
* A characteristic that limits candidates to parameters of methods that are recognized as `ModelApi`, iow., APIs that
286
310
* are considered worth modeling.
287
311
*/
288
- private class NotAModelApiParameter extends CharacteristicsImpl:: UninterestingToModelCharacteristic {
289
- NotAModelApiParameter ( ) { this = "not a model API parameter " }
312
+ private class NotAModelApi extends CharacteristicsImpl:: UninterestingToModelCharacteristic {
313
+ NotAModelApi ( ) { this = "not a model API" }
290
314
291
315
override predicate appliesToEndpoint ( Endpoint e ) {
292
316
not e .getEnclosingCallable ( ) instanceof ModelExclusions:: ModelApi
0 commit comments