@@ -37,6 +37,20 @@ abstract class FrameworkModeEndpoint extends TFrameworkModeEndpoint {
3737 */
3838 abstract int getIndex ( ) ;
3939
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+
4054 /**
4155 * Returns the name of the parameter of the endpoint.
4256 */
@@ -63,6 +77,10 @@ class ExplicitParameterEndpoint extends FrameworkModeEndpoint, TExplicitParamete
6377
6478 override int getIndex ( ) { result = param .getPosition ( ) }
6579
80+ override string getMaDInput ( ) { result = "Argument[" + param .getPosition ( ) + "]" }
81+
82+ override string getMaDOutput ( ) { none ( ) }
83+
6684 override string getParamName ( ) { result = param .getName ( ) }
6785
6886 override Callable getEnclosingCallable ( ) { result = param .getCallable ( ) }
@@ -81,6 +99,10 @@ class QualifierEndpoint extends FrameworkModeEndpoint, TQualifier {
8199
82100 override int getIndex ( ) { result = - 1 }
83101
102+ override string getMaDInput ( ) { result = "Argument[this]" }
103+
104+ override string getMaDOutput ( ) { none ( ) }
105+
84106 override string getParamName ( ) { result = "this" }
85107
86108 override Callable getEnclosingCallable ( ) { result = callable }
@@ -100,10 +122,11 @@ class ReturnValue extends FrameworkModeEndpoint, TReturnValue {
100122 result = - 1
101123 }
102124
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 ( ) }
107130
108131 override Callable getEnclosingCallable ( ) { result = callable }
109132
@@ -163,7 +186,7 @@ module FrameworkCandidatesImpl implements SharedCharacteristics::CandidateSig {
163186 FrameworkModeGetCallable:: getCallable ( e ) .hasQualifiedName ( package , type , name ) and
164187 signature = ExternalFlow:: paramsString ( FrameworkModeGetCallable:: getCallable ( e ) ) and
165188 ext = "" and
166- input = AutomodelJavaUtil :: getArgumentForIndex ( e . getIndex ( ) )
189+ input = e . getMaDInput ( )
167190 }
168191
169192 /**
@@ -213,11 +236,12 @@ class FrameworkModeMetadataExtractor extends string {
213236
214237 predicate hasMetadata (
215238 Endpoint e , string package , string type , string subtypes , string name , string signature ,
216- string input , string parameterName
239+ string input , string output , string parameterName
217240 ) {
218- parameterName = e .getParamName ( ) and
241+ ( if exists ( e . getParamName ( ) ) then parameterName = e .getParamName ( ) else parameterName = "" ) and
219242 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
221245 package = e .getEnclosingCallable ( ) .getDeclaringType ( ) .getPackage ( ) .getName ( ) and
222246 type = e .getEnclosingCallable ( ) .getDeclaringType ( ) .getErasure ( ) .( RefType ) .nestedName ( ) and
223247 subtypes = AutomodelJavaUtil:: considerSubtypes ( e .getEnclosingCallable ( ) ) .toString ( ) and
@@ -285,8 +309,8 @@ private class ExceptionCharacteristic extends CharacteristicsImpl::NotASinkChara
285309 * A characteristic that limits candidates to parameters of methods that are recognized as `ModelApi`, iow., APIs that
286310 * are considered worth modeling.
287311 */
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" }
290314
291315 override predicate appliesToEndpoint ( Endpoint e ) {
292316 not e .getEnclosingCallable ( ) instanceof ModelExclusions:: ModelApi
0 commit comments