Community
Participate
Working Groups
While playing around with the DS Annotations support added with Neon, I realized there is something wrong with the @Reference annotation regarding the updated event method. The specification says that event methods (bind/unbind/updated) support the following method signatures: void <method-name>(ServiceReference); void <method-name>(<parameter-type>); void <method-name>(<parameter-type>, Map); This works well for bind and unbind. But for updated only the ServiceReference signature is accepted. The other two signatures cause an error. For example, the following will show the error "No suitable updated method named 'updatedInverter' found in implementation class hierarchy." @Reference(updated="updatedInverter") public void setInverter(StringInverter inverter) { this.inverter = inverter; } public void updatedInverter(StringInverter inverter) { }
After I got feedback on Bug 492717 I realized that this bug is more severe than only showing a wrong error. The DS Annotations only process the updatedXxx(ServiceReference) correctly and don't respect the other two possible signatures. So when using the updatedXxx(<parameter-type>, Map) variant for example, a component xml file for DS 1.1.0 is generated and the updated attribute is missing in the reference tag. Therefore the processing is wrong when it comes to the updated event method. If you have any hints on where and how to fix this let me know. I think this is important for the release.
Yes, this appears to violate to spec. I'm not sure why I excluded the other signatures but I'll add them back.
New Gerrit change created: https://git.eclipse.org/r/72145
Peter, do you think this should go in 4.6RC1?
Sure, it can.
(In reply to Vikas Chandra from comment #4) > Peter, do you think this should go in 4.6RC1? I think it should go in 4.6 RC1 as it violates the spec otherwise which will lead to a lot of confusion otherwise (see my various tickets about this). :-)
I checked out the patch locally and tested the "updated" method handling with DS annotations. It looks good from my point of view. Now using the following signature leads to correct ds spec usage in the generated xml. void <method-name>(<parameter-type>, Map);
@PDE committers Any chance this gets in RC1? AFAIK the deadline for contributions to RC1 is reached in a few hours.
Gerrit change https://git.eclipse.org/r/72145 was merged to [master]. Commit: http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=bb3067beba70e3d2e974a7454cf7e4b0538a48a3
Code works fine for update methods for following signatures void <method-name>(<parameter-type>); void <method-name>(<parameter-type>, Map); Tests run fine. Looks good for RC1. Thanks Peter ! Any chance of a test case here for RC2?
verified on Version: Neon (4.6) Build id: I20160511-2000