public class ComputeOverridesAndImplementDefaultMethods extends Object
JMethod
, accessible through JMethod.getOverriddenMethods()
and
JMethod.getOverridingMethods()
.
In the process of computing overrides, some classes require the addition of stubs or forwarding methods in order to implement default interface methods and to account for accidental overrides
NOTE: Accidental overrides arise when a class A
defines an instance method m()
,
an unrelated interface I
also declares a method with the same signature and a second
class B
extends A
and implements I
. In this case m()
at
B
is an override of I.m()
but is inherited from A
making A.m()
override a method on an unrelated override.
Modeling accidental overrides in the naive way, i.e. marking the superclass method as overriding a method from an unrelated interface, has many undesirable consequences, the worst of which is that it makes the override relation non-local (only correct with global information.
A simple solution is to explicitly add a (forwarding) stub to the class that inherits the method and implements the interface.
Constructor and Description |
---|
ComputeOverridesAndImplementDefaultMethods() |
Copyright © 2018. All rights reserved.