@@ -247,8 +247,8 @@ module FrameworkCandidatesImpl implements SharedCharacteristics::CandidateSig {
247
247
additional predicate sinkSpec (
248
248
Endpoint e , string package , string type , string name , string signature , string ext , string input
249
249
) {
250
- FrameworkModeGetCallable :: getCallable ( e ) .hasQualifiedName ( package , type , name ) and
251
- signature = ExternalFlow:: paramsString ( FrameworkModeGetCallable :: getCallable ( e ) ) and
250
+ e . getEnclosingCallable ( ) .hasQualifiedName ( package , type , name ) and
251
+ signature = ExternalFlow:: paramsString ( e . getEnclosingCallable ( ) ) and
252
252
ext = "" and
253
253
input = e .getMaDInput ( )
254
254
}
@@ -270,28 +270,13 @@ module FrameworkCandidatesImpl implements SharedCharacteristics::CandidateSig {
270
270
*/
271
271
RelatedLocation getRelatedLocation ( Endpoint e , RelatedLocationType type ) {
272
272
type = MethodDoc ( ) and
273
- result = FrameworkModeGetCallable :: getCallable ( e ) .( Documentable ) .getJavadoc ( )
273
+ result = e . getEnclosingCallable ( ) .( Documentable ) .getJavadoc ( )
274
274
or
275
275
type = ClassDoc ( ) and
276
- result = FrameworkModeGetCallable :: getCallable ( e ) .getDeclaringType ( ) .( Documentable ) .getJavadoc ( )
276
+ result = e . getEnclosingCallable ( ) .getDeclaringType ( ) .( Documentable ) .getJavadoc ( )
277
277
}
278
278
}
279
279
280
- private class JavaCallable = Callable ;
281
-
282
- private module FrameworkModeGetCallable implements AutomodelSharedGetCallable:: GetCallableSig {
283
- class Callable = JavaCallable ;
284
-
285
- class Endpoint = FrameworkCandidatesImpl:: Endpoint ;
286
-
287
- /**
288
- * Returns the callable that contains the given endpoint.
289
- *
290
- * Each Java mode should implement this predicate.
291
- */
292
- Callable getCallable ( Endpoint e ) { result = e .getEnclosingCallable ( ) }
293
- }
294
-
295
280
module CharacteristicsImpl = SharedCharacteristics:: SharedCharacteristics< FrameworkCandidatesImpl > ;
296
281
297
282
class EndpointCharacteristic = CharacteristicsImpl:: EndpointCharacteristic ;
@@ -341,8 +326,8 @@ private class UnexploitableIsCharacteristic extends CharacteristicsImpl::NotASin
341
326
342
327
override predicate appliesToEndpoint ( Endpoint e ) {
343
328
not FrameworkCandidatesImpl:: isSink ( e , _, _) and
344
- FrameworkModeGetCallable :: getCallable ( e ) .getName ( ) .matches ( "is%" ) and
345
- FrameworkModeGetCallable :: getCallable ( e ) .getReturnType ( ) instanceof BooleanType
329
+ e . getEnclosingCallable ( ) .getName ( ) .matches ( "is%" ) and
330
+ e . getEnclosingCallable ( ) .getReturnType ( ) instanceof BooleanType
346
331
}
347
332
}
348
333
@@ -360,7 +345,7 @@ private class UnexploitableExistsCharacteristic extends CharacteristicsImpl::Not
360
345
override predicate appliesToEndpoint ( Endpoint e ) {
361
346
not FrameworkCandidatesImpl:: isSink ( e , _, _) and
362
347
exists ( Callable callable |
363
- callable = FrameworkModeGetCallable :: getCallable ( e ) and
348
+ callable = e . getEnclosingCallable ( ) and
364
349
callable .getName ( ) .toLowerCase ( ) = [ "exists" , "notexists" ] and
365
350
callable .getReturnType ( ) instanceof BooleanType
366
351
)
@@ -374,8 +359,7 @@ private class ExceptionCharacteristic extends CharacteristicsImpl::NotASinkChara
374
359
ExceptionCharacteristic ( ) { this = "exception" }
375
360
376
361
override predicate appliesToEndpoint ( Endpoint e ) {
377
- FrameworkModeGetCallable:: getCallable ( e ) .getDeclaringType ( ) .getASupertype * ( ) instanceof
378
- TypeThrowable
362
+ e .getEnclosingCallable ( ) .getDeclaringType ( ) .getASupertype * ( ) instanceof TypeThrowable
379
363
}
380
364
}
381
365
@@ -399,9 +383,7 @@ private class NonPublicMethodCharacteristic extends CharacteristicsImpl::Uninter
399
383
{
400
384
NonPublicMethodCharacteristic ( ) { this = "non-public method" }
401
385
402
- override predicate appliesToEndpoint ( Endpoint e ) {
403
- not FrameworkModeGetCallable:: getCallable ( e ) .isPublic ( )
404
- }
386
+ override predicate appliesToEndpoint ( Endpoint e ) { not e .getEnclosingCallable ( ) .isPublic ( ) }
405
387
}
406
388
407
389
/**
0 commit comments