[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-dev] dynamic binding issue
|
"this" in an inter-type method declaration is not the
"actual" type but always the declaring type -- in your
case, AbstractElement. So ajc is flagging a Java error;
javac would emit the same error if you wrote
class Element extends AbstractElement {..}
...
interface Visitor {
void visit(Element e);
}
...
AbstractElement e = ...;
((Visitor) something).visit(e);
Wes
ukfsn wrote:
I have the following interface:
interface Visitor {
public void visit(Element e);
}
where Element extends AbstractElement.
I also have the following aspect:
aspect Visiting {
public void AbstractElement.visit(Visitor v) {
v.visit(this);
}
}
When I try to compiler the program I get the following error:
The method visit(Element) in the type Visitor is not applicable for the arguments (AbstractElement)
return visitor.visit(this);
Must I check the type of this in the inter-type declration and manually cast to the correct subtype?
Eric M.