You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Konrad Windszus <ko...@gmx.de> on 2016/01/24 18:33:49 UTC

Annotations and Semantic Versioning

In SLING-5013 the according provider type/consumer type annotations have been added to all interfaces except for the annotation types.
In older versions of the maven-bundle-plugin the provider type has been the default but now it is consumer type (https://github.com/bndtools/bnd/commit/5935e70ba990e40a95e14fb932158ebf8d2225fe).
But testing it out it actually doesn’t make any difference for baselining whether any annotation type is marked consumer or provider type. In case I add a new element to the type (independent on whether this has a default or not), the suggested version upgrade is only minor. The output of the baselining is always 

org.apache.sling.models.annotations.injectorspecific minor      1.1.0      1.1.0      1.2.0      Version increase required
[INFO]      < annotation org.apache.sling.models.annotations.injectorspecific.ResourcePath
[INFO]          + method newField()
[INFO]              + access abstract
[INFO]              + return boolean

This is probably because adding a method to an interface does not break compatibility (https://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html#jls-13.5.3, and https://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html#jls-13.5.7), but in reality all the clients will fail at runtime if the element does not have a default value. Is this some corner case, which is just not covered by the baselining plugin or have I discovered a bug?
Thanks for your comments on that.
Konrad

Re: Annotations and Semantic Versioning

Posted by Konrad Windszus <ko...@gmx.de>.
I opened https://github.com/bndtools/bnd/issues/1292 <https://github.com/bndtools/bnd/issues/1292> about that.

> On 24 Jan 2016, at 18:33, Konrad Windszus <ko...@gmx.de> wrote:
> 
> In SLING-5013 the according provider type/consumer type annotations have been added to all interfaces except for the annotation types.
> In older versions of the maven-bundle-plugin the provider type has been the default but now it is consumer type (https://github.com/bndtools/bnd/commit/5935e70ba990e40a95e14fb932158ebf8d2225fe).
> But testing it out it actually doesn’t make any difference for baselining whether any annotation type is marked consumer or provider type. In case I add a new element to the type (independent on whether this has a default or not), the suggested version upgrade is only minor. The output of the baselining is always 
> 
> org.apache.sling.models.annotations.injectorspecific minor      1.1.0      1.1.0      1.2.0      Version increase required
> [INFO]      < annotation org.apache.sling.models.annotations.injectorspecific.ResourcePath
> [INFO]          + method newField()
> [INFO]              + access abstract
> [INFO]              + return boolean
> 
> This is probably because adding a method to an interface does not break compatibility (https://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html#jls-13.5.3, and https://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html#jls-13.5.7), but in reality all the clients will fail at runtime if the element does not have a default value. Is this some corner case, which is just not covered by the baselining plugin or have I discovered a bug?
> Thanks for your comments on that.
> Konrad