mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-09-10 06:35:53 +02:00
8785665986
If an anonymous class calls a method ITD'd onto one of its own supertypes (e.g. new A() { xx(null); }) then it can be reported as an ambiguous method invocation on Java8. There is different handling for Java8 that is revealing an issue. The intertype method declarations are recorded in a member finder attached to the target type (A in this case). When the local type binding is built it gets all the methods from supertypes added to it - this unfortunately includes the ITD method. Then later when something asks for all 'xx' methods on A, it finds the ITD method from when A was constructed and an additional copy from the member finder. The quick fix is for the member finder to use a set rather than list when answering 'what are the xx methods'. If this proves a problem down the line the deeper fix would be to avoid including ITDs when the local type binding is built.
14 lines
172 B
Java
14 lines
172 B
Java
import java.util.List;
|
|
|
|
aspect F {
|
|
void A.xx(List<String> x) { }
|
|
}
|
|
class A {
|
|
//void xx(List<String> x) {}
|
|
}
|
|
class E {
|
|
void foo() {
|
|
new A() {}.xx(null);
|
|
}
|
|
}
|