@@ -209,46 +209,69 @@ module FrameworkCandidatesImpl implements SharedCharacteristics::CandidateSig {
209209 predicate isKnownKind = AutomodelJavaUtil:: isKnownKind / 2 ;
210210
211211 predicate isSink ( Endpoint e , string kind , string provenance ) {
212- exists ( string package , string type , string name , string signature , string ext , string input |
213- sinkSpec ( e , package , type , name , signature , ext , input ) and
212+ exists (
213+ string package , string type , boolean subtypes , string name , string signature , string ext ,
214+ string input
215+ |
216+ sinkSpec ( e , package , type , subtypes , name , signature , ext , input ) and
214217 ExternalFlow:: sinkModel ( package , type , _, name , [ signature , "" ] , ext , input , kind , provenance )
215218 )
216219 }
217220
218221 predicate isSource ( Endpoint e , string kind , string provenance ) {
219- exists ( string package , string type , string name , string signature , string ext , string output |
220- sourceSpec ( e , package , type , name , signature , ext , output ) and
221- ExternalFlow:: sourceModel ( package , type , _, name , [ signature , "" ] , ext , output , kind ,
222+ exists (
223+ string package , string type , boolean subtypes , string name , string signature , string ext ,
224+ string output
225+ |
226+ sourceSpec ( e , package , type , subtypes , name , signature , ext , output ) and
227+ ExternalFlow:: sourceModel ( package , type , subtypes , name , [ signature , "" ] , ext , output , kind ,
222228 provenance )
223229 )
224230 }
225231
226232 predicate isNeutral ( Endpoint e ) {
227233 exists ( string package , string type , string name , string signature |
228- (
229- sinkSpec ( e , package , type , name , signature , _, _)
230- or
231- sourceSpec ( e , package , type , name , signature , _, _)
232- ) and
234+ sinkSpec ( e , package , type , _, name , signature , _, _)
235+ or
236+ sourceSpec ( e , package , type , _, name , signature , _, _)
237+ |
233238 ExternalFlow:: neutralModel ( package , type , name , [ signature , "" ] , "sink" , _)
234239 )
235240 }
236241
242+ /**
243+ * Holds if the endpoint concerns a callable with the given package, type, name and signature.
244+ *
245+ * If `subtypes` is `false`, only the exact callable is considered. If `true`, the callable and
246+ * all its overrides are considered.
247+ */
248+ additional predicate endpointCallable (
249+ Endpoint e , string package , string type , boolean subtypes , string name , string signature
250+ ) {
251+ exists ( Callable c |
252+ c = e .getCallable ( ) and subtypes in [ true , false ]
253+ or
254+ e .getCallable ( ) .( Method ) .getSourceDeclaration ( ) .overrides + ( c ) and subtypes = true
255+ |
256+ c .hasQualifiedName ( package , type , name ) and
257+ signature = ExternalFlow:: paramsString ( c )
258+ )
259+ }
260+
237261 additional predicate sinkSpec (
238- Endpoint e , string package , string type , string name , string signature , string ext , string input
262+ Endpoint e , string package , string type , boolean subtypes , string name , string signature ,
263+ string ext , string input
239264 ) {
240- e .getCallable ( ) .hasQualifiedName ( package , type , name ) and
241- signature = ExternalFlow:: paramsString ( e .getCallable ( ) ) and
265+ endpointCallable ( e , package , type , subtypes , name , signature ) and
242266 ext = "" and
243267 input = e .getMaDInput ( )
244268 }
245269
246270 additional predicate sourceSpec (
247- Endpoint e , string package , string type , string name , string signature , string ext ,
248- string output
271+ Endpoint e , string package , string type , boolean subtypes , string name , string signature ,
272+ string ext , string output
249273 ) {
250- e .getCallable ( ) .hasQualifiedName ( package , type , name ) and
251- signature = ExternalFlow:: paramsString ( e .getCallable ( ) ) and
274+ endpointCallable ( e , package , type , subtypes , name , signature ) and
252275 ext = "" and
253276 output = e .getMaDOutput ( )
254277 }
0 commit comments