Java: Improve join-order for FunctionalInterface.

This commit is contained in:
Anders Schack-Mulligen
2023-06-08 13:02:54 +02:00
parent cc45db7c76
commit dabb4dd643

View File

@@ -987,6 +987,17 @@ private string getAPublicObjectMethodSignature() {
)
}
pragma[nomagic]
private predicate interfaceInheritsOverridingNonAbstractMethod(Interface interface, Method m) {
interface.inherits(m) and
not m.isAbstract() and
m.overrides(_)
}
bindingset[m]
pragma[inline_late]
private Method getAnOverridden(Method m) { m.overrides(result) }
private Method getAnAbstractMethod(Interface interface) {
interface.inherits(result) and
result.isAbstract() and
@@ -995,9 +1006,8 @@ private Method getAnAbstractMethod(Interface interface) {
// Make sure that there is no other non-abstract method
// (e.g. `default`) which overrides the abstract one
not exists(Method m |
interface.inherits(m) and
not m.isAbstract() and
m.overrides(result)
interfaceInheritsOverridingNonAbstractMethod(interface, m) and
result = getAnOverridden(m)
)
}