diff --git a/core/src/main/java/org/kohsuke/stapler/ReflectionUtils.java b/core/src/main/java/org/kohsuke/stapler/ReflectionUtils.java index 929d16eb1..0e4c96a33 100644 --- a/core/src/main/java/org/kohsuke/stapler/ReflectionUtils.java +++ b/core/src/main/java/org/kohsuke/stapler/ReflectionUtils.java @@ -101,6 +101,10 @@ public static Annotation[] union(Annotation[] a, Annotation[] b) { */ public static boolean isOverridden( @NonNull Class base, @NonNull Class derived, @NonNull String methodName, @NonNull Class... types) { + if (base == derived) { + // If base and derived are the same type, the method is not overridden by definition + return false; + } // If derived is not a subclass or implementor of base, it can't override any method // Technically this should also be triggered when base == derived, because it can't override its own method, but // the unit tests explicitly test for that as working.