Class ParametersMethodOverrideCheck

All Implemented Interfaces:
ClassCheck

public class ParametersMethodOverrideCheck extends AbstractMethodOverrideCheck
Checks if the parameters of overridden and overriding methods have correctly placed annotations. Parameter constraints must not be strengthened in subtypes. The two rules implemented in this check are:
  • In subtypes (be it sub classes/interfaces or interface implementations), no parameter constraints may be declared on overridden or implemented methods, nor may parameters be marked for cascaded validation. This would pose a strengthening of preconditions to be fulfilled by the caller.
  • If a subtype overrides/implements a method originally defined in several parallel types of the hierarchy (e.g. two interfaces not extending each other, or a class and an interface not implemented by said class), no parameter constraints may be declared for that method at all nor parameters be marked for cascaded validation. This again is to avoid an unexpected strengthening of preconditions to be fulfilled by the caller.
Author:
Marko Bekhta