Begin to label interfaces for stability
(OPENDJ-996)
|
|
Status: | Closed |
Project: | OpenDJ |
Component/s: | core apis |
Affects Version/s: | 2.6.0 |
Fix Version/s: | 2.6.0 |
Type: | Sub-task | Priority: | Major |
Reporter: | Matthew Swift | Assignee: | Matthew Swift |
Resolution: | Fixed | Votes: | 0 |
Labels: | None |
Sprint: | Sprint 11 |
Description |
We should use annotations for this, but let's just document them for now. Candidates for evolving APIs include:
|
Comments |
Comment by Matthew Swift [ 26/Jun/13 ] |
For the Java APIs I propose that we introduce three new annotations:
In addition, we can re-use the @Deprecated annotation from java.lang. Another option is to use a single parameterized annotation like @Stability, which has a parameter indicating the stability level. However, a single annotation prevents us from taking advantage of @Deprecated, forcing us to effectively duplicate information, e.g: @Stability(level=DEPRECATED) @Deprecated public interface MyDeprecatedInterface { ... } Obviously, the first approach allows a developer to annotate an element with conflicting levels, e.g: @Evolving @Deprecated public interface MySchizoInterface { ... } Another important issue how these stability annotations will be inherited, since it would be pretty cumbersome to have to provide annotations on every single class and method. There are two axes of "inheritance", the first being via traditional class/interface inheritance, and the second via scope (i.e. package, then class, then individual methods and fields). We should support both, and provide the ability to override where needed. For example, I should be able to tag an entire package as stable, and a single class as deprecated or evolving. In other words, a method or field will inherit its stability level from its containing class, which in turn inherits its stability level from its package or parent super-class / interface. A problem with this approach is how we should handle cases where there are conflicting inherited stability levels (e.g. between a class's package and its super-class/interface, or between super-interfaces). Finally, it would be nice if Javadoc generation could extract any inherited stability levels so that it is easy to determine the effective stability level of an element without having to understand the rules and navigate through parent classes and packages. |
Comment by Jean-Noël Rouvignac [ 26/Jun/13 ] |
I think @Stability annotation + enum for the Stability level is more expressive. I suppose the @Stability annotation can also be applied to methods, right? Concerning the javadocs:
Concerning conflicting stability levels, we must define an inheritance order, like for example:
The harder bit is when hierarchically unrelated super-classes/super-interfaces have conflicting annotations. I think it is best to retain the least stable stability level. As I mentioned earlier, unit tests can be written to ensure everything is hunky-dory. |
Comment by Matthew Swift [ 27/Jun/13 ] |
Thanks Jean-Noel. I agree with your comments. I originally proposed using separate annotations in order to allow us to re-use @Deprecated. However, there are some aspects of Deprecated that don't really fit so well with some of the semantics described above. For example, @Deprecated is not inherited. In addition, we will not be able to extend it either, e.g. to add version information, like "since version xxx". |
Comment by Matthew Swift [ 27/Jun/13 ] |
Back to the original goal which is to document the SDK APIs. Unless specified the default stability is internal. opendj-ldap-sdkThis module is stable with exceptions:
opendj-ldap-sdk-examplesThe examples in this module are evolving. opendj-ldap-toolkitThe command line tools provided by this module are evolving. opendj-rest2ldapThis module is evolving. opendj-rest2ldap-servletThis module is evolving. opendj-server2x-adapterThis module is stable, although it should be noted that the server APIs with which it interacts are evolving. |
Comment by Matthew Swift [ 27/Jun/13 ] |
Annotating the SDK will be addressed in a separate issue post 2.6.0 |