mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Java: Allow dispatch to methods on abstract classes without subtypes.
This commit is contained in:
@@ -211,10 +211,14 @@ private module Dispatch {
|
||||
exists(Method m | t.hasMethod(m, _, _) and impl = m.getSourceDeclaration())
|
||||
}
|
||||
|
||||
private predicate isAbstractWithSubclass(SrcRefType t) {
|
||||
t.isAbstract() and exists(Class c | c.getASourceSupertype() = t)
|
||||
}
|
||||
|
||||
private predicate hasViableSubtype(RefType t, SrcRefType sub) {
|
||||
sub.extendsOrImplements*(t) and
|
||||
not sub instanceof Interface and
|
||||
not sub.isAbstract()
|
||||
not isAbstractWithSubclass(sub)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user