Community
Participate
Working Groups
We discovered that apparently weaving two methods with same name and same number of parameters automatically leads to putting annotations of the first method to both the first and second method in the generated class, removing the possible existing annotations for it. So in our case we have an aspect file containing two methods: ``` @Deprecated(since = "2.2M2") public void XWikiDocument.rename(String newDocumentName, XWikiContext context) throws XWikiException { // Do stuff } @Deprecated(since = "12.5RC1") public void XWikiDocument.rename(DocumentReference newReference, XWikiContext context) throws XWikiException { // Do other stuff } ``` The obtained bytecode contains: ``` @Deprecated(since = "2.2M2") public void rename(String newDocumentName, XWikiContext context) throws XWikiException { // Do stuff } @Deprecated(since = "2.2M2") public void rename(DocumentReference newReference, XWikiContext context) throws XWikiException { // Do other stuff } ``` When trying to understand the behaviour, I added another annotation to the first method: ``` @Deprecated(since = "2.2M2") @javax.validation.constraints.Size(message = "toto") public void XWikiDocument.rename(String newDocumentName, XWikiContext context) throws XWikiException { // Do stuff } @Deprecated(since = "12.5RC1") public void XWikiDocument.rename(DocumentReference newReference, XWikiContext context) throws XWikiException { // Do other stuff } ``` And I obtained: ``` @Deprecated(since = "2.2M2") @javax.validation.constraints.Size(message = "toto") public void rename(String newDocumentName, XWikiContext context) throws XWikiException { // Do stuff } @Deprecated(since = "12.5RC1") @javax.validation.constraints.Size(message = "toto") public void rename(DocumentReference newReference, XWikiContext context) throws XWikiException { // Do other stuff } ``` Note that we don't have a method called `rename` with 2 parameters in the original `XWikiDocument.java`.
Sorry I made a wrong copy paste, the latest bytecode I obtain is the following: ``` @Deprecated(since = "2.2M2") @javax.validation.constraints.Size(message = "toto") public void rename(String newDocumentName, XWikiContext context) throws XWikiException { // Do stuff } @Deprecated(since = "2.2M2") @javax.validation.constraints.Size(message = "toto") public void rename(DocumentReference newReference, XWikiContext context) throws XWikiException { // Do other stuff } ``` So same annotations on both methods
Also we're using AspectJ 1.9.19 but couldn't find it for the ticket version.
Duplicatte of https://github.com/eclipse-aspectj/aspectj/issues/246, we will discuss it there.