Hi Radu,
thanks, you are obviously right that leaving out the default does mean I have 
to always give it a value which is definitely not intended.

I quickly looked up the spec regarding empty values, but OSGi R7 Comp only 
states in 112.8.3 2
"For component property type methods with a value of an empty array, a property 
element must
not be generated"

I used that approach for the multivalue entries. But I guess for singlevalue 
entries we cannot prevent that property from appearing in the component 
description.
It shouldn't harm though.

But not specifying the property or specifying the property with the default 
value (i.e. when using the servlet annotation) must not lead to different 
semantics!
So I guess in this case it is correct to set the default to 
"sling/servlet/default".
That should also be stated in the javadoc and in the documentation page.

Thanks,
Konrad

> On 13. Dec 2018, at 23:11, Radu Cotescu <[email protected]> wrote:
> 
> Hi Konrad,
> 
>> On 13 Dec 2018, at 19:44, Konrad Windszus <[email protected]> wrote:
>> 
>> Hi Radu,
>> I don't really understand the fix in 
>> https://github.com/apache/sling-org-apache-sling-servlets-annotations/commit/9cc022fa517a858e96229e8629b0102914abb435
>>  
>> <https://github.com/apache/sling-org-apache-sling-servlets-annotations/commit/9cc022fa517a858e96229e8629b0102914abb435>.
>> The previous default (i.e. null) should lead to the fact that the service 
>> property is not generated if there is no value set. Now  the property is 
>> always generated!  The former seems to be the more correct approach. 
>> Especially if I want to generate servlets targeting pre 2.5.0 servlet 
>> resolver.
>> Can you explain?
>> 
>> Thanks,
>> Konrad
> 
> There was no default value before - which would force consumers to specify a 
> value in all annotations - and “null” is not an allowed default value [0][1]. 
> An empty string value would not be taken into consideration by the 
> o.a.s.servlets.resolver, but maybe a better option would be to specify 
> “sling/servlet/default”?!
> 
> Cheers,
> Radu
> 
> [0] - https://docs.oracle.com/javase/specs/jls/se11/html/jls-9.html#jls-9.6.2 
> <https://docs.oracle.com/javase/specs/jls/se11/html/jls-9.html#jls-9.6.2>
> [1] - 
> https://builds.apache.org/job/sling-org-apache-sling-servlets-annotations-it-1.8/97/console
>  
> <https://builds.apache.org/job/sling-org-apache-sling-servlets-annotations-it-1.8/97/console>
> 

Reply via email to