Skip to content

Commit 06ba5ea

Browse files
author
Max Schaefer
committed
Eliminate GetCallable modules and use getCallable instead.
1 parent 76b8430 commit 06ba5ea

File tree

3 files changed

+7
-45
lines changed

3 files changed

+7
-45
lines changed

java/ql/automodel/src/AutomodelApplicationModeCharacteristics.qll

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ private import semmle.code.java.security.QueryInjection
1515
private import semmle.code.java.dataflow.internal.ModelExclusions as ModelExclusions
1616
private import AutomodelJavaUtil as AutomodelJavaUtil
1717
private import semmle.code.java.security.PathSanitizer as PathSanitizer
18-
private import AutomodelSharedGetCallable as AutomodelSharedGetCallable
1918
import AutomodelSharedCharacteristics as SharedCharacteristics
2019
import AutomodelEndpointTypes as AutomodelEndpointTypes
2120

@@ -330,22 +329,6 @@ module ApplicationCandidatesImpl implements SharedCharacteristics::CandidateSig
330329
}
331330
}
332331

333-
private class JavaCallable = Callable;
334-
335-
private module ApplicationModeGetCallable implements AutomodelSharedGetCallable::GetCallableSig {
336-
class Callable = JavaCallable;
337-
338-
class Endpoint = ApplicationCandidatesImpl::Endpoint;
339-
340-
/**
341-
* Returns the API callable being modeled.
342-
*
343-
* We usually want to use `.getSourceDeclaration()` instead of just 'the' callable,
344-
* because the source declaration callable has erased generic type parameters.
345-
*/
346-
Callable getCallable(Endpoint e) { result = e.getCall().getCallee() }
347-
}
348-
349332
/**
350333
* Contains endpoints that are defined in QL code rather than as a MaD model. Ideally this predicate
351334
* should be empty.
@@ -459,8 +442,7 @@ private class ExceptionCharacteristic extends CharacteristicsImpl::NotASinkChara
459442
ExceptionCharacteristic() { this = "exception" }
460443

461444
override predicate appliesToEndpoint(Endpoint e) {
462-
ApplicationModeGetCallable::getCallable(e).getDeclaringType().getASupertype*() instanceof
463-
TypeThrowable
445+
e.(CallArgument).getCallable().getDeclaringType().getASupertype*() instanceof TypeThrowable
464446
}
465447
}
466448

@@ -493,18 +475,20 @@ private class LocalCall extends CharacteristicsImpl::UninterestingToModelCharact
493475
LocalCall() { this = "local call" }
494476

495477
override predicate appliesToEndpoint(Endpoint e) {
496-
ApplicationModeGetCallable::getCallable(e).fromSource()
478+
e.(CallArgument).getCallable().fromSource()
479+
or
480+
e.(MethodReturnValue).getCallable().fromSource()
497481
}
498482
}
499483

500484
/**
501-
* A Characteristic that marks endpoints as uninteresting to model, according to the Java ModelExclusions module.
485+
* A characteristic that marks endpoints as uninteresting to model, according to the Java ModelExclusions module.
502486
*/
503487
private class ExcludedFromModeling extends CharacteristicsImpl::UninterestingToModelCharacteristic {
504488
ExcludedFromModeling() { this = "excluded from modeling" }
505489

506490
override predicate appliesToEndpoint(Endpoint e) {
507-
ModelExclusions::isUninterestingForModels(ApplicationModeGetCallable::getCallable(e))
491+
ModelExclusions::isUninterestingForModels(e.getCallable())
508492
}
509493
}
510494

@@ -518,7 +502,7 @@ private class NonPublicMethodCharacteristic extends CharacteristicsImpl::Uninter
518502

519503
override predicate appliesToEndpoint(Endpoint e) {
520504
e.getExtensibleType() = "sinkModel" and
521-
not ApplicationModeGetCallable::getCallable(e).isPublic()
505+
not e.getCallable().isPublic()
522506
}
523507
}
524508

java/ql/automodel/src/AutomodelFrameworkModeCharacteristics.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ private import semmle.code.java.security.QueryInjection
1515
private import semmle.code.java.security.RequestForgery
1616
private import semmle.code.java.dataflow.internal.ModelExclusions as ModelExclusions
1717
private import AutomodelJavaUtil as AutomodelJavaUtil
18-
private import AutomodelSharedGetCallable as AutomodelSharedGetCallable
1918
import AutomodelSharedCharacteristics as SharedCharacteristics
2019
import AutomodelEndpointTypes as AutomodelEndpointTypes
2120

java/ql/automodel/src/AutomodelSharedGetCallable.qll

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)