@@ -152,18 +152,23 @@ predicate missingCallToSuperclassMethod(Class base, Function shouldCall, string
152152 */
153153predicate missingCallToSuperclassMethodRestricted ( Class base , Function shouldCall , string name ) {
154154 missingCallToSuperclassMethod ( base , shouldCall , name ) and
155- not exists ( Class superBase |
156- // Alert only on the highest base class that has the issue
157- superBase = getADirectSuperclass + ( base ) and
158- missingCallToSuperclassMethod ( superBase , shouldCall , name )
159- ) and
155+ not superclassAlsoMissesCall ( base , shouldCall , name ) and
160156 not exists ( Function subShouldCall |
161157 // Mention in the alert only the lowest method we're missing the call to
162158 subShouldCall .getScope ( ) = getADirectSubclass + ( shouldCall .getScope ( ) ) and
163159 missingCallToSuperclassMethod ( base , subShouldCall , name )
164160 )
165161}
166162
163+ /**
164+ * Holds if a strict superclass of `base` is also missing a call to `shouldCall` named `name`,
165+ * indicating that `base` is not the highest class in the hierarchy with this issue.
166+ */
167+ pragma [ nomagic]
168+ private predicate superclassAlsoMissesCall ( Class base , Function shouldCall , string name ) {
169+ missingCallToSuperclassMethod ( getADirectSuperclass + ( base ) , shouldCall , name )
170+ }
171+
167172/**
168173 * If `base` contains a `super()` call, gets a method in the inheritance hierarchy of `name` in the MRO of `base`
169174 * that does not contain a `super()` call, but would call `shouldCall` if it did, which does not otherwise get called
0 commit comments