Summary: | Ambiguous method error when weaving in binary aspects | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Christoph Cenowa <cenowa> |
Component: | Compiler | Assignee: | Andrew Clement <aclement> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | major | ||
Priority: | P3 | ||
Version: | DEVELOPMENT | ||
Target Milestone: | 1.5.0RC1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Christoph Cenowa
2005-11-30 03:55:48 EST
Passing over to the compiler Recreated on the command line: C:\aspectj1.5.0-dev\pr118599>ajc -1.5 -d output Attributable.java C:\aspectj1.5.0-dev\pr118599>ajc -1.5 -aspectpath output AnAttributedClass.java C:\aspectj1.5.0-dev\pr118599\AnAttributedClass.java:4 [error] The method setAttribute(String, Object) is ambiguous for the type AnAttributedClass this.setAttribute("foo", "bar"); ^^^^^^^ 1 error Some progress. The difference when binary weaving is that we find two method bindings for setAttributes() on the Attributable class. We find the one declared in the interface directly and another is returned from the inter type member finder. In the 'working' case when everything is compiled together, we go into the 'getMethods()' for the intertypememberfinder attached to the binarytypebinding for the Attributable interface - this asks the sourcetypebinding for 'getMethodsBase("setAttribute")' and gets back null (the methods aren't resolved yet...). (in the failing case there is a method returned). The finder then discovers the ITD and returns it - so only one 'answer' and therefore not reported as ambiguous. I've just committed a fix for this - the problem was comparing an unresolved method binding with a resolved method binding and discovering that 'Unresolved type String' didnt match 'String'. If the matching fails in the inter type member finder then we don't sort out duplicates correctly in the member finder and so you can end up with two entries for the same method. Fix will be in next AspectJ build and AJDT in a few days. fix available now in AspectJ. |