Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 492645 - [DS] Compile error for "updated" reference event method
Summary: [DS] Compile error for "updated" reference event method
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 4.6 RC1   Edit
Assignee: Peter Nehrer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 490058
  Show dependency tree
 
Reported: 2016-04-28 07:21 EDT by Dirk Fauth CLA
Modified: 2016-05-12 04:55 EDT (History)
2 users (show)

See Also:
Vikas.Chandra: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Fauth CLA 2016-04-28 07:21:19 EDT
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) {
	
}
Comment 1 Dirk Fauth CLA 2016-05-05 08:15:31 EDT
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.
Comment 2 Peter Nehrer CLA 2016-05-05 08:34:56 EDT
Yes, this appears to violate to spec. I'm not sure why I excluded the other signatures but I'll add them back.
Comment 3 Eclipse Genie CLA 2016-05-05 09:49:29 EDT
New Gerrit change created: https://git.eclipse.org/r/72145
Comment 4 Vikas Chandra CLA 2016-05-09 05:23:29 EDT
Peter, do you think this should go in 4.6RC1?
Comment 5 Peter Nehrer CLA 2016-05-09 08:07:52 EDT
Sure, it can.
Comment 6 Dirk Fauth CLA 2016-05-10 09:14:07 EDT
(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). :-)
Comment 7 Dirk Fauth CLA 2016-05-11 09:42:40 EDT
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);
Comment 8 Dirk Fauth CLA 2016-05-11 13:58:37 EDT
@PDE committers

Any chance this gets in RC1? AFAIK the deadline for contributions to RC1 is reached in a few hours.
Comment 10 Vikas Chandra CLA 2016-05-11 15:29:42 EDT
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?
Comment 11 Vikas Chandra CLA 2016-05-12 04:55:17 EDT
verified on

Version: Neon (4.6)
Build id: I20160511-2000