| Summary: | Regression: Multiple advice with same signature on same template don't work | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] M2T | Reporter: | Achim Demelt <achim.demelt> | ||||||||
| Component: | Xpand | Assignee: | Project Inbox <m2t.xpand-inbox> | ||||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||||
| Severity: | major | ||||||||||
| Priority: | P3 | CC: | sebastian.zarnekow | ||||||||
| Version: | 1.0.0 | Flags: | sebastian.zarnekow:
helios+
|
||||||||
| Target Milestone: | SR1 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Linux | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 173997 [details]
Proposed patch
I don't think that the body is a good criteria for equal advices. As this is a regression, I'ld like to restore the old behavior and consider getOwner().getFullyQualfiiedName() as a indicator for equal advices. Don't forget to implement #hashCode() Created attachment 175044 [details]
Updated Patch
Updated patch that uses the owner of an Advice in the equals() method instead of the body. Now also overrides hashCode().
Patch committed to HEAD. Bug resolved before Xpand 1.2 release date => Closing |
Created attachment 173996 [details] Test case for this regression This constellation worked in 0.7.0 but fails with 1.0.0: Foo.xpt: «DEFINE foo FOR Object»«ENDDEFINE» Advice1.xpt «AROUND *foo FOR Object»A«ENDDEFINE» Advice2.xpt «AROUND *foo FOR Object»B«ENDDEFINE» Activating both advice will yield "A" instead of "AB". The second advice is not applied. This regression was introduced by the addition of the toString() method in Advice.java. Since the equals() operation in AbstractDefinition.java is based on toString(), two Advice with the same signature on the same template are regarded as equal, although they come from different sources and have different bodies. Attached is a test case for this constellation as well as a proposed fix: The equals() method now also takes into account the body of the advice. If everybody's ok with this, I'll commit this fix to HEAD as well as Helios SR1.