Get rid of @Programming annnotation

Hi devs,

A long time ago the support for a @Programming annotation was started as part of but never finished. We end up with a totally useless annotation but worst of all a very misleading annotation since we noticed people using it and assuming that it was actually protection their API automatically.

Since it’s currently in a very bad location, and we would like to have something more generic (any right check and not just programming) when we finally implement this I’m proposing to simply delete it completely. Deleting an annotation is not really a problem from a binary compatibility point of view (provided you don’t actually try to get this type of annotation from a method of course).



Some thoughts:

  • It’s not totally useless. It’s interesting to have it in the javadoc to express that a method requires PR. For example:!/com/xpn/xwiki/api/Context.html#setDatabase(java.lang.String) (in this example the javadoc also mentions the need for PR but not all javadocs do)
  • I agree that it’s misleading to not use it everywhere since users could think that if the annotation is not present then it means the method doesn’t require PR.
  • “we noticed people using it and assuming that it was actually protection their API automatically.”. That could be fixed by improving the javadoc in the Programming annotation code which is currently misleading (Indicates that a method requires programming rights to be executed.), by saying that it’s informational only and doesn’t perform any check automatically. Similar to the ProgrammingRights xobject for wiki pages.
  • I agree that we should deprecated it, if only for the reason that the annotation is located in the com.xpn.xwiki.util package. We need such an annotation to be in org.xwiki.*.
  • I think I wouldn’t delete it (since it’ll make existing code fail) but move it legacy instead (and update its javadoc as mentioned above).

What kind of code do you have in mind ? Removing it won’t have any impact on the methods annotated with it and I really doubt any code really gather this kind of annotation on methods.

Note that there’s one occurence of this in wiki-editor-devtools:

Now it’s the only occurence we have in xwiki-contrib, AFAICS:

Note that the idea is to have a more generic way to express the rights needed (cf, so IMO it makes sense to remove this one and to fix the places where it’s used to then provide the right one as part of XWIKI-18278.