mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Java: Re-factor NeutralCallable to include all neutrals and introduce NeutralSummaryCallable.
This commit is contained in:
@@ -45,12 +45,10 @@ private int getNumApis(string package, string apiSubset) {
|
||||
|
||||
/** Holds if the given `callable` belongs to the specified `apiSubset`. */
|
||||
private predicate callableSubset(Callable callable, string apiSubset) {
|
||||
apiSubset in ["topJdkApis", "allApis"] and
|
||||
(
|
||||
if apiSubset = "topJdkApis"
|
||||
then exists(TopJdkApi topJdkApi | callable = topJdkApi.asCallable())
|
||||
else apiSubset = "allApis"
|
||||
)
|
||||
apiSubset = "topJdkApis" and
|
||||
callable instanceof TopJdkApi
|
||||
or
|
||||
apiSubset = "allApis"
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -287,16 +287,19 @@ predicate hasApiName(Callable c, string apiName) {
|
||||
}
|
||||
|
||||
/** A top JDK API. */
|
||||
class TopJdkApi extends SummarizedCallableBase {
|
||||
class TopJdkApi extends Callable {
|
||||
TopJdkApi() {
|
||||
this.isSourceDeclaration() and
|
||||
exists(string apiName |
|
||||
hasApiName(this.asCallable(), apiName) and
|
||||
hasApiName(this, apiName) and
|
||||
topJdkApiName(apiName)
|
||||
)
|
||||
}
|
||||
|
||||
/** Holds if this API has a manual summary model. */
|
||||
private predicate hasManualSummary() { this.(SummarizedCallable).hasManualModel() }
|
||||
private predicate hasManualSummary() {
|
||||
exists(SummarizedCallable sc | sc.asCallable() = this and sc.hasManualModel())
|
||||
}
|
||||
|
||||
/** Holds if this API has a manual neutral model. */
|
||||
private predicate hasManualNeutral() {
|
||||
|
||||
@@ -79,7 +79,7 @@ class ExternalApi extends Callable {
|
||||
|
||||
/** Holds if this API is a known neutral. */
|
||||
pragma[nomagic]
|
||||
predicate isNeutral() { this = any(FlowSummaryImpl::Public::NeutralCallable nsc).asCallable() }
|
||||
predicate isNeutral() { this instanceof FlowSummaryImpl::Public::NeutralCallable }
|
||||
|
||||
/**
|
||||
* Holds if this API is supported by existing CodeQL libraries, that is, it is either a
|
||||
|
||||
Reference in New Issue
Block a user