Java: Add SrcCallable.isImplicitlyPublic convenience predicate.

This commit is contained in:
Anders Schack-Mulligen
2023-04-27 15:20:49 +02:00
parent 246d904712
commit 9df2ee00d6

View File

@@ -379,6 +379,19 @@ class SrcCallable extends Callable {
this.isProtected() and not tsub.isFinal()
)
}
/**
* Holds if this callable is implicitly public in the sense that it can be the
* target of virtual dispatch by a call from outside the codebase.
*/
predicate isImplicitlyPublic() {
this.isEffectivelyPublic()
or
exists(SrcMethod m |
m.(SrcCallable).isEffectivelyPublic() and
m.getAPossibleImplementationOfSrcMethod() = this
)
}
}
/** Gets the erasure of `t1` if it is a raw type, or `t1` itself otherwise. */