Per the spec, methods specified in a superclass or interface should only be annotated where they are originally defined (the contract). If an implementation or extending class contains constraint annotations on these methods, it should result in an exception (because it alters the contract understood by the consumer of the interface).
This is all well and good, except that the annotation processor does not catch these types of programming errors, so if you mistakenly annotate an overridden or implemented method you won't notice until runtime. The annotation processor should flag constraints on methods that override or implement superclass or interface methods so that this problem can be caught during compilation.
|