Community
Participate
Working Groups
Given this program there is no marker from the declare to the annotated method, although this is being woven since there is output from -showWeaveInfo: ---------------------------------------------------------------- public aspect DeclareAnnotation { declare @method : * debit(..) : @Secured(role="supervisor"); } class BankAccount { public void debit(String accId,long amount) { } } @interface Secured { String role(); }
Created attachment 42697 [details] failing testcase Apply this patch to the tests project
The reason this is failing is that in AsmRelationshipProvider.addDeclareAnnotationRelationship(..) we are asking for the IProgramElement with signature debit(String,long) rather than debit(java.lang.String,long). This is because earlier in the method we strip java.lang.String down to String.
Created attachment 42698 [details] proposed fix Apply the patch to the weaver project. The fix is to not strip out the "java.lang" part of "java.lang.String" in the case of methods. At the moment I've added a guard to the proposed fix to still to the same if its a constructor. This is because, as mentioned in bug 143930, constructors and methods are currently dealt with differently. When bug 143930 is fixed, the extra check for "isConstructor" can be removed and constructors and methods can be dealt with the same way when constructing the parmString: Type type2 = args[i]; if (isConstructor) { String s = Utility.signatureToString(type2.getSignature()); if (s.lastIndexOf(".")!=-1) s =s.substring(s.lastIndexOf(".")+1); parmString.append(s); } else { String s = Utility.signatureToString(type2.getSignature(),false); parmString.append(s); } if ((i+1)<args.length) parmString.append(","); }
Just as a note, the modification to the proposed fix mentioned in the above comment has been submitted (along with this testcase) in the bug report for bug 143930.
patches from other bug committed.