@@ -473,19 +473,31 @@ private void processMethodOverrides() {
473473 declaringClass .forAllSuperTypes (superType -> {
474474 /*
475475 * Iterate all the super types (including this type itself) looking for installed
476- * override notifications. If this method resolves in a super type, and it has an
476+ * override notifications. If this method is found in a super type, and it has an
477477 * override handler installed in that type, pass this method to the callback. It
478478 * doesn't matter if the superMethod is actually reachable, only if it has any
479- * override handlers installed.
479+ * override handlers installed. Note that ResolvedJavaType.resolveMethod() cannot be
480+ * used here because it only resolves methods declared by the type itself or if the
481+ * method's declaring class is assignable from the type.
480482 */
481- AnalysisMethod superMethod = resolveInType (superType );
483+ AnalysisMethod superMethod = findInType (superType );
482484 if (superMethod != null ) {
483485 superMethod .notifyMethodOverride (AnalysisMethod .this );
484486 }
485487 });
486488 }
487489 }
488490
491+ /** Find if the type declares a method with the same name and signature as this method. */
492+ private AnalysisMethod findInType (AnalysisType type ) {
493+ try {
494+ return type .findMethod (wrapped .getName (), getSignature ());
495+ } catch (UnsupportedFeatureException | LinkageError e ) {
496+ /* Ignore linking errors and deleted methods. */
497+ return null ;
498+ }
499+ }
500+
489501 protected void notifyMethodOverride (AnalysisMethod override ) {
490502 declaringClass .getOverrideReachabilityNotifications (this ).forEach (n -> n .notifyCallback (getUniverse (), override ));
491503 }
0 commit comments