Skip to content

Commit 9df2ee0

Browse files
committed
Java: Add SrcCallable.isImplicitlyPublic convenience predicate.
1 parent 246d904 commit 9df2ee0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

java/ql/lib/semmle/code/java/Member.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,19 @@ class SrcCallable extends Callable {
379379
this.isProtected() and not tsub.isFinal()
380380
)
381381
}
382+
383+
/**
384+
* Holds if this callable is implicitly public in the sense that it can be the
385+
* target of virtual dispatch by a call from outside the codebase.
386+
*/
387+
predicate isImplicitlyPublic() {
388+
this.isEffectivelyPublic()
389+
or
390+
exists(SrcMethod m |
391+
m.(SrcCallable).isEffectivelyPublic() and
392+
m.getAPossibleImplementationOfSrcMethod() = this
393+
)
394+
}
382395
}
383396

384397
/** Gets the erasure of `t1` if it is a raw type, or `t1` itself otherwise. */

0 commit comments

Comments
 (0)